@kedataindo/docflow-vue 0.0.28 → 0.0.30

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/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Ap=Object.defineProperty;var Op=(e,t,i)=>t in e?Ap(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var Xt=(e,t,i)=>Op(e,typeof t!="symbol"?t+"":t,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _e=require("@kedataindo/docflow-core"),s=require("vue"),Cn=require("@kedataindo/docflow-layout-engine");function Ic(e){const t=s.ref(null),i=s.shallowRef(null),n=s.ref(!1),r=s.computed(()=>{var c;return((c=i.value)==null?void 0:c.editor)??null}),a=s.computed(()=>{var c;return((c=i.value)==null?void 0:c.pluginActions)??{}}),o=()=>{if(!t.value||i.value)return;const c=s.unref(e.collaboration),f=s.unref(e.content),p=_e.createEditor({target:t.value,content:f,plugins:e.plugins,editable:e.editable??!0,collaboration:c,onUpdate:e.onUpdate,getPageMap:e.getPageMap,paginationOptions:e.paginationOptions,onImageUpload:e.onImageUpload,citation:e.citation,aiStream:e.aiStream,aiDraft:e.aiDraft,debug:e.debug});i.value=p,s.nextTick(()=>{n.value=!0})},l=()=>{var c;(c=i.value)==null||c.destroy(),i.value=null,n.value=!1};return s.onMounted(()=>{o()}),s.onUnmounted(()=>{l()}),s.watch(()=>e.editable,c=>{r.value&&r.value.setEditable(c??!0)}),s.watch(()=>{const c=s.unref(e.collaboration);return c?{room:c.room,provider:c.provider}:null},async(c,f)=>{JSON.stringify(c)!==JSON.stringify(f)&&(l(),await s.nextTick(),o())},{deep:!0}),{editorRef:t,docsEditor:i,editor:r,pluginActions:a,isReady:n}}function Tp(e){const t=s.computed(()=>{var r,a,o;return(o=(a=(r=e.value)==null?void 0:r.storage)==null?void 0:a.editorContext)==null?void 0:o.aiStream}),i=s.computed(()=>{var r,a,o;return(o=(a=(r=e.value)==null?void 0:r.storage)==null?void 0:a.editorContext)==null?void 0:o.aiDraft}),n=s.computed(()=>!!t.value);return{aiStream:t,aiDraft:i,isAIAvailable:n}}const sl="docs-editor-theme",eo=s.ref(!1);function Ba(){const e=i=>{if(eo.value=i,typeof document<"u"){const n=document.documentElement;i?n.classList.add("dark"):n.classList.remove("dark")}typeof localStorage<"u"&&localStorage.setItem(sl,i?"dark":"light")},t=()=>e(!eo.value);return s.onMounted(()=>{let i=!1;if(typeof localStorage<"u"){const n=localStorage.getItem(sl);n?i=n==="dark":typeof window<"u"&&(i=window.matchMedia("(prefers-color-scheme: dark)").matches)}e(i)}),{isDark:eo,toggle:t}}const Dc={common:{save:"Save",cancel:"Cancel",create:"Create",delete:"Delete",rename:"Rename",duplicate:"Duplicate",move:"Move",moveToFolder:"Move to folder",moveDocument:"Move Document",noFolder:"(No Folder)",search:"Search",loading:"Loading...",error:"Error",dismiss:"Dismiss",emptyDocument:"(Empty Document)",confirmDelete:"Are you sure you want to delete this document?",undo:"Undo",restore:"Restore",deleteForever:"Delete forever",back:"Back",confirmPermanentDelete:"Permanently delete this document? This cannot be undone."},header:{file:"File",new:"New",newDocument:"New document",open:"Open",makeACopy:"Make a copy",share:"Share",email:"Email",emailDraft:"Email draft",download:"Download",rename:"Rename",move:"Move",moveToFolder:"Move to folder",moveToTrash:"Move to trash",addToStarred:"Add to Starred",versionHistory:"Version history",language:"Language",pageSetup:"Page setup",print:"Print",details:"Details",security:"Security limitations",edit:"Edit",view:"View",insert:"Insert",format:"Format",tools:"Tools",extensions:"Extensions",help:"Help",backToDocuments:"Back to Documents",clickToRename:"Click to rename",starDocument:"Star document",unstarDocument:"Unstar document",sandbox:"Sandbox (toggle simulated collaborators)",theme:"Theme",account:"Account",markdown:"Markdown (.md)",html:"Web page (.html)",htmlZip:"Web page (.html, zipped)",text:"Plain text (.txt)",docx:"Microsoft Word (.docx)",pdf:"PDF Document (.pdf)",odt:"OpenDocument Format (.odt)",rtf:"Rich Text Format (.rtf)",undo:"Undo",redo:"Redo",selectAll:"Select all",cut:"Cut",copy:"Copy",paste:"Paste",pasteWithoutFormatting:"Paste without formatting",delete:"Delete",findAndReplace:"Find and replace",showSidebar:"Show outline",focusMode:"Full focus mode",showRuler:"Show ruler",meetingNotes:"Meeting notes",image:"Image",table:"Table",codeBlock:"Code block",link:"Link",header:"Header",footer:"Footer",footnote:"Footnote",tableOfContents:"Table of contents",bold:"Bold text",italic:"Italic text",underline:"Underline",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",alignIndent:"Align & indent",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignJustify:"Justify",bulletsNumbering:"Bullets & numbering",bulletList:"Bulleted list",numberedList:"Numbered list",taskList:"Task list",horizontalLine:"Horizontal line",pageNumbers:"Page numbers",pageNumberInHeader:"Insert in header",pageNumberInFooter:"Insert in footer",pagelessFormat:"Pageless format",clearFormatting:"Clear formatting",spellCheck:"Spell check",wordCount:"Word count",preferences:"Preferences",manageExtensions:"Manage extensions…",keyboardShortcuts:"Keyboard shortcuts",reportIssue:"Report issue",about:"About DocsEditor"},toolbar:{undo:"Undo",redo:"Redo",print:"Print",spelling:"Spelling",zoom:"100%",paragraphStyle:"Paragraph style",normalText:"Normal text",fontFamily:"Font family",decreaseFontSize:"Decrease font size",increaseFontSize:"Increase font size",fontSize:"Font size",lists:"Lists",alignment:"Alignment",insert:"Insert",comments:"Comments",history:"History",ai:"AI",tableOfContents:"Table of contents",references:"References"},statusBar:{liveSyncActive:"Live Sync Active",connecting:"Connecting…",saving:"Saving changes…",offline:"Offline",lastSavedAt:"Last saved at",never:"Never",pageSize:"Page size",page:"Page",of:"of",pageless:"Pageless",words:"words",characters:"characters"},editor:{share:{title:"Share document",close:"Close",shareableLink:"Shareable link",copy:"Copy",copied:"Link copied to clipboard",couldNotCopy:"Could not copy link",collaborators:"Collaborators",addCollaborator:"Add collaborator by email",placeholder:"colleague@example.com",add:"Add",userNotFound:"User not found",failedToAdd:"Failed to add collaborator",visibility:"Visibility",private:"Private",privateDescription:"Only you and people you invite can access this document.",restricted:"Restricted",restrictedDescription:"Anyone with the link can view this document."},print:"Print",logOut:"Log out",rename:{title:"Rename document",label:"Document title",save:"Save",cancel:"Cancel"},pageSetup:{title:"Page setup",paperSize:"Paper size",orientation:"Orientation",portrait:"Portrait",landscape:"Landscape",margins:"Margins",top:"Top",bottom:"Bottom",left:"Left",right:"Right",apply:"Apply",cancel:"Cancel"},details:{title:"Document details",titleLabel:"Title",owner:"Owner",location:"Location",noFolder:"(No folder)",created:"Created",modified:"Last modified",statistics:"Statistics",words:"Words",characters:"Characters",pages:"Pages",loading:"Loading document details…"},email:{title:"Email this file",to:"To",toPlaceholder:"recipient@example.com",subject:"Subject",body:"Body",send:"Send",copyLink:"Copy link",shareableLink:"Shareable link",defaultSubject:"Document: {title}",defaultBody:"You can view this document at: {url}"},linkDialog:{insertTitle:"Insert link",editTitle:"Edit link",text:"Text to display",textPlaceholder:"Link text",url:"URL",urlPlaceholder:"https://example.com",insert:"Insert",update:"Update",remove:"Remove link",cancel:"Cancel",urlRequired:"URL is required",urlInvalid:"Please enter a valid URL"},findReplace:{title:"Find and replace",findPlaceholder:"Find in document",replacePlaceholder:"Replace with",next:"Next",previous:"Previous",replace:"Replace",replaceAll:"Replace all",noMatches:"No matches",matchCount:"{current} of {total}",close:"Close"},headerFooter:{title:"Header & Footer Customization",header:"Header",footer:"Footer",left:"Left",right:"Right",clear:"Clear",headerPlaceholder:"e.g. Document Title",footerPlaceholder:"e.g. Page {page} of {total}",headerLeftPlaceholder:"e.g. Document Title",headerRightPlaceholder:"e.g. Page {page}",footerLeftPlaceholder:"e.g. Confidential",footerRightPlaceholder:"e.g. Page {page} of {total}",variableInfo:"Variable Info: You can use {page} for the current page number, and {total} for the total page count.",differentFirstPage:"Different first page",differentOddEven:"Different odd & even pages",options:"Options",formatHeader:"Header format",pageNumber:"Page numbers",removeHeader:"Remove header",headerFooterFormatTitle:"Header & footer",marginSection:"Margin",headerTopMargin:"Header (centimeters from top)",footerBottomMargin:"Footer (centimeters from bottom)",layoutSection:"Layout",pageNumberTitle:"Page numbers",positionSection:"Position",positionHeader:"Header",positionFooter:"Footer",showOnFirstPage:"Show on first page",numberingSection:"Numbering",startAt:"Start at",continueFromPrevious:"Continue from previous section",apply:"Apply",cancel:"Cancel",save:"Save"},showOutline:"Show document outline",loadingDocument:"Loading document"},slashMenu:{title:"Suggested",basicBlocks:"Basic Blocks",noMatch:"No matching commands"},documentTabs:{documentTabs:"Document Tabs",addTab:"Add tab",rename:"Rename",delete:"Delete",outline:"Outline",untitledHeading:"Untitled Heading {level}",placeholder:"Headings you add to the document will appear here."},theme:{lightMode:"Switch to light mode",darkMode:"Switch to dark mode"},sidebars:{ai:{title:"AI Writing Helper",description:"A server-side AI co-writer to draft, summarize, or edit your copy.",quickMacros:"Quick AI Macros",summarize:"Summarize",fixGrammar:"Fix Grammar",continue:"Continue",toSpanish:"To Spanish",generations:"AI Generations",aiDrafting:"AI drafting…",copy:"Copy",copied:"Copied",insert:"Insert",inserted:"Inserted",noDraft:"Ask anything about your document, or run a quick macro above.",promptPlaceholder:"Ask AI to draft outline, write content, rewrite tone…",promptAI:"Prompt AI",close:"Close",you:"You",assistant:"Assistant",notConfigured:"AI is not configured on this deployment.",selectTextFirst:"Select text in the document first",improveSelection:"Improve selection",draft:"Draft with citations",draftPlaceholder:"Ask the AI to draft text grounded on your reference library…",promptDraft:"Draft",citations:"Citations",emptyResponse:"The AI returned an empty response.",aiError:"AI request failed"},comments:{title:"Discussion Panel",placeholder:"Select text to add a comment…",addComment:"Add comment",resolve:"Resolve",reply:"Reply…",replyInThread:"Reply in thread",active:"Active",resolved:"Resolved",creatingAnchored:"Creating anchored comment:",quote:"Quote:",resolvedBy:"Resolved by {user}",noComments:"No {mode} comments yet.",commentOnSelection:"Comment on selection…",generalComment:"Add general comment to document…",anchoredComment:"Anchored comment",general:"General comment",post:"Post",orphaned:"Text deleted",delete:"Delete",confirmDelete:"Delete this comment thread? This cannot be undone."},history:{title:"History",empty:"No history yet.",version:"Version",restore:"Restore",closePreview:"Close Preview",restoreThis:"Restore This",viewingPreview:"Viewing Revision Preview",readOnlyPreview:"You are previewing version #{index}. Your editor is temporarily read-only.",modifiedBy:"Modified by:",saveNamedSnapshot:"Save Named Snapshot",snapshotPlaceholder:"e.g. Approved Final Draft…",noSnapshots:"No snapshots saved yet.",save:"Save",cancel:"Cancel",preview:"Preview"},toc:{title:"Contents",empty:"No headings yet.",untitledHeading:"Untitled Heading {level}",newSection:"New {tag} Section",startWriting:"Start writing here…",closeOutline:"Close outline",searchHeadings:"Search headings…",noHeadings:"No Headings Yet",noHeadingsDescription:"Use headers (H1, H2, or H3) to structure your document. An interactive outline will generate here automatically.",quickInsert:"Quick Insert",headingLevel:"Heading {level}",noMatchingHeaders:"No matching headers found",tryDifferentTerm:"Try searching with a different term.",outlineLayout:"Outline Layout",outlineSync:"Outline syncs automatically. Click any header to instantly jump, focus, and scroll the editor to that section."},references:{title:"References",subtitle:"Manage sources and insert citations.",close:"Close references",citationStyle:"Citation style",searchSources:"Search sources…",addSource:"Add source",editSource:"Edit source",noSources:"No sources yet",noSourcesDescription:"Add your first reference to start citing. Citations and the bibliography follow the active style automatically.",noMatchingSources:"No matching sources found",cite:"Cite",edit:"Edit",delete:"Delete",back:"Back to list",anonymous:"Anonymous",etAl:"et al.",confirmDelete:'Delete source "{title}"? Citations referencing it will stop rendering.',import:{title:"Import",fromDoi:"From DOI (CrossRef)",doiPlaceholder:"Paste a DOI or DOI link…",importDoi:"Import DOI",doiSuccess:"Source imported from CrossRef.",doiFailed:"DOI could not be resolved.",fromFile:"From BibTeX / RIS file",pickFile:"Choose .bib or .ris file",importing:"Importing…",batchSuccess:"{count} source(s) imported.",partial:"{ok} imported, {failed} failed.",failed:"Import failed."},types:{book:"Book","article-journal":"Journal article",chapter:"Book chapter",webpage:"Web page",report:"Report",thesis:"Thesis",document:"Document"},form:{type:"Source type",title:"Title",authors:"Authors",familyName:"Family name",givenName:"Given name",addAuthor:"Add author",year:"Year",journal:"Journal",bookTitle:"Book title",publisher:"Publisher",publisherPlace:"Place",volume:"Volume",issue:"Issue",pages:"Pages",save:"Save changes",create:"Add source",cancel:"Cancel"}}},dashboard:{allDocuments:"All Documents",starred:"Starred",folders:"Folders",createFolder:"Create New Folder",folderNamePlaceholder:"Folder name…",noFolders:"No folders created yet.",startNewDocument:"Start a New Document",blankDocument:"Blank Document",blankDescription:"Fresh slate",meetingNotes:"Meeting Notes",meetingNotesDescription:"Attendees & Action Items",projectProposal:"Project Proposal",projectProposalDescription:"Objectives & Deliverables",officialLetter:"Official Letter",officialLetterDescription:"Pre-formatted header",searchPlaceholder:"Search titles or full-text contents…",modified:"Modified",alphabetical:"Alphabetical",created:"Created",gridView:"Grid View",listView:"List View",activeFilters:"Active Filters:",folder:"Folder",starredOnly:"Starred Only",search:"Search",noDocuments:"No documents found",noDocumentsDescription:"No files match your current filters. Select a template or create a blank file to start drafting!",createBlankDocument:"Create Blank Document",loadingDocuments:"Loading documents...",folderCreated:"Folder created.",folderAlreadyExists:"A folder with that name already exists.",folderLoadError:"Could not load folders. Please try again.",folderCreateError:"Could not create the folder. Please try again.",documentTitle:"Document Title",lastModified:"Last Modified",actions:"Actions",trash:"Trash",trashEmpty:"Trash is empty",trashEmptyDescription:"Deleted documents will appear here.",trashedAt:"Trashed",movedToTrash:"Moved to trash:"},auth:{signInTitle:"Sign in to create and edit documents",signInWithGoogle:"Sign in with Google",signInWithEmail:"Sign in with Email",signInWithGitHub:"Sign in with GitHub",signInWith:"Sign in with {provider}",or:"or",email:"Email",password:"Password",name:"Name",signIn:"Sign In",signUp:"Sign Up",signOut:"Sign out",noAccount:"Don't have an account? Sign up",hasAccount:"Already have an account? Sign in",invalidCredentials:"Invalid email or password",accountCreated:"Account created! You are now signed in.",loadDocumentsError:"Failed to load documents. Is the server running?",retry:"Try again",rateLimited:"Server is rate limiting requests.",retryIn:"Retrying in {seconds}s…",networkError:"Could not reach the server. Check your connection.",noProviders:"No authentication providers configured. Check your server environment variables."},language:{label:"Language",en:"English",id:"Indonesian"}},Rc={common:{save:"Simpan",cancel:"Batal",create:"Buat",delete:"Hapus",rename:"Ubah nama",duplicate:"Duplikat",move:"Pindah",moveToFolder:"Pindah ke folder",moveDocument:"Pindahkan Dokumen",noFolder:"(Tanpa Folder)",search:"Cari",loading:"Memuat…",error:"Kesalahan",dismiss:"Tutup",emptyDocument:"(Dokumen Kosong)",confirmDelete:"Apakah Anda yakin ingin menghapus dokumen ini?",undo:"Batalkan",restore:"Pulihkan",deleteForever:"Hapus permanen",back:"Kembali",confirmPermanentDelete:"Hapus dokumen ini secara permanen? Tindakan ini tidak dapat dibatalkan."},header:{file:"Berkas",new:"Baru",newDocument:"Dokumen baru",open:"Buka",makeACopy:"Buat salinan",share:"Bagikan",email:"Email",emailDraft:"Draf Email",download:"Unduh",rename:"Ubah nama",move:"Pindah",moveToFolder:"Pindah ke folder",moveToTrash:"Pindah ke sampah",addToStarred:"Tambahkan ke Bintang",versionHistory:"Riwayat versi",language:"Bahasa",pageSetup:"Penataan halaman",print:"Cetak",details:"Detail",security:"Batasan keamanan",edit:"Sunting",view:"Tampilan",insert:"Sisipkan",format:"Format",tools:"Alat",extensions:"Ekstensi",help:"Bantuan",backToDocuments:"Kembali ke Dokumen",clickToRename:"Klik untuk mengganti nama",starDocument:"Bintangi dokumen",unstarDocument:"Hapus bintang",sandbox:"Sandbox (alihkan kolaborator simulasi)",theme:"Tema",account:"Akun",markdown:"Markdown (.md)",html:"Halaman web (.html)",htmlZip:"Halaman web (.html, ter-zip)",text:"Teks biasa (.txt)",docx:"Microsoft Word (.docx)",pdf:"Dokumen PDF (.pdf)",odt:"OpenDocument Format (.odt)",rtf:"Rich Text Format (.rtf)",undo:"Urungkan",redo:"Ulangi",selectAll:"Pilih semua",cut:"Potong",copy:"Salin",paste:"Tempel",pasteWithoutFormatting:"Tempel tanpa pemformatan",delete:"Hapus",findAndReplace:"Temukan dan ganti",showSidebar:"Tampilkan kerangka",focusMode:"Mode Fokus Penuh",showRuler:"Tampilkan penggaris",meetingNotes:"Catatan Rapat",image:"Gambar",table:"Tabel",codeBlock:"Kode Blok",link:"Tautan",header:"Header",footer:"Footer",footnote:"Catatan Kaki",tableOfContents:"Daftar isi",bold:"Teks Tebal",italic:"Teks Miring",underline:"Garis Bawah",heading1:"Judul 1",heading2:"Judul 2",heading3:"Judul 3",alignIndent:"Perataan & indentasi",alignLeft:"Rata kiri",alignCenter:"Rata tengah",alignRight:"Rata kanan",alignJustify:"Rata kiri-kanan",bulletsNumbering:"Bullet & penomoran",bulletList:"Daftar ber-bullet",numberedList:"Daftar bernomor",taskList:"Daftar tugas",horizontalLine:"Garis horizontal",pageNumbers:"Nomor halaman",pageNumberInHeader:"Sisipkan di header",pageNumberInFooter:"Sisipkan di footer",pagelessFormat:"Format tanpa halaman",clearFormatting:"Hapus pemformatan",spellCheck:"Periksa ejaan",wordCount:"Hitungan kata",preferences:"Preferensi",manageExtensions:"Kelola ekstensi…",keyboardShortcuts:"Pintasan keyboard",reportIssue:"Laporkan masalah",about:"Tentang DocsEditor"},toolbar:{undo:"Urungkan",redo:"Ulangi",print:"Cetak",spelling:"Ejaan",zoom:"100%",paragraphStyle:"Gaya paragraf",normalText:"Teks normal",fontFamily:"Keluarga font",decreaseFontSize:"Kecilkan font",increaseFontSize:"Perbesar font",fontSize:"Ukuran font",lists:"Daftar",alignment:"Perataan",insert:"Sisipkan",comments:"Komentar",history:"Riwayat",ai:"AI",tableOfContents:"Daftar isi",references:"Referensi"},statusBar:{liveSyncActive:"Sinkron Langsung Aktif",connecting:"Menghubungkan…",saving:"Menyimpan perubahan…",offline:"Luring",lastSavedAt:"Terakhir disimpan",never:"Tidak pernah",pageSize:"Ukuran halaman",page:"Halaman",of:"dari",pageless:"Tanpa halaman",words:"kata",characters:"karakter"},editor:{share:{title:"Bagikan dokumen",close:"Tutup",shareableLink:"Tautan dapat dibagikan",copy:"Salin",copied:"Tautan disalin ke papan klip",couldNotCopy:"Tidak dapat menyalin tautan",collaborators:"Kolaborator",addCollaborator:"Tambahkan kolaborator lewat email",placeholder:"rekan@contoh.com",add:"Tambah",userNotFound:"Pengguna tidak ditemukan",failedToAdd:"Gagal menambahkan kolaborator",visibility:"Visibilitas",private:"Pribadi",privateDescription:"Hanya Anda dan orang yang Anda undang yang dapat mengakses dokumen ini.",restricted:"Terbatas",restrictedDescription:"Siapa pun dengan tautan dapat melihat dokumen ini."},print:"Cetak",logOut:"Keluar",rename:{title:"Ubah nama dokumen",label:"Judul dokumen",save:"Simpan",cancel:"Batal"},pageSetup:{title:"Penataan halaman",paperSize:"Ukuran kertas",orientation:"Orientasi",portrait:"Potret",landscape:"Lanskap",margins:"Margin",top:"Atas",bottom:"Bawah",left:"Kiri",right:"Kanan",apply:"Terapkan",cancel:"Batal"},details:{title:"Detail dokumen",titleLabel:"Judul",owner:"Pemilik",location:"Lokasi",noFolder:"(Tanpa folder)",created:"Dibuat",modified:"Terakhir diubah",statistics:"Statistik",words:"Kata",characters:"Karakter",pages:"Halaman",loading:"Memuat detail dokumen…"},email:{title:"Email file ini",to:"Kepada",toPlaceholder:"penerima@contoh.com",subject:"Subjek",body:"Isi",send:"Kirim",copyLink:"Salin tautan",shareableLink:"Tautan dapat dibagikan",defaultSubject:"Dokumen: {title}",defaultBody:"Anda dapat melihat dokumen ini di: {url}"},linkDialog:{insertTitle:"Sisipkan tautan",editTitle:"Edit tautan",text:"Teks yang ditampilkan",textPlaceholder:"Teks tautan",url:"URL",urlPlaceholder:"https://contoh.com",insert:"Sisipkan",update:"Perbarui",remove:"Hapus tautan",cancel:"Batal",urlRequired:"URL wajib diisi",urlInvalid:"Masukkan URL yang valid"},findReplace:{title:"Temukan dan ganti",findPlaceholder:"Temukan di dokumen",replacePlaceholder:"Ganti dengan",next:"Berikutnya",previous:"Sebelumnya",replace:"Ganti",replaceAll:"Ganti semua",noMatches:"Tidak ada hasil",matchCount:"{current} dari {total}",close:"Tutup"},headerFooter:{title:"Penyesuaian Header & Footer",header:"Header",footer:"Footer",left:"Kiri",right:"Kanan",clear:"Kosongkan",headerPlaceholder:"mis. Judul Dokumen",footerPlaceholder:"mis. Halaman {page} dari {total}",headerLeftPlaceholder:"mis. Judul Dokumen",headerRightPlaceholder:"mis. Halaman {page}",footerLeftPlaceholder:"mis. Rahasia",footerRightPlaceholder:"mis. Halaman {page} dari {total}",variableInfo:"Info Variabel: Anda dapat menggunakan {page} untuk nomor halaman aktif, dan {total} untuk jumlah halaman.",differentFirstPage:"Halaman pertama berbeda",differentOddEven:"Halaman ganjil & genap berbeda",options:"Opsi",formatHeader:"Format header",pageNumber:"Nomor halaman",removeHeader:"Hapus header",headerFooterFormatTitle:"Header & footer",marginSection:"Margin",headerTopMargin:"Header (sentimeter dari atas)",footerBottomMargin:"Footer (sentimeter dari bawah)",layoutSection:"Tata letak",pageNumberTitle:"Nomor halaman",positionSection:"Posisi",positionHeader:"Header",positionFooter:"Footer",showOnFirstPage:"Tampilkan di halaman pertama",numberingSection:"Penomoran",startAt:"Dimulai dari",continueFromPrevious:"Lanjutkan dari bagian sebelumnya",apply:"Terapkan",cancel:"Batal",save:"Simpan"},showOutline:"Tampilkan kerangka dokumen",loadingDocument:"Memuat dokumen"},slashMenu:{title:"Saran",basicBlocks:"Blok Dasar",noMatch:"Tidak ada perintah yang cocok"},documentTabs:{documentTabs:"Tab Dokumen",addTab:"Tambah tab",rename:"Ubah nama",delete:"Hapus",outline:"Kerangka",untitledHeading:"Judul Tanpa Nama {level}",placeholder:"Tajuk yang Anda tambahkan ke dokumen akan muncul di sini."},theme:{lightMode:"Beralih ke mode terang",darkMode:"Beralih ke mode gelap"},sidebars:{ai:{title:"AI Writing Helper",description:"Penulis AI sisi-server untuk menyusun, merangkum, atau menyunting tulisan Anda.",quickMacros:"Makro AI Cepat",summarize:"Rangkum",fixGrammar:"Perbaiki Tata Bahasa",continue:"Lanjutkan",toSpanish:"Ke Spanyol",generations:"Hasil AI",aiDrafting:"AI menyusun…",copy:"Salin",copied:"Tersalin",insert:"Sisipkan",inserted:"Tersisip",noDraft:"Tanya apa saja tentang dokumen Anda, atau jalankan makro cepat di atas.",promptPlaceholder:"Minta AI membuat kerangka, menulis konten, menulis ulang nada…",promptAI:"Perintah AI",close:"Tutup",you:"Anda",assistant:"Asisten",notConfigured:"AI belum dikonfigurasi pada deployment ini.",selectTextFirst:"Pilih teks di dokumen terlebih dahulu",improveSelection:"Perbaiki pilihan",draft:"Draf dengan sitasi",draftPlaceholder:"Minta AI menyusun teks berbasis pustaka referensi Anda…",promptDraft:"Susun",citations:"Sitasi",emptyResponse:"AI mengembalikan respons kosong.",aiError:"Permintaan AI gagal"},comments:{title:"Panel Diskusi",placeholder:"Pilih teks untuk menambahkan komentar…",addComment:"Tambah komentar",resolve:"Selesai",reply:"Balas…",replyInThread:"Balas di thread",active:"Aktif",resolved:"Selesai",creatingAnchored:"Membuat komentar terpaut:",quote:"Kutipan:",resolvedBy:"Diselesaikan oleh {user}",noComments:"Belum ada komentar {mode}.",commentOnSelection:"Komentari pilihan…",generalComment:"Tambahkan komentar umum ke dokumen…",anchoredComment:"Komentar terpaut",general:"Komentar umum",post:"Kirim",orphaned:"Teks dihapus",delete:"Hapus",confirmDelete:"Hapus thread komentar ini? Tindakan ini tidak dapat dibatalkan."},history:{title:"Riwayat",empty:"Belum ada riwayat.",version:"Versi",restore:"Pulihkan",closePreview:"Tutup Pratinjau",restoreThis:"Pulihkan Ini",viewingPreview:"Melihat Pratinjau Revisi",readOnlyPreview:"Anda sedang melihat pratinjau versi #{index}. Editor Anda untuk sementara hanya-baca.",modifiedBy:"Diubah oleh:",saveNamedSnapshot:"Simpan Snapshot Bernama",snapshotPlaceholder:"mis. Final Draft Disetujui…",noSnapshots:"Belum ada snapshot yang disimpan.",save:"Simpan",cancel:"Batal",preview:"Pratinjau"},toc:{title:"Daftar Isi",empty:"Belum ada judul.",untitledHeading:"Judul Tanpa Nama {level}",newSection:"Bagian {tag} Baru",startWriting:"Mulai menulis di sini…",closeOutline:"Tutup kerangka",searchHeadings:"Cari judul…",noHeadings:"Belum Ada Judul",noHeadingsDescription:"Gunakan header (H1, H2, atau H3) untuk menyusun dokumen. Kerangka interaktif akan dibuat otomatis di sini.",quickInsert:"Sisipkan Cepat",headingLevel:"Judul {level}",noMatchingHeaders:"Tidak ada header yang cocok",tryDifferentTerm:"Coba cari dengan istilah lain.",outlineLayout:"Tata Letak Kerangka",outlineSync:"Kerangka tersinkronisasi otomatis. Klik header apa pun untuk langsung melompat, fokus, dan menggulir editor ke bagian tersebut."},references:{title:"Referensi",subtitle:"Kelola sumber dan sisipkan sitasi.",close:"Tutup referensi",citationStyle:"Gaya sitasi",searchSources:"Cari sumber…",addSource:"Tambah sumber",editSource:"Ubah sumber",noSources:"Belum ada sumber",noSourcesDescription:"Tambahkan referensi pertama Anda untuk mulai menyitasi. Sitasi dan daftar pustaka mengikuti gaya aktif secara otomatis.",noMatchingSources:"Tidak ada sumber yang cocok",cite:"Sitasi",edit:"Ubah",delete:"Hapus",back:"Kembali ke daftar",anonymous:"Anonim",etAl:"dkk.",confirmDelete:'Hapus sumber "{title}"? Sitasi yang merujuknya akan berhenti ditampilkan.',import:{title:"Impor",fromDoi:"Dari DOI (CrossRef)",doiPlaceholder:"Tempel DOI atau tautan DOI…",importDoi:"Impor DOI",doiSuccess:"Sumber berhasil diimpor dari CrossRef.",doiFailed:"DOI tidak dapat ditemukan.",fromFile:"Dari berkas BibTeX / RIS",pickFile:"Pilih berkas .bib atau .ris",importing:"Mengimpor…",batchSuccess:"{count} sumber berhasil diimpor.",partial:"{ok} berhasil, {failed} gagal.",failed:"Impor gagal."},types:{book:"Buku","article-journal":"Artikel jurnal",chapter:"Bab buku",webpage:"Halaman web",report:"Laporan",thesis:"Tesis",document:"Dokumen"},form:{type:"Jenis sumber",title:"Judul",authors:"Penulis",familyName:"Nama keluarga",givenName:"Nama depan",addAuthor:"Tambah penulis",year:"Tahun",journal:"Jurnal",bookTitle:"Judul buku",publisher:"Penerbit",publisherPlace:"Kota terbit",volume:"Volume",issue:"Edisi",pages:"Halaman",save:"Simpan perubahan",create:"Tambah sumber",cancel:"Batal"}}},dashboard:{allDocuments:"Semua Dokumen",starred:"Berbintang",folders:"Folder",createFolder:"Buat Folder Baru",folderNamePlaceholder:"Nama folder…",noFolders:"Belum ada folder.",startNewDocument:"Mulai Dokumen Baru",blankDocument:"Dokumen Kosong",blankDescription:"Kertas kosong",meetingNotes:"Catatan Rapat",meetingNotesDescription:"Peserta & Tindak Lanjut",projectProposal:"Proposal Proyek",projectProposalDescription:"Tujuan & Hasil",officialLetter:"Surat Resmi",officialLetterDescription:"Header yang sudah diformat",searchPlaceholder:"Cari judul atau isi dokumen…",modified:"Diubah",alphabetical:"Abjad",created:"Dibuat",gridView:"Tampilan Grid",listView:"Tampilan Daftar",activeFilters:"Filter Aktif:",folder:"Folder",starredOnly:"Hanya Berbintang",search:"Cari",noDocuments:"Tidak ada dokumen",noDocumentsDescription:"Tidak ada file yang cocok dengan filter. Pilih template atau buat dokumen kosong untuk mulai menulis!",createBlankDocument:"Buat Dokumen Kosong",loadingDocuments:"Memuat dokumen...",folderCreated:"Folder berhasil dibuat.",folderAlreadyExists:"Folder dengan nama tersebut sudah ada.",folderLoadError:"Folder tidak dapat dimuat. Silakan coba lagi.",folderCreateError:"Folder tidak dapat dibuat. Silakan coba lagi.",documentTitle:"Judul Dokumen",lastModified:"Terakhir Diubah",actions:"Aksi",trash:"Sampah",trashEmpty:"Sampah kosong",trashEmptyDescription:"Dokumen yang dihapus akan muncul di sini.",trashedAt:"Dihapus",movedToTrash:"Dipindahkan ke sampah:"},auth:{signInTitle:"Masuk untuk membuat dan menyunting dokumen",signInWithGoogle:"Masuk dengan Google",signInWithEmail:"Masuk dengan Email",signInWithGitHub:"Masuk dengan GitHub",signInWith:"Masuk dengan {provider}",or:"atau",email:"Email",password:"Kata sandi",name:"Nama",signIn:"Masuk",signUp:"Daftar",signOut:"Keluar",noAccount:"Belum punya akun? Daftar",hasAccount:"Sudah punya akun? Masuk",invalidCredentials:"Email atau kata sandi salah",accountCreated:"Akun dibuat! Anda sekarang masuk.",loadDocumentsError:"Gagal memuat dokumen. Apakah server berjalan?",retry:"Coba lagi",rateLimited:"Server sedang membatasi permintaan.",retryIn:"Mencoba ulang dalam {seconds} detik…",networkError:"Tidak bisa menghubungi server. Periksa koneksi Anda.",noProviders:"Tidak ada penyedia autentikasi yang dikonfigurasi. Periksa variabel lingkungan server."},language:{label:"Bahasa",en:"English",id:"Indonesia"}},qr={en:Dc,id:Rc},ls="en",Mp={en:Dc.language.en,id:Rc.language.id};function Lc(e){return qr[e]??qr[ls]}function $r(e){return typeof e=="string"&&e in qr}const Bc=Symbol("docflow-locale"),Pc="docflow-locale";function zp(e){if(e&&$r(e))return e;try{const t=localStorage.getItem(Pc);if(t&&$r(t))return t}catch{}return ls}function Ip(e,t){const i=t.split(".");let n=e;for(const r of i){if(n===null||typeof n!="object")return;n=n[r]}return n}function Vc(e){const t=s.ref(zp(e));return{locale:t,setLocale:r=>{if($r(r)){t.value=r;try{localStorage.setItem(Pc,r)}catch{}}},t:(r,a)=>{const o=Lc(t.value),l=Ip(o,r);if(typeof l!="string")return r;let c=l;if(a)for(const[f,p]of Object.entries(a))c=c.replace(new RegExp(`\\{${f}\\}`,"g"),String(p));return c}}}function rt(){const e=s.inject(Bc,null);return e||Vc()}function Fc(e){const t=Vc(e);return s.provide(Bc,t),t}function Uc(e){return Mp[e]??e}function Hc(){return["en","id"]}function Dp(e){const t=s.ref({totalPages:1,visiblePages:[],config:{pageSize:{id:"a4",name:"A4",pageWidth:794,pageHeight:1123},margins:{top:20,bottom:20,left:50,right:50},pageGap:50,headerLeft:"",headerRight:"",footerLeft:"",footerRight:""}}),i=s.computed(()=>t.value.totalPages),n=s.computed(()=>t.value.visiblePages),r=s.ref(!1);let a=null,o=null;const l=async()=>{var h;const m=e.editorRef.value,d=e.scrollRef.value;!((h=m==null?void 0:m.view)!=null&&h.dom)||!d||(a=new Cn.VirtualPageOverlay(m.view.dom,e.config,d,e.bufferPages??2),a.observe(),t.value=await a.layout(),r.value=!0,o=new ResizeObserver(async()=>{a&&(t.value=await a.layout())}),o.observe(m.view.dom))},c=async m=>{a&&(t.value=await a.updateConfig(m))},f=()=>{a&&(t.value=a.getData())};let p=null;return s.onMounted(()=>{p=setInterval(f,250)}),s.onUnmounted(()=>{p&&clearInterval(p),a==null||a.disconnect(),o==null||o.disconnect()}),s.watch([()=>{var m,d;return(d=(m=e.editorRef.value)==null?void 0:m.view)==null?void 0:d.dom},e.scrollRef],()=>{r.value||l()},{immediate:!0}),s.watch(()=>e.config,m=>{r.value&&c(m)},{deep:!0}),{data:t,totalPages:i,visiblePages:n,isReady:r,refreshData:f,updateConfig:c}}const Rp={key:0,class:"virtual-page-overlay","aria-hidden":"true"},Lp=["innerHTML"],Bp=["innerHTML"],Pp=["innerHTML"],Vp=["innerHTML"],Fp=s.defineComponent({__name:"VirtualPageOverlay",props:{data:{},isReady:{type:Boolean}},setup(e){const t=e,i=s.computed(()=>t.data.visiblePages),n=s.computed(()=>t.data.config),r=s.computed(()=>n.value.pageSize),a=s.computed(()=>({height:`${n.value.pageGap}px`})),o=s.computed(()=>({paddingTop:`${n.value.margins.top}px`,paddingLeft:`${n.value.margins.left}px`,paddingRight:`${n.value.margins.right}px`,height:`${n.value.margins.top}px`})),l=s.computed(()=>({paddingBottom:`${n.value.margins.bottom}px`,paddingLeft:`${n.value.margins.left}px`,paddingRight:`${n.value.margins.right}px`}));function c(p){return{top:`${p.top}px`,height:`${r.value.pageHeight+n.value.pageGap}px`,width:`${r.value.pageWidth}px`}}function f(p,m){return p.replace(/\{page\}/g,String(m+1)).replace(/\{total\}/g,String(t.data.totalPages))}return(p,m)=>e.isReady?(s.openBlock(),s.createElementBlock("div",Rp,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(i.value,d=>(s.openBlock(),s.createElementBlock("div",{key:d.index,class:"vp-page",style:s.normalizeStyle(c(d))},[s.createElementVNode("div",{class:"vp-gap",style:s.normalizeStyle(a.value)},null,4),s.createElementVNode("div",{class:"vp-header",style:s.normalizeStyle(o.value)},[s.createElementVNode("span",{class:"vp-header-left",innerHTML:n.value.headerLeft},null,8,Lp),s.createElementVNode("span",{class:"vp-header-right",innerHTML:n.value.headerRight},null,8,Bp)],4),s.createElementVNode("div",{class:"vp-footer",style:s.normalizeStyle(l.value)},[s.createElementVNode("span",{class:"vp-footer-left",innerHTML:f(n.value.footerLeft,d.index)},null,8,Pp),s.createElementVNode("span",{class:"vp-footer-right",innerHTML:f(n.value.footerRight,d.index)},null,8,Vp)],4)],4))),128))])):s.createCommentVNode("",!0)}}),cs=(e,t)=>{const i=e.__vccOpts||e;for(const[n,r]of t)i[n]=r;return i},Up=cs(Fp,[["__scopeId","data-v-a48fe1b6"]]),Hp={class:"px-2 py-1.5 text-[10px] font-semibold uppercase text-slate-400"},jp=["onClick","onMouseenter"],qp={class:"text-slate-500 dark:text-slate-400"},jc=s.defineComponent({__name:"SlashMenu",props:{editor:{},commands:{}},setup(e){const{t}=rt(),i=e,n=s.ref(!1),r=s.ref(""),a=s.ref(0),o=s.ref({top:0,left:0}),l=s.ref([]);function c(){if(!i.editor)return;const{view:h}=i.editor,{selection:v}=h.state,b=h.coordsAtPos(v.head);o.value={top:b.bottom+4,left:b.left}}function f(h){var E,B,_,S;if(!i.editor)return;const{view:v}=i.editor,{selection:b}=v.state,y=b.head,g=v.state.doc.resolve(y),x=g.start(),w=g.parent.textContent.slice(0,g.parentOffset).lastIndexOf("/");if(w>=0){const T=x+w,D=v.state.tr.delete(T,y);v.dispatch(D)}const C=i.editor;if(typeof((E=C.commands)==null?void 0:E[h.command])=="function")C.commands[h.command]();else if(C.chain)try{(S=(_=(B=C.chain().focus())[h.command])==null?void 0:_.call(B))==null||S.run()}catch{}n.value=!1,r.value=""}function p(){n.value=!1,r.value=""}function m(){if(!i.editor)return;const{view:h}=i.editor,{selection:v}=h.state,b=v.head,y=h.state.doc.resolve(b),g=y.parent.textContent.slice(0,y.parentOffset),x=g.lastIndexOf("/");if(x>=0){const k=g.slice(0,x),w=g.slice(x+1);if((k===""||k.endsWith(" ")||k===`
1
+ "use strict";var Ap=Object.defineProperty;var Op=(e,t,i)=>t in e?Ap(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var Xt=(e,t,i)=>Op(e,typeof t!="symbol"?t+"":t,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _e=require("@kedataindo/docflow-core"),s=require("vue"),Cn=require("@kedataindo/docflow-layout-engine");function Ic(e){const t=s.ref(null),i=s.shallowRef(null),n=s.ref(!1),r=s.computed(()=>{var c;return((c=i.value)==null?void 0:c.editor)??null}),a=s.computed(()=>{var c;return((c=i.value)==null?void 0:c.pluginActions)??{}}),o=()=>{if(!t.value||i.value)return;const c=s.unref(e.collaboration),f=s.unref(e.content),p=_e.createEditor({target:t.value,content:f,plugins:e.plugins,editable:e.editable??!0,collaboration:c,onUpdate:e.onUpdate,getPageMap:e.getPageMap,paginationOptions:e.paginationOptions,onImageUpload:e.onImageUpload,citation:e.citation,aiStream:e.aiStream,aiDraft:e.aiDraft,debug:e.debug});i.value=p,s.nextTick(()=>{n.value=!0})},l=()=>{var c;(c=i.value)==null||c.destroy(),i.value=null,n.value=!1};return s.onMounted(()=>{o()}),s.onUnmounted(()=>{l()}),s.watch(()=>e.editable,c=>{r.value&&r.value.setEditable(c??!0)}),s.watch(()=>{const c=s.unref(e.collaboration);return c?{room:c.room,provider:c.provider}:null},async(c,f)=>{JSON.stringify(c)!==JSON.stringify(f)&&(l(),await s.nextTick(),o())},{deep:!0}),{editorRef:t,docsEditor:i,editor:r,pluginActions:a,isReady:n}}function Tp(e){const t=s.computed(()=>{var r,a,o;return(o=(a=(r=e.value)==null?void 0:r.storage)==null?void 0:a.editorContext)==null?void 0:o.aiStream}),i=s.computed(()=>{var r,a,o;return(o=(a=(r=e.value)==null?void 0:r.storage)==null?void 0:a.editorContext)==null?void 0:o.aiDraft}),n=s.computed(()=>!!t.value);return{aiStream:t,aiDraft:i,isAIAvailable:n}}const sl="docs-editor-theme",eo=s.ref(!1);function Ba(){const e=i=>{if(eo.value=i,typeof document<"u"){const n=document.documentElement;i?n.classList.add("dark"):n.classList.remove("dark")}typeof localStorage<"u"&&localStorage.setItem(sl,i?"dark":"light")},t=()=>e(!eo.value);return s.onMounted(()=>{let i=!1;if(typeof localStorage<"u"){const n=localStorage.getItem(sl);n?i=n==="dark":typeof window<"u"&&(i=window.matchMedia("(prefers-color-scheme: dark)").matches)}e(i)}),{isDark:eo,toggle:t}}const Dc={common:{save:"Save",cancel:"Cancel",create:"Create",delete:"Delete",rename:"Rename",duplicate:"Duplicate",move:"Move",moveToFolder:"Move to folder",moveDocument:"Move Document",noFolder:"(No Folder)",search:"Search",loading:"Loading...",error:"Error",dismiss:"Dismiss",emptyDocument:"(Empty Document)",confirmDelete:"Are you sure you want to delete this document?",undo:"Undo",restore:"Restore",deleteForever:"Delete forever",back:"Back",confirmPermanentDelete:"Permanently delete this document? This cannot be undone."},header:{file:"File",new:"New",newDocument:"New document",open:"Open",makeACopy:"Make a copy",share:"Share",email:"Email",emailDraft:"Email draft",download:"Download",rename:"Rename",move:"Move",moveToFolder:"Move to folder",moveToTrash:"Move to trash",addToStarred:"Add to Starred",versionHistory:"Version history",language:"Language",pageSetup:"Page setup",print:"Print",details:"Details",security:"Security limitations",edit:"Edit",view:"View",insert:"Insert",format:"Format",tools:"Tools",extensions:"Extensions",help:"Help",backToDocuments:"Back to Documents",clickToRename:"Click to rename",starDocument:"Star document",unstarDocument:"Unstar document",sandbox:"Sandbox (toggle simulated collaborators)",theme:"Theme",account:"Account",markdown:"Markdown (.md)",html:"Web page (.html)",htmlZip:"Web page (.html, zipped)",text:"Plain text (.txt)",docx:"Microsoft Word (.docx)",pdf:"PDF Document (.pdf)",odt:"OpenDocument Format (.odt)",rtf:"Rich Text Format (.rtf)",undo:"Undo",redo:"Redo",selectAll:"Select all",cut:"Cut",copy:"Copy",paste:"Paste",pasteWithoutFormatting:"Paste without formatting",delete:"Delete",findAndReplace:"Find and replace",showSidebar:"Show outline",focusMode:"Full focus mode",showRuler:"Show ruler",meetingNotes:"Meeting notes",image:"Image",table:"Table",codeBlock:"Code block",link:"Link",header:"Header",footer:"Footer",footnote:"Footnote",tableOfContents:"Table of contents",bold:"Bold text",italic:"Italic text",underline:"Underline",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",alignIndent:"Align & indent",alignLeft:"Align left",alignCenter:"Align center",alignRight:"Align right",alignJustify:"Justify",bulletsNumbering:"Bullets & numbering",bulletList:"Bulleted list",numberedList:"Numbered list",taskList:"Task list",horizontalLine:"Horizontal line",pageNumbers:"Page numbers",pageNumberInHeader:"Insert in header",pageNumberInFooter:"Insert in footer",break:"Break",pageBreak:"Page break",pageBreakShortcut:"Ctrl+Enter",pagelessFormat:"Pageless format",clearFormatting:"Clear formatting",spellCheck:"Spell check",wordCount:"Word count",preferences:"Preferences",manageExtensions:"Manage extensions…",keyboardShortcuts:"Keyboard shortcuts",reportIssue:"Report issue",about:"About DocsEditor"},toolbar:{undo:"Undo",redo:"Redo",print:"Print",spelling:"Spelling",zoom:"100%",paragraphStyle:"Paragraph style",normalText:"Normal text",fontFamily:"Font family",decreaseFontSize:"Decrease font size",increaseFontSize:"Increase font size",fontSize:"Font size",lists:"Lists",alignment:"Alignment",insert:"Insert",comments:"Comments",history:"History",ai:"AI",tableOfContents:"Table of contents",references:"References"},statusBar:{liveSyncActive:"Live Sync Active",connecting:"Connecting…",saving:"Saving changes…",offline:"Offline",lastSavedAt:"Last saved at",never:"Never",pageSize:"Page size",page:"Page",of:"of",pageless:"Pageless",words:"words",characters:"characters"},editor:{share:{title:"Share document",close:"Close",shareableLink:"Shareable link",copy:"Copy",copied:"Link copied to clipboard",couldNotCopy:"Could not copy link",collaborators:"Collaborators",addCollaborator:"Add collaborator by email",placeholder:"colleague@example.com",add:"Add",userNotFound:"User not found",failedToAdd:"Failed to add collaborator",visibility:"Visibility",private:"Private",privateDescription:"Only you and people you invite can access this document.",restricted:"Restricted",restrictedDescription:"Anyone with the link can view this document."},print:"Print",logOut:"Log out",rename:{title:"Rename document",label:"Document title",save:"Save",cancel:"Cancel"},pageSetup:{title:"Page setup",paperSize:"Paper size",orientation:"Orientation",portrait:"Portrait",landscape:"Landscape",margins:"Margins",top:"Top",bottom:"Bottom",left:"Left",right:"Right",apply:"Apply",cancel:"Cancel"},details:{title:"Document details",titleLabel:"Title",owner:"Owner",location:"Location",noFolder:"(No folder)",created:"Created",modified:"Last modified",statistics:"Statistics",words:"Words",characters:"Characters",pages:"Pages",loading:"Loading document details…"},email:{title:"Email this file",to:"To",toPlaceholder:"recipient@example.com",subject:"Subject",body:"Body",send:"Send",copyLink:"Copy link",shareableLink:"Shareable link",defaultSubject:"Document: {title}",defaultBody:"You can view this document at: {url}"},linkDialog:{insertTitle:"Insert link",editTitle:"Edit link",text:"Text to display",textPlaceholder:"Link text",url:"URL",urlPlaceholder:"https://example.com",insert:"Insert",update:"Update",remove:"Remove link",cancel:"Cancel",urlRequired:"URL is required",urlInvalid:"Please enter a valid URL"},findReplace:{title:"Find and replace",findPlaceholder:"Find in document",replacePlaceholder:"Replace with",next:"Next",previous:"Previous",replace:"Replace",replaceAll:"Replace all",noMatches:"No matches",matchCount:"{current} of {total}",close:"Close"},headerFooter:{title:"Header & Footer Customization",header:"Header",footer:"Footer",left:"Left",right:"Right",clear:"Clear",headerPlaceholder:"e.g. Document Title",footerPlaceholder:"e.g. Page {page} of {total}",headerLeftPlaceholder:"e.g. Document Title",headerRightPlaceholder:"e.g. Page {page}",footerLeftPlaceholder:"e.g. Confidential",footerRightPlaceholder:"e.g. Page {page} of {total}",variableInfo:"Variable Info: You can use {page} for the current page number, and {total} for the total page count.",differentFirstPage:"Different first page",differentOddEven:"Different odd & even pages",options:"Options",formatHeader:"Header format",pageNumber:"Page numbers",removeHeader:"Remove header",headerFooterFormatTitle:"Header & footer",marginSection:"Margin",headerTopMargin:"Header (centimeters from top)",footerBottomMargin:"Footer (centimeters from bottom)",layoutSection:"Layout",pageNumberTitle:"Page numbers",positionSection:"Position",positionHeader:"Header",positionFooter:"Footer",showOnFirstPage:"Show on first page",numberingSection:"Numbering",startAt:"Start at",continueFromPrevious:"Continue from previous section",apply:"Apply",cancel:"Cancel",save:"Save"},showOutline:"Show document outline",loadingDocument:"Loading document"},slashMenu:{title:"Suggested",basicBlocks:"Basic Blocks",noMatch:"No matching commands"},documentTabs:{documentTabs:"Document Tabs",addTab:"Add tab",rename:"Rename",delete:"Delete",outline:"Outline",untitledHeading:"Untitled Heading {level}",placeholder:"Headings you add to the document will appear here."},theme:{lightMode:"Switch to light mode",darkMode:"Switch to dark mode"},sidebars:{ai:{title:"AI Writing Helper",description:"A server-side AI co-writer to draft, summarize, or edit your copy.",quickMacros:"Quick AI Macros",summarize:"Summarize",fixGrammar:"Fix Grammar",continue:"Continue",toSpanish:"To Spanish",generations:"AI Generations",aiDrafting:"AI drafting…",copy:"Copy",copied:"Copied",insert:"Insert",inserted:"Inserted",noDraft:"Ask anything about your document, or run a quick macro above.",promptPlaceholder:"Ask AI to draft outline, write content, rewrite tone…",promptAI:"Prompt AI",close:"Close",you:"You",assistant:"Assistant",notConfigured:"AI is not configured on this deployment.",selectTextFirst:"Select text in the document first",improveSelection:"Improve selection",draft:"Draft with citations",draftPlaceholder:"Ask the AI to draft text grounded on your reference library…",promptDraft:"Draft",citations:"Citations",emptyResponse:"The AI returned an empty response.",aiError:"AI request failed"},comments:{title:"Discussion Panel",placeholder:"Select text to add a comment…",addComment:"Add comment",resolve:"Resolve",reply:"Reply…",replyInThread:"Reply in thread",active:"Active",resolved:"Resolved",creatingAnchored:"Creating anchored comment:",quote:"Quote:",resolvedBy:"Resolved by {user}",noComments:"No {mode} comments yet.",commentOnSelection:"Comment on selection…",generalComment:"Add general comment to document…",anchoredComment:"Anchored comment",general:"General comment",post:"Post",orphaned:"Text deleted",delete:"Delete",confirmDelete:"Delete this comment thread? This cannot be undone."},history:{title:"History",empty:"No history yet.",version:"Version",restore:"Restore",closePreview:"Close Preview",restoreThis:"Restore This",viewingPreview:"Viewing Revision Preview",readOnlyPreview:"You are previewing version #{index}. Your editor is temporarily read-only.",modifiedBy:"Modified by:",saveNamedSnapshot:"Save Named Snapshot",snapshotPlaceholder:"e.g. Approved Final Draft…",noSnapshots:"No snapshots saved yet.",save:"Save",cancel:"Cancel",preview:"Preview"},toc:{title:"Contents",empty:"No headings yet.",untitledHeading:"Untitled Heading {level}",newSection:"New {tag} Section",startWriting:"Start writing here…",closeOutline:"Close outline",searchHeadings:"Search headings…",noHeadings:"No Headings Yet",noHeadingsDescription:"Use headers (H1, H2, or H3) to structure your document. An interactive outline will generate here automatically.",quickInsert:"Quick Insert",headingLevel:"Heading {level}",noMatchingHeaders:"No matching headers found",tryDifferentTerm:"Try searching with a different term.",outlineLayout:"Outline Layout",outlineSync:"Outline syncs automatically. Click any header to instantly jump, focus, and scroll the editor to that section."},references:{title:"References",subtitle:"Manage sources and insert citations.",close:"Close references",citationStyle:"Citation style",searchSources:"Search sources…",addSource:"Add source",editSource:"Edit source",noSources:"No sources yet",noSourcesDescription:"Add your first reference to start citing. Citations and the bibliography follow the active style automatically.",noMatchingSources:"No matching sources found",cite:"Cite",edit:"Edit",delete:"Delete",back:"Back to list",anonymous:"Anonymous",etAl:"et al.",confirmDelete:'Delete source "{title}"? Citations referencing it will stop rendering.',import:{title:"Import",fromDoi:"From DOI (CrossRef)",doiPlaceholder:"Paste a DOI or DOI link…",importDoi:"Import DOI",doiSuccess:"Source imported from CrossRef.",doiFailed:"DOI could not be resolved.",fromFile:"From BibTeX / RIS file",pickFile:"Choose .bib or .ris file",importing:"Importing…",batchSuccess:"{count} source(s) imported.",partial:"{ok} imported, {failed} failed.",failed:"Import failed."},types:{book:"Book","article-journal":"Journal article",chapter:"Book chapter",webpage:"Web page",report:"Report",thesis:"Thesis",document:"Document"},form:{type:"Source type",title:"Title",authors:"Authors",familyName:"Family name",givenName:"Given name",addAuthor:"Add author",year:"Year",journal:"Journal",bookTitle:"Book title",publisher:"Publisher",publisherPlace:"Place",volume:"Volume",issue:"Issue",pages:"Pages",save:"Save changes",create:"Add source",cancel:"Cancel"}}},dashboard:{allDocuments:"All Documents",starred:"Starred",folders:"Folders",createFolder:"Create New Folder",folderNamePlaceholder:"Folder name…",noFolders:"No folders created yet.",startNewDocument:"Start a New Document",blankDocument:"Blank Document",blankDescription:"Fresh slate",meetingNotes:"Meeting Notes",meetingNotesDescription:"Attendees & Action Items",projectProposal:"Project Proposal",projectProposalDescription:"Objectives & Deliverables",officialLetter:"Official Letter",officialLetterDescription:"Pre-formatted header",searchPlaceholder:"Search titles or full-text contents…",modified:"Modified",alphabetical:"Alphabetical",created:"Created",gridView:"Grid View",listView:"List View",activeFilters:"Active Filters:",folder:"Folder",starredOnly:"Starred Only",search:"Search",noDocuments:"No documents found",noDocumentsDescription:"No files match your current filters. Select a template or create a blank file to start drafting!",createBlankDocument:"Create Blank Document",loadingDocuments:"Loading documents...",folderCreated:"Folder created.",folderAlreadyExists:"A folder with that name already exists.",folderLoadError:"Could not load folders. Please try again.",folderCreateError:"Could not create the folder. Please try again.",documentTitle:"Document Title",lastModified:"Last Modified",actions:"Actions",trash:"Trash",trashEmpty:"Trash is empty",trashEmptyDescription:"Deleted documents will appear here.",trashedAt:"Trashed",movedToTrash:"Moved to trash:"},auth:{signInTitle:"Sign in to create and edit documents",signInWithGoogle:"Sign in with Google",signInWithEmail:"Sign in with Email",signInWithGitHub:"Sign in with GitHub",signInWith:"Sign in with {provider}",or:"or",email:"Email",password:"Password",name:"Name",signIn:"Sign In",signUp:"Sign Up",signOut:"Sign out",noAccount:"Don't have an account? Sign up",hasAccount:"Already have an account? Sign in",invalidCredentials:"Invalid email or password",accountCreated:"Account created! You are now signed in.",loadDocumentsError:"Failed to load documents. Is the server running?",retry:"Try again",rateLimited:"Server is rate limiting requests.",retryIn:"Retrying in {seconds}s…",networkError:"Could not reach the server. Check your connection.",noProviders:"No authentication providers configured. Check your server environment variables."},language:{label:"Language",en:"English",id:"Indonesian"}},Rc={common:{save:"Simpan",cancel:"Batal",create:"Buat",delete:"Hapus",rename:"Ubah nama",duplicate:"Duplikat",move:"Pindah",moveToFolder:"Pindah ke folder",moveDocument:"Pindahkan Dokumen",noFolder:"(Tanpa Folder)",search:"Cari",loading:"Memuat…",error:"Kesalahan",dismiss:"Tutup",emptyDocument:"(Dokumen Kosong)",confirmDelete:"Apakah Anda yakin ingin menghapus dokumen ini?",undo:"Batalkan",restore:"Pulihkan",deleteForever:"Hapus permanen",back:"Kembali",confirmPermanentDelete:"Hapus dokumen ini secara permanen? Tindakan ini tidak dapat dibatalkan."},header:{file:"Berkas",new:"Baru",newDocument:"Dokumen baru",open:"Buka",makeACopy:"Buat salinan",share:"Bagikan",email:"Email",emailDraft:"Draf Email",download:"Unduh",rename:"Ubah nama",move:"Pindah",moveToFolder:"Pindah ke folder",moveToTrash:"Pindah ke sampah",addToStarred:"Tambahkan ke Bintang",versionHistory:"Riwayat versi",language:"Bahasa",pageSetup:"Penataan halaman",print:"Cetak",details:"Detail",security:"Batasan keamanan",edit:"Sunting",view:"Tampilan",insert:"Sisipkan",format:"Format",tools:"Alat",extensions:"Ekstensi",help:"Bantuan",backToDocuments:"Kembali ke Dokumen",clickToRename:"Klik untuk mengganti nama",starDocument:"Bintangi dokumen",unstarDocument:"Hapus bintang",sandbox:"Sandbox (alihkan kolaborator simulasi)",theme:"Tema",account:"Akun",markdown:"Markdown (.md)",html:"Halaman web (.html)",htmlZip:"Halaman web (.html, ter-zip)",text:"Teks biasa (.txt)",docx:"Microsoft Word (.docx)",pdf:"Dokumen PDF (.pdf)",odt:"OpenDocument Format (.odt)",rtf:"Rich Text Format (.rtf)",undo:"Urungkan",redo:"Ulangi",selectAll:"Pilih semua",cut:"Potong",copy:"Salin",paste:"Tempel",pasteWithoutFormatting:"Tempel tanpa pemformatan",delete:"Hapus",findAndReplace:"Temukan dan ganti",showSidebar:"Tampilkan kerangka",focusMode:"Mode Fokus Penuh",showRuler:"Tampilkan penggaris",meetingNotes:"Catatan Rapat",image:"Gambar",table:"Tabel",codeBlock:"Kode Blok",link:"Tautan",header:"Header",footer:"Footer",footnote:"Catatan Kaki",tableOfContents:"Daftar isi",bold:"Teks Tebal",italic:"Teks Miring",underline:"Garis Bawah",heading1:"Judul 1",heading2:"Judul 2",heading3:"Judul 3",alignIndent:"Perataan & indentasi",alignLeft:"Rata kiri",alignCenter:"Rata tengah",alignRight:"Rata kanan",alignJustify:"Rata kiri-kanan",bulletsNumbering:"Bullet & penomoran",bulletList:"Daftar ber-bullet",numberedList:"Daftar bernomor",taskList:"Daftar tugas",horizontalLine:"Garis horizontal",pageNumbers:"Nomor halaman",pageNumberInHeader:"Sisipkan di header",pageNumberInFooter:"Sisipkan di footer",break:"Pemisah",pageBreak:"Pemisah halaman",pageBreakShortcut:"Ctrl+Enter",pagelessFormat:"Format tanpa halaman",clearFormatting:"Hapus pemformatan",spellCheck:"Periksa ejaan",wordCount:"Hitungan kata",preferences:"Preferensi",manageExtensions:"Kelola ekstensi…",keyboardShortcuts:"Pintasan keyboard",reportIssue:"Laporkan masalah",about:"Tentang DocsEditor"},toolbar:{undo:"Urungkan",redo:"Ulangi",print:"Cetak",spelling:"Ejaan",zoom:"100%",paragraphStyle:"Gaya paragraf",normalText:"Teks normal",fontFamily:"Keluarga font",decreaseFontSize:"Kecilkan font",increaseFontSize:"Perbesar font",fontSize:"Ukuran font",lists:"Daftar",alignment:"Perataan",insert:"Sisipkan",comments:"Komentar",history:"Riwayat",ai:"AI",tableOfContents:"Daftar isi",references:"Referensi"},statusBar:{liveSyncActive:"Sinkron Langsung Aktif",connecting:"Menghubungkan…",saving:"Menyimpan perubahan…",offline:"Luring",lastSavedAt:"Terakhir disimpan",never:"Tidak pernah",pageSize:"Ukuran halaman",page:"Halaman",of:"dari",pageless:"Tanpa halaman",words:"kata",characters:"karakter"},editor:{share:{title:"Bagikan dokumen",close:"Tutup",shareableLink:"Tautan dapat dibagikan",copy:"Salin",copied:"Tautan disalin ke papan klip",couldNotCopy:"Tidak dapat menyalin tautan",collaborators:"Kolaborator",addCollaborator:"Tambahkan kolaborator lewat email",placeholder:"rekan@contoh.com",add:"Tambah",userNotFound:"Pengguna tidak ditemukan",failedToAdd:"Gagal menambahkan kolaborator",visibility:"Visibilitas",private:"Pribadi",privateDescription:"Hanya Anda dan orang yang Anda undang yang dapat mengakses dokumen ini.",restricted:"Terbatas",restrictedDescription:"Siapa pun dengan tautan dapat melihat dokumen ini."},print:"Cetak",logOut:"Keluar",rename:{title:"Ubah nama dokumen",label:"Judul dokumen",save:"Simpan",cancel:"Batal"},pageSetup:{title:"Penataan halaman",paperSize:"Ukuran kertas",orientation:"Orientasi",portrait:"Potret",landscape:"Lanskap",margins:"Margin",top:"Atas",bottom:"Bawah",left:"Kiri",right:"Kanan",apply:"Terapkan",cancel:"Batal"},details:{title:"Detail dokumen",titleLabel:"Judul",owner:"Pemilik",location:"Lokasi",noFolder:"(Tanpa folder)",created:"Dibuat",modified:"Terakhir diubah",statistics:"Statistik",words:"Kata",characters:"Karakter",pages:"Halaman",loading:"Memuat detail dokumen…"},email:{title:"Email file ini",to:"Kepada",toPlaceholder:"penerima@contoh.com",subject:"Subjek",body:"Isi",send:"Kirim",copyLink:"Salin tautan",shareableLink:"Tautan dapat dibagikan",defaultSubject:"Dokumen: {title}",defaultBody:"Anda dapat melihat dokumen ini di: {url}"},linkDialog:{insertTitle:"Sisipkan tautan",editTitle:"Edit tautan",text:"Teks yang ditampilkan",textPlaceholder:"Teks tautan",url:"URL",urlPlaceholder:"https://contoh.com",insert:"Sisipkan",update:"Perbarui",remove:"Hapus tautan",cancel:"Batal",urlRequired:"URL wajib diisi",urlInvalid:"Masukkan URL yang valid"},findReplace:{title:"Temukan dan ganti",findPlaceholder:"Temukan di dokumen",replacePlaceholder:"Ganti dengan",next:"Berikutnya",previous:"Sebelumnya",replace:"Ganti",replaceAll:"Ganti semua",noMatches:"Tidak ada hasil",matchCount:"{current} dari {total}",close:"Tutup"},headerFooter:{title:"Penyesuaian Header & Footer",header:"Header",footer:"Footer",left:"Kiri",right:"Kanan",clear:"Kosongkan",headerPlaceholder:"mis. Judul Dokumen",footerPlaceholder:"mis. Halaman {page} dari {total}",headerLeftPlaceholder:"mis. Judul Dokumen",headerRightPlaceholder:"mis. Halaman {page}",footerLeftPlaceholder:"mis. Rahasia",footerRightPlaceholder:"mis. Halaman {page} dari {total}",variableInfo:"Info Variabel: Anda dapat menggunakan {page} untuk nomor halaman aktif, dan {total} untuk jumlah halaman.",differentFirstPage:"Halaman pertama berbeda",differentOddEven:"Halaman ganjil & genap berbeda",options:"Opsi",formatHeader:"Format header",pageNumber:"Nomor halaman",removeHeader:"Hapus header",headerFooterFormatTitle:"Header & footer",marginSection:"Margin",headerTopMargin:"Header (sentimeter dari atas)",footerBottomMargin:"Footer (sentimeter dari bawah)",layoutSection:"Tata letak",pageNumberTitle:"Nomor halaman",positionSection:"Posisi",positionHeader:"Header",positionFooter:"Footer",showOnFirstPage:"Tampilkan di halaman pertama",numberingSection:"Penomoran",startAt:"Dimulai dari",continueFromPrevious:"Lanjutkan dari bagian sebelumnya",apply:"Terapkan",cancel:"Batal",save:"Simpan"},showOutline:"Tampilkan kerangka dokumen",loadingDocument:"Memuat dokumen"},slashMenu:{title:"Saran",basicBlocks:"Blok Dasar",noMatch:"Tidak ada perintah yang cocok"},documentTabs:{documentTabs:"Tab Dokumen",addTab:"Tambah tab",rename:"Ubah nama",delete:"Hapus",outline:"Kerangka",untitledHeading:"Judul Tanpa Nama {level}",placeholder:"Tajuk yang Anda tambahkan ke dokumen akan muncul di sini."},theme:{lightMode:"Beralih ke mode terang",darkMode:"Beralih ke mode gelap"},sidebars:{ai:{title:"AI Writing Helper",description:"Penulis AI sisi-server untuk menyusun, merangkum, atau menyunting tulisan Anda.",quickMacros:"Makro AI Cepat",summarize:"Rangkum",fixGrammar:"Perbaiki Tata Bahasa",continue:"Lanjutkan",toSpanish:"Ke Spanyol",generations:"Hasil AI",aiDrafting:"AI menyusun…",copy:"Salin",copied:"Tersalin",insert:"Sisipkan",inserted:"Tersisip",noDraft:"Tanya apa saja tentang dokumen Anda, atau jalankan makro cepat di atas.",promptPlaceholder:"Minta AI membuat kerangka, menulis konten, menulis ulang nada…",promptAI:"Perintah AI",close:"Tutup",you:"Anda",assistant:"Asisten",notConfigured:"AI belum dikonfigurasi pada deployment ini.",selectTextFirst:"Pilih teks di dokumen terlebih dahulu",improveSelection:"Perbaiki pilihan",draft:"Draf dengan sitasi",draftPlaceholder:"Minta AI menyusun teks berbasis pustaka referensi Anda…",promptDraft:"Susun",citations:"Sitasi",emptyResponse:"AI mengembalikan respons kosong.",aiError:"Permintaan AI gagal"},comments:{title:"Panel Diskusi",placeholder:"Pilih teks untuk menambahkan komentar…",addComment:"Tambah komentar",resolve:"Selesai",reply:"Balas…",replyInThread:"Balas di thread",active:"Aktif",resolved:"Selesai",creatingAnchored:"Membuat komentar terpaut:",quote:"Kutipan:",resolvedBy:"Diselesaikan oleh {user}",noComments:"Belum ada komentar {mode}.",commentOnSelection:"Komentari pilihan…",generalComment:"Tambahkan komentar umum ke dokumen…",anchoredComment:"Komentar terpaut",general:"Komentar umum",post:"Kirim",orphaned:"Teks dihapus",delete:"Hapus",confirmDelete:"Hapus thread komentar ini? Tindakan ini tidak dapat dibatalkan."},history:{title:"Riwayat",empty:"Belum ada riwayat.",version:"Versi",restore:"Pulihkan",closePreview:"Tutup Pratinjau",restoreThis:"Pulihkan Ini",viewingPreview:"Melihat Pratinjau Revisi",readOnlyPreview:"Anda sedang melihat pratinjau versi #{index}. Editor Anda untuk sementara hanya-baca.",modifiedBy:"Diubah oleh:",saveNamedSnapshot:"Simpan Snapshot Bernama",snapshotPlaceholder:"mis. Final Draft Disetujui…",noSnapshots:"Belum ada snapshot yang disimpan.",save:"Simpan",cancel:"Batal",preview:"Pratinjau"},toc:{title:"Daftar Isi",empty:"Belum ada judul.",untitledHeading:"Judul Tanpa Nama {level}",newSection:"Bagian {tag} Baru",startWriting:"Mulai menulis di sini…",closeOutline:"Tutup kerangka",searchHeadings:"Cari judul…",noHeadings:"Belum Ada Judul",noHeadingsDescription:"Gunakan header (H1, H2, atau H3) untuk menyusun dokumen. Kerangka interaktif akan dibuat otomatis di sini.",quickInsert:"Sisipkan Cepat",headingLevel:"Judul {level}",noMatchingHeaders:"Tidak ada header yang cocok",tryDifferentTerm:"Coba cari dengan istilah lain.",outlineLayout:"Tata Letak Kerangka",outlineSync:"Kerangka tersinkronisasi otomatis. Klik header apa pun untuk langsung melompat, fokus, dan menggulir editor ke bagian tersebut."},references:{title:"Referensi",subtitle:"Kelola sumber dan sisipkan sitasi.",close:"Tutup referensi",citationStyle:"Gaya sitasi",searchSources:"Cari sumber…",addSource:"Tambah sumber",editSource:"Ubah sumber",noSources:"Belum ada sumber",noSourcesDescription:"Tambahkan referensi pertama Anda untuk mulai menyitasi. Sitasi dan daftar pustaka mengikuti gaya aktif secara otomatis.",noMatchingSources:"Tidak ada sumber yang cocok",cite:"Sitasi",edit:"Ubah",delete:"Hapus",back:"Kembali ke daftar",anonymous:"Anonim",etAl:"dkk.",confirmDelete:'Hapus sumber "{title}"? Sitasi yang merujuknya akan berhenti ditampilkan.',import:{title:"Impor",fromDoi:"Dari DOI (CrossRef)",doiPlaceholder:"Tempel DOI atau tautan DOI…",importDoi:"Impor DOI",doiSuccess:"Sumber berhasil diimpor dari CrossRef.",doiFailed:"DOI tidak dapat ditemukan.",fromFile:"Dari berkas BibTeX / RIS",pickFile:"Pilih berkas .bib atau .ris",importing:"Mengimpor…",batchSuccess:"{count} sumber berhasil diimpor.",partial:"{ok} berhasil, {failed} gagal.",failed:"Impor gagal."},types:{book:"Buku","article-journal":"Artikel jurnal",chapter:"Bab buku",webpage:"Halaman web",report:"Laporan",thesis:"Tesis",document:"Dokumen"},form:{type:"Jenis sumber",title:"Judul",authors:"Penulis",familyName:"Nama keluarga",givenName:"Nama depan",addAuthor:"Tambah penulis",year:"Tahun",journal:"Jurnal",bookTitle:"Judul buku",publisher:"Penerbit",publisherPlace:"Kota terbit",volume:"Volume",issue:"Edisi",pages:"Halaman",save:"Simpan perubahan",create:"Tambah sumber",cancel:"Batal"}}},dashboard:{allDocuments:"Semua Dokumen",starred:"Berbintang",folders:"Folder",createFolder:"Buat Folder Baru",folderNamePlaceholder:"Nama folder…",noFolders:"Belum ada folder.",startNewDocument:"Mulai Dokumen Baru",blankDocument:"Dokumen Kosong",blankDescription:"Kertas kosong",meetingNotes:"Catatan Rapat",meetingNotesDescription:"Peserta & Tindak Lanjut",projectProposal:"Proposal Proyek",projectProposalDescription:"Tujuan & Hasil",officialLetter:"Surat Resmi",officialLetterDescription:"Header yang sudah diformat",searchPlaceholder:"Cari judul atau isi dokumen…",modified:"Diubah",alphabetical:"Abjad",created:"Dibuat",gridView:"Tampilan Grid",listView:"Tampilan Daftar",activeFilters:"Filter Aktif:",folder:"Folder",starredOnly:"Hanya Berbintang",search:"Cari",noDocuments:"Tidak ada dokumen",noDocumentsDescription:"Tidak ada file yang cocok dengan filter. Pilih template atau buat dokumen kosong untuk mulai menulis!",createBlankDocument:"Buat Dokumen Kosong",loadingDocuments:"Memuat dokumen...",folderCreated:"Folder berhasil dibuat.",folderAlreadyExists:"Folder dengan nama tersebut sudah ada.",folderLoadError:"Folder tidak dapat dimuat. Silakan coba lagi.",folderCreateError:"Folder tidak dapat dibuat. Silakan coba lagi.",documentTitle:"Judul Dokumen",lastModified:"Terakhir Diubah",actions:"Aksi",trash:"Sampah",trashEmpty:"Sampah kosong",trashEmptyDescription:"Dokumen yang dihapus akan muncul di sini.",trashedAt:"Dihapus",movedToTrash:"Dipindahkan ke sampah:"},auth:{signInTitle:"Masuk untuk membuat dan menyunting dokumen",signInWithGoogle:"Masuk dengan Google",signInWithEmail:"Masuk dengan Email",signInWithGitHub:"Masuk dengan GitHub",signInWith:"Masuk dengan {provider}",or:"atau",email:"Email",password:"Kata sandi",name:"Nama",signIn:"Masuk",signUp:"Daftar",signOut:"Keluar",noAccount:"Belum punya akun? Daftar",hasAccount:"Sudah punya akun? Masuk",invalidCredentials:"Email atau kata sandi salah",accountCreated:"Akun dibuat! Anda sekarang masuk.",loadDocumentsError:"Gagal memuat dokumen. Apakah server berjalan?",retry:"Coba lagi",rateLimited:"Server sedang membatasi permintaan.",retryIn:"Mencoba ulang dalam {seconds} detik…",networkError:"Tidak bisa menghubungi server. Periksa koneksi Anda.",noProviders:"Tidak ada penyedia autentikasi yang dikonfigurasi. Periksa variabel lingkungan server."},language:{label:"Bahasa",en:"English",id:"Indonesia"}},qr={en:Dc,id:Rc},ls="en",Mp={en:Dc.language.en,id:Rc.language.id};function Lc(e){return qr[e]??qr[ls]}function $r(e){return typeof e=="string"&&e in qr}const Bc=Symbol("docflow-locale"),Pc="docflow-locale";function zp(e){if(e&&$r(e))return e;try{const t=localStorage.getItem(Pc);if(t&&$r(t))return t}catch{}return ls}function Ip(e,t){const i=t.split(".");let n=e;for(const r of i){if(n===null||typeof n!="object")return;n=n[r]}return n}function Vc(e){const t=s.ref(zp(e));return{locale:t,setLocale:r=>{if($r(r)){t.value=r;try{localStorage.setItem(Pc,r)}catch{}}},t:(r,a)=>{const o=Lc(t.value),l=Ip(o,r);if(typeof l!="string")return r;let c=l;if(a)for(const[f,p]of Object.entries(a))c=c.replace(new RegExp(`\\{${f}\\}`,"g"),String(p));return c}}}function rt(){const e=s.inject(Bc,null);return e||Vc()}function Fc(e){const t=Vc(e);return s.provide(Bc,t),t}function Uc(e){return Mp[e]??e}function Hc(){return["en","id"]}function Dp(e){const t=s.ref({totalPages:1,visiblePages:[],config:{pageSize:{id:"a4",name:"A4",pageWidth:794,pageHeight:1123},margins:{top:20,bottom:20,left:50,right:50},pageGap:50,headerLeft:"",headerRight:"",footerLeft:"",footerRight:""}}),i=s.computed(()=>t.value.totalPages),n=s.computed(()=>t.value.visiblePages),r=s.ref(!1);let a=null,o=null;const l=async()=>{var h;const m=e.editorRef.value,d=e.scrollRef.value;!((h=m==null?void 0:m.view)!=null&&h.dom)||!d||(a=new Cn.VirtualPageOverlay(m.view.dom,e.config,d,e.bufferPages??2),a.observe(),t.value=await a.layout(),r.value=!0,o=new ResizeObserver(async()=>{a&&(t.value=await a.layout())}),o.observe(m.view.dom))},c=async m=>{a&&(t.value=await a.updateConfig(m))},f=()=>{a&&(t.value=a.getData())};let p=null;return s.onMounted(()=>{p=setInterval(f,250)}),s.onUnmounted(()=>{p&&clearInterval(p),a==null||a.disconnect(),o==null||o.disconnect()}),s.watch([()=>{var m,d;return(d=(m=e.editorRef.value)==null?void 0:m.view)==null?void 0:d.dom},e.scrollRef],()=>{r.value||l()},{immediate:!0}),s.watch(()=>e.config,m=>{r.value&&c(m)},{deep:!0}),{data:t,totalPages:i,visiblePages:n,isReady:r,refreshData:f,updateConfig:c}}const Rp={key:0,class:"virtual-page-overlay","aria-hidden":"true"},Lp=["innerHTML"],Bp=["innerHTML"],Pp=["innerHTML"],Vp=["innerHTML"],Fp=s.defineComponent({__name:"VirtualPageOverlay",props:{data:{},isReady:{type:Boolean}},setup(e){const t=e,i=s.computed(()=>t.data.visiblePages),n=s.computed(()=>t.data.config),r=s.computed(()=>n.value.pageSize),a=s.computed(()=>({height:`${n.value.pageGap}px`})),o=s.computed(()=>({paddingTop:`${n.value.margins.top}px`,paddingLeft:`${n.value.margins.left}px`,paddingRight:`${n.value.margins.right}px`,height:`${n.value.margins.top}px`})),l=s.computed(()=>({paddingBottom:`${n.value.margins.bottom}px`,paddingLeft:`${n.value.margins.left}px`,paddingRight:`${n.value.margins.right}px`}));function c(p){return{top:`${p.top}px`,height:`${r.value.pageHeight+n.value.pageGap}px`,width:`${r.value.pageWidth}px`}}function f(p,m){return p.replace(/\{page\}/g,String(m+1)).replace(/\{total\}/g,String(t.data.totalPages))}return(p,m)=>e.isReady?(s.openBlock(),s.createElementBlock("div",Rp,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(i.value,d=>(s.openBlock(),s.createElementBlock("div",{key:d.index,class:"vp-page",style:s.normalizeStyle(c(d))},[s.createElementVNode("div",{class:"vp-gap",style:s.normalizeStyle(a.value)},null,4),s.createElementVNode("div",{class:"vp-header",style:s.normalizeStyle(o.value)},[s.createElementVNode("span",{class:"vp-header-left",innerHTML:n.value.headerLeft},null,8,Lp),s.createElementVNode("span",{class:"vp-header-right",innerHTML:n.value.headerRight},null,8,Bp)],4),s.createElementVNode("div",{class:"vp-footer",style:s.normalizeStyle(l.value)},[s.createElementVNode("span",{class:"vp-footer-left",innerHTML:f(n.value.footerLeft,d.index)},null,8,Pp),s.createElementVNode("span",{class:"vp-footer-right",innerHTML:f(n.value.footerRight,d.index)},null,8,Vp)],4)],4))),128))])):s.createCommentVNode("",!0)}}),cs=(e,t)=>{const i=e.__vccOpts||e;for(const[n,r]of t)i[n]=r;return i},Up=cs(Fp,[["__scopeId","data-v-a48fe1b6"]]),Hp={class:"px-2 py-1.5 text-[10px] font-semibold uppercase text-slate-400"},jp=["onClick","onMouseenter"],qp={class:"text-slate-500 dark:text-slate-400"},jc=s.defineComponent({__name:"SlashMenu",props:{editor:{},commands:{}},setup(e){const{t}=rt(),i=e,n=s.ref(!1),r=s.ref(""),a=s.ref(0),o=s.ref({top:0,left:0}),l=s.ref([]);function c(){if(!i.editor)return;const{view:h}=i.editor,{selection:v}=h.state,b=h.coordsAtPos(v.head);o.value={top:b.bottom+4,left:b.left}}function f(h){var E,B,_,S;if(!i.editor)return;const{view:v}=i.editor,{selection:b}=v.state,y=b.head,g=v.state.doc.resolve(y),x=g.start(),w=g.parent.textContent.slice(0,g.parentOffset).lastIndexOf("/");if(w>=0){const T=x+w,D=v.state.tr.delete(T,y);v.dispatch(D)}const C=i.editor;if(typeof((E=C.commands)==null?void 0:E[h.command])=="function")C.commands[h.command]();else if(C.chain)try{(S=(_=(B=C.chain().focus())[h.command])==null?void 0:_.call(B))==null||S.run()}catch{}n.value=!1,r.value=""}function p(){n.value=!1,r.value=""}function m(){if(!i.editor)return;const{view:h}=i.editor,{selection:v}=h.state,b=v.head,y=h.state.doc.resolve(b),g=y.parent.textContent.slice(0,y.parentOffset),x=g.lastIndexOf("/");if(x>=0){const k=g.slice(0,x),w=g.slice(x+1);if((k===""||k.endsWith(" ")||k===`
2
2
  `)&&!w.includes(" ")){r.value=w,n.value=!0,a.value=0,c();return}}n.value=!1}s.watch(()=>i.editor,h=>{h&&(h.on("update",m),h.on("selectionUpdate",()=>{n.value&&c()}))}),s.watch([r,()=>i.commands],()=>{const h=r.value.toLowerCase();l.value=h?i.commands.filter(v=>v.name.toLowerCase().includes(h)):i.commands});function d(h){if(n.value){if(h.key==="ArrowDown"&&(h.preventDefault(),a.value=Math.min(a.value+1,l.value.length-1)),h.key==="ArrowUp"&&(h.preventDefault(),a.value=Math.max(a.value-1,0)),h.key==="Enter"){h.preventDefault();const v=l.value[a.value];v&&f(v)}h.key==="Escape"&&(h.preventDefault(),p())}}return s.onMounted(()=>{document.addEventListener("keydown",d)}),s.onUnmounted(()=>{document.removeEventListener("keydown",d)}),(h,v)=>(s.openBlock(),s.createBlock(s.Teleport,{to:"body"},[n.value&&l.value.length>0?(s.openBlock(),s.createElementBlock("div",{key:0,class:"docs-slash-menu fixed z-[999] w-56 max-h-64 overflow-y-auto rounded-lg border border-slate-200 bg-white p-1 shadow-xl dark:border-slate-700 dark:bg-slate-800",style:s.normalizeStyle({top:o.value.top+"px",left:o.value.left+"px"})},[s.createElementVNode("div",Hp,s.toDisplayString(s.unref(t)("slashMenu.basicBlocks")),1),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(l.value,(b,y)=>(s.openBlock(),s.createElementBlock("button",{key:b.command,class:s.normalizeClass(["flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition-colors",y===a.value?"bg-slate-100 dark:bg-slate-700":"hover:bg-slate-50 dark:hover:bg-slate-700/50"]),onClick:g=>f(b),onMouseenter:g=>a.value=y},[s.createElementVNode("span",qp,s.toDisplayString(b.name),1)],42,jp))),128))],4)):s.createCommentVNode("",!0)]))}});/**
3
3
  * @license lucide-vue-next v1.0.0 - ISC
4
4
  *
@@ -439,7 +439,7 @@
439
439
  *
440
440
  * This source code is licensed under the ISC license.
441
441
  * See the LICENSE file in the root directory of this source tree.
442
- */const Dt=re("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Hd=["title"],Ao=s.defineComponent({__name:"ThemeToggle",setup(e){const{isDark:t,toggle:i}=Ba(),{t:n}=rt();return(r,a)=>(s.openBlock(),s.createElementBlock("button",{type:"button",class:"p-2 rounded-lg border border-slate-200 bg-slate-50 text-slate-500 transition-colors hover:border-slate-300 hover:text-slate-700 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-400 dark:hover:border-slate-600 dark:hover:text-slate-200",title:s.unref(t)?s.unref(n)("theme.lightMode"):s.unref(n)("theme.darkMode"),onClick:a[0]||(a[0]=(...o)=>s.unref(i)&&s.unref(i)(...o))},[s.unref(t)?(s.openBlock(),s.createBlock(s.unref(Pd),{key:0,class:"h-4 w-4"})):(s.openBlock(),s.createBlock(s.unref(Sd),{key:1,class:"h-4 w-4"}))],8,Hd))}}),jd="data:image/png;base64,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",qd="data:image/png;base64,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",$d={class:"sticky top-0 z-40 flex h-14 flex-col border-b border-slate-200 bg-white transition-colors duration-200 dark:border-slate-800 dark:bg-[#0b1120]"},Wd={class:"flex h-full w-full items-center justify-between gap-4 px-3 md:px-4"},Gd={class:"flex items-center gap-3"},Kd=["title"],Xd=["src"],Jd={class:"flex min-w-0 flex-col gap-0.5"},Zd={class:"flex items-center gap-1.5"},Qd=["title"],Yd=["title"],em={class:"header-menu-container hidden items-center gap-0 md:flex"},tm=["onClick","onMouseenter"],im={key:0,class:"absolute left-0 top-full z-50 mt-1 min-w-[220px] rounded-lg border border-slate-200 bg-white py-1 text-sm text-slate-700 shadow-xl dark:border-slate-700 dark:bg-[#0e1525] dark:text-slate-200",style:{"transform-origin":"top left"}},nm={key:0,class:"my-1 border-t border-slate-100 dark:border-slate-700/80"},rm=["onMouseenter"],am={type:"button",class:"flex w-full items-center justify-between px-4 py-2 text-left hover:bg-slate-50 dark:hover:bg-white/5"},om={key:0,class:"absolute left-full top-0 z-50 ml-1 min-w-[200px] rounded-lg border border-slate-200 bg-white py-1 text-sm text-slate-700 shadow-xl dark:border-slate-700 dark:bg-[#0e1525] dark:text-slate-200"},sm=["onClick"],lm={key:0,class:"rounded bg-slate-100 px-1 py-0.5 text-[9px] font-mono text-slate-500 dark:bg-slate-700 dark:text-slate-400"},cm=["onClick"],um={key:0,class:"text-blue-600 dark:text-blue-400"},fm={key:1,class:"text-[11px] text-slate-400 dark:text-slate-500"},pm={class:"flex flex-shrink-0 items-center gap-1.5"},dm={key:0,class:"hidden items-center gap-2 lg:flex"},mm={class:"flex -space-x-1.5 overflow-hidden"},hm=["title"],bm={class:"drop-shadow-sm"},gm=["title"],vm={class:"hidden xl:block"},ym={class:"hidden sm:inline"},xm={class:"header-user-container relative flex-shrink-0"},km=["title"],wm=["src","alt"],_m={key:1,class:"flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-cyan-500 to-blue-600 text-xs font-bold text-white"},Sm={class:"hidden max-w-[140px] truncate text-sm font-medium text-slate-700 dark:text-slate-200 sm:inline"},Cm={key:0,class:"absolute right-0 top-full z-50 mt-1 min-w-[200px] rounded-lg border border-slate-200 bg-white py-1 text-sm text-slate-700 shadow-xl dark:border-slate-700 dark:bg-[#0e1525] dark:text-slate-200",style:{"transform-origin":"top right"}},Em={class:"border-b border-slate-100 px-4 py-2 dark:border-slate-700/80"},Nm={class:"truncate text-sm font-semibold text-slate-800 dark:text-slate-100"},Am={class:"header-more-container relative xl:hidden"},Om={key:0,class:"absolute right-0 top-full z-50 mt-1 min-w-[210px] rounded-lg border border-slate-200 bg-white py-1 text-sm text-slate-700 shadow-xl dark:border-slate-700 dark:bg-[#0e1525] dark:text-slate-200",style:{"transform-origin":"top right"}},Tm={class:"flex items-center justify-between px-4 py-2"},iu=s.defineComponent({__name:"HeaderBar",props:{title:{default:"Untitled Document"},editable:{type:Boolean,default:!0},collaborators:{default:()=>[]},starred:{type:Boolean,default:!1},pageless:{type:Boolean,default:!1},outlineOpen:{type:Boolean,default:!1},showRuler:{type:Boolean,default:!0},focusMode:{type:Boolean,default:!1},currentUserId:{default:""},simulatorsActive:{type:Boolean,default:!1},userName:{default:""},userAvatar:{default:""}},emits:["back","update:title","toggle-star","toggle-simulators","export","share","menu-click"],setup(e,{emit:t}){const{setLocale:i,t:n}=rt(),{isDark:r}=Ba(),a=Hc(),o=e,l=t,c=s.ref(!1),f=s.ref(o.title),p=s.ref(null),m=s.ref(null),d=s.ref(!1);s.watch(()=>o.title,j=>{f.value=j});const h=async()=>{var j,O;c.value=!0,await s.nextTick(),(j=p.value)==null||j.focus(),(O=p.value)==null||O.select()},v=()=>{const j=f.value.trim();j&&j!==o.title&&l("update:title",j),f.value=o.title,c.value=!1},b=s.computed(()=>r.value?jd:qd),y=j=>j.split(" ").map(O=>O[0]).join("").slice(0,2).toUpperCase(),g=j=>{l("export",j),m.value=null},x=s.computed(()=>y(o.userName)||"?"),k=s.ref(!1),w=typeof navigator<"u"&&/mac/i.test(navigator.platform);function C(j){return w?`⌘${j}`:`Ctrl+${j.replace("⇧","Shift+")}`}const E=s.computed(()=>({File:{label:n("header.file"),items:[{label:n("header.new"),action:"new-doc"},{label:n("header.open"),action:"open-doc"},{label:n("header.makeACopy"),action:"duplicate"},{label:"divider",divider:!0},{label:n("header.share"),action:"share"},{label:n("header.email"),action:"email"},{label:n("header.download"),sub:[{label:n("header.docx"),action:"export:docx",badge:"DOCX"},{label:n("header.pdf"),action:"export:pdf",badge:"PDF"},{label:n("header.odt"),action:"export:odt",badge:"ODT"},{label:n("header.txt"),action:"export:txt",badge:"TXT"},{label:n("header.rtf"),action:"export:rtf",badge:"RTF"},{label:n("header.htmlZip"),action:"export:html-zip",badge:"ZIP"},{label:n("header.html"),action:"export:html",badge:"HTML"},{label:n("header.markdown"),action:"export:markdown",badge:"MD"}]},{label:"divider",divider:!0},{label:n("header.rename"),action:"rename"},{label:n("header.move"),action:"move"},{label:n("header.addToStarred"),action:"add-to-starred"},{label:n("header.moveToTrash"),action:"trash"},{label:"divider",divider:!0},{label:n("header.versionHistory"),action:"version-history"},{label:"divider",divider:!0},{label:n("header.details"),action:"details"},{label:n("header.security"),action:"security"},{label:"divider",divider:!0},{label:n("header.language"),sub:a.map(j=>({label:Uc(j),action:`set-locale:${j}`}))},{label:n("header.pageSetup"),action:"page-setup"},{label:n("header.print"),action:"print"}]},Edit:{label:n("header.edit"),items:[{label:n("header.undo"),action:"undo",shortcut:C("Z")},{label:n("header.redo"),action:"redo",shortcut:C("Y")},{label:"divider",divider:!0},{label:n("header.cut"),action:"cut",shortcut:C("X")},{label:n("header.copy"),action:"copy",shortcut:C("C")},{label:n("header.paste"),action:"paste",shortcut:C("V")},{label:n("header.pasteWithoutFormatting"),action:"paste-without-formatting",shortcut:C("⇧V")},{label:"divider",divider:!0},{label:n("header.selectAll"),action:"select-all",shortcut:C("A")},{label:n("header.delete"),action:"delete"},{label:"divider",divider:!0},{label:n("header.findAndReplace"),action:"find-replace",shortcut:C("⇧H")}]},View:{label:n("header.view"),items:[{label:n("header.showSidebar"),action:"toggle-left-sidebar",checked:o.outlineOpen},{label:"divider",divider:!0},{label:n("header.focusMode"),action:"toggle-focus-mode",checked:o.focusMode},{label:n("header.showRuler"),action:"toggle-ruler",checked:o.showRuler}]},Insert:{label:n("header.insert"),items:[{label:n("header.meetingNotes"),action:"meeting-notes"},{label:n("header.emailDraft"),action:"email-draft"},{label:"divider",divider:!0},{label:n("header.image"),action:"insert-image"},{label:n("header.table"),action:"insert-table"},{label:n("header.codeBlock"),action:"insert-code"},{label:"divider",divider:!0},{label:n("header.link"),action:"insert-link",shortcut:C("K")},{label:"divider",divider:!0},{label:n("header.header"),action:"insert-header"},{label:n("header.footer"),action:"insert-footer"},{label:n("header.footnote"),action:"insert-footnote"},{label:n("header.tableOfContents"),action:"insert-toc"}]},Format:{label:n("header.format"),items:[{label:n("header.bold"),action:"bold"},{label:n("header.italic"),action:"italic"},{label:n("header.underline"),action:"underline"},{label:"divider",divider:!0},{label:n("header.heading1"),action:"heading1"},{label:n("header.heading2"),action:"heading2"},{label:n("header.heading3"),action:"heading3"},{label:"divider",divider:!0},{label:n("header.alignIndent"),sub:[{label:n("header.alignLeft"),action:"align-left"},{label:n("header.alignCenter"),action:"align-center"},{label:n("header.alignRight"),action:"align-right"},{label:n("header.alignJustify"),action:"align-justify"}]},{label:n("header.bulletsNumbering"),sub:[{label:n("header.bulletList"),action:"bullet-list"},{label:n("header.numberedList"),action:"numbered-list"},{label:n("header.taskList"),action:"task-list"}]},{label:"divider",divider:!0},{label:n("header.horizontalLine"),action:"horizontal-line"},{label:n("header.pageNumbers"),sub:[{label:n("header.pageNumberInHeader"),action:"page-numbers-header"},{label:n("header.pageNumberInFooter"),action:"page-numbers-footer"}]},{label:"divider",divider:!0},{label:n("header.pagelessFormat"),action:"toggle-pageless",checked:o.pageless},{label:"divider",divider:!0},{label:n("header.clearFormatting"),action:"clear-formatting"}]},Tools:{label:n("header.tools"),items:[{label:n("header.spellCheck"),action:"spellcheck"},{label:n("header.wordCount"),action:"word-count"},{label:"divider",divider:!0},{label:n("header.preferences"),action:"preferences"}]},Extensions:{label:n("header.extensions"),items:[{label:n("header.manageExtensions"),action:"manage-extensions"}]},Help:{label:n("header.help"),items:[{label:n("header.keyboardShortcuts"),action:"keyboard-shortcuts"},{label:"divider",divider:!0},{label:n("header.reportIssue"),action:"report-issue"},{label:n("header.about"),action:"about"}]}})),B=s.computed(()=>Object.keys(E.value)),_=s.ref(null),S=j=>{const O=m.value!==j;m.value=O?j:null,_.value=null,d.value=O},T=s.ref(!1),D=()=>{T.value=!T.value},H=s.ref(!1),V=j=>{i(j),H.value=!1},M=s.ref(!1),$=()=>{M.value=!M.value},P=j=>{if(j.startsWith("export:")){const O=j.replace("export:","");g(O)}else if(j==="share")l("share"),m.value=null;else if(j==="add-to-starred")l("toggle-star"),m.value=null;else if(j==="rename")h(),m.value=null;else if(j.startsWith("set-locale:")){const O=j.replace("set-locale:","");V(O)}else l("menu-click",j);_.value=null,d.value=!1},W=j=>{const O=j.target;O.closest(".header-menu-container")||(m.value=null,_.value=null,d.value=!1),O.closest(".header-more-container")||(T.value=!1),O.closest(".header-user-container")||(M.value=!1)};function L(j){d.value&&m.value!==j&&(m.value=j,_.value=null)}function Q(j){m.value&&j.key==="Escape"&&(m.value=null,_.value=null,d.value=!1)}return s.onMounted(()=>{document.addEventListener("click",W,!0),document.addEventListener("keydown",Q)}),s.onUnmounted(()=>{document.removeEventListener("click",W,!0),document.removeEventListener("keydown",Q)}),(j,O)=>(s.openBlock(),s.createElementBlock("header",$d,[s.createElementVNode("div",Wd,[s.createElementVNode("div",Gd,[s.createElementVNode("button",{type:"button",class:"flex h-9 cursor-pointer items-center justify-center hover:opacity-90 transition-opacity",title:s.unref(n)("header.backToDocuments"),onClick:O[0]||(O[0]=R=>l("back"))},[s.createElementVNode("img",{src:b.value,alt:"Docflow",class:"h-9 w-auto"},null,8,Xd)],8,Kd),s.createElementVNode("div",Jd,[s.createElementVNode("div",Zd,[c.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:0,ref_key:"titleInputEl",ref:p,"onUpdate:modelValue":O[1]||(O[1]=R=>f.value=R),type:"text",class:"min-w-[150px] border-b-2 border-cyan-500 bg-transparent px-1 py-0 text-sm font-semibold text-slate-800 focus:outline-none dark:text-slate-100 md:min-w-[240px]",onBlur:v,onKeydown:s.withKeys(v,["enter"])},null,544)),[[s.vModelText,f.value]]):(s.openBlock(),s.createElementBlock("h1",{key:1,class:"max-w-[180px] cursor-text truncate rounded px-1 py-0 text-sm font-semibold text-slate-800 hover:bg-slate-50 dark:text-slate-100 dark:hover:bg-slate-800/60 md:max-w-[280px]",title:s.unref(n)("header.clickToRename"),onClick:O[2]||(O[2]=R=>void h())},s.toDisplayString(o.title),9,Qd)),s.createElementVNode("button",{type:"button",class:"flex h-6 w-6 items-center justify-center rounded-full text-slate-400 transition-colors hover:text-amber-500",title:e.starred?s.unref(n)("header.unstarDocument"):s.unref(n)("header.starDocument"),onClick:O[3]||(O[3]=R=>l("toggle-star"))},[s.createVNode(s.unref(Ld),{class:s.normalizeClass(["h-4 w-4",e.starred?"fill-amber-400 text-amber-500":""])},null,8,["class"])],8,Yd)]),s.createElementVNode("nav",em,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(B.value,R=>(s.openBlock(),s.createElementBlock("div",{key:R,class:"relative"},[s.createElementVNode("button",{type:"button",class:s.normalizeClass(["flex items-center gap-0.5 rounded px-2 py-0.5 text-[13px] transition-colors",m.value===R?"bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800"]),onClick:s.withModifiers(U=>S(R),["stop"]),onMouseenter:U=>L(R)},s.toDisplayString(E.value[R].label),43,tm),s.createVNode(s.Transition,{"enter-active-class":"transition-all duration-150 ease-out","enter-from-class":"opacity-0 scale-95 translate-y-[-4px]","enter-to-class":"opacity-100 scale-100 translate-y-0","leave-active-class":"transition-all duration-100 ease-in","leave-from-class":"opacity-100 scale-100 translate-y-0","leave-to-class":"opacity-0 scale-95 translate-y-[-4px]"},{default:s.withCtx(()=>[m.value===R?(s.openBlock(),s.createElementBlock("div",im,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(E.value[R].items,(U,oe)=>(s.openBlock(),s.createElementBlock(s.Fragment,{key:oe},[U.divider?(s.openBlock(),s.createElementBlock("div",nm)):U.sub?(s.openBlock(),s.createElementBlock("div",{key:1,class:"relative",onMouseenter:ie=>_.value=`${R}-${oe}`,onMouseleave:O[4]||(O[4]=ie=>_.value=null)},[s.createElementVNode("button",am,[s.createElementVNode("span",null,s.toDisplayString(U.label),1),s.createVNode(s.unref(ei),{class:"h-3.5 w-3.5 -rotate-90 text-slate-400"})]),s.createVNode(s.Transition,{"enter-active-class":"transition-all duration-100 ease-out","enter-from-class":"opacity-0 translate-x-2","enter-to-class":"opacity-100 translate-x-0","leave-active-class":"transition-all duration-75 ease-in","leave-from-class":"opacity-100 translate-x-0","leave-to-class":"opacity-0 translate-x-2"},{default:s.withCtx(()=>[_.value===`${R}-${oe}`?(s.openBlock(),s.createElementBlock("div",om,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(U.sub,ie=>(s.openBlock(),s.createElementBlock("button",{key:ie.action,type:"button",class:"flex w-full items-center justify-between px-4 py-2 text-left hover:bg-slate-50 dark:hover:bg-white/5",onClick:s.withModifiers(ee=>P(ie.action),["stop"])},[s.createElementVNode("span",null,s.toDisplayString(ie.label),1),ie.badge?(s.openBlock(),s.createElementBlock("span",lm,s.toDisplayString(ie.badge),1)):s.createCommentVNode("",!0)],8,sm))),128))])):s.createCommentVNode("",!0)]),_:2},1024)],40,rm)):(s.openBlock(),s.createElementBlock("button",{key:2,type:"button",class:"flex w-full items-center justify-between gap-6 px-4 py-2 text-left hover:bg-slate-50 dark:hover:bg-white/5",onClick:s.withModifiers(ie=>P(U.action),["stop"])},[s.createElementVNode("span",null,s.toDisplayString(U.label),1),U.checked?(s.openBlock(),s.createElementBlock("span",um,[s.createVNode(s.unref(Wr),{class:"h-3.5 w-3.5"})])):U.shortcut?(s.openBlock(),s.createElementBlock("span",fm,s.toDisplayString(U.shortcut),1)):s.createCommentVNode("",!0)],8,cm))],64))),128))])):s.createCommentVNode("",!0)]),_:2},1024)]))),128))])])]),s.createElementVNode("div",pm,[e.collaborators.length>0?(s.openBlock(),s.createElementBlock("div",dm,[s.createElementVNode("div",mm,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.collaborators,R=>(s.openBlock(),s.createElementBlock("div",{key:R.userId,class:"flex h-7 w-7 flex-shrink-0 cursor-help items-center justify-center rounded-full border-2 border-white text-[10px] font-bold text-white dark:border-slate-900",style:s.normalizeStyle({backgroundColor:R.color}),title:`${R.name} ${R.userId===e.currentUserId?"(You)":""} ${R.isTyping?"is typing...":""}`},[s.createElementVNode("span",bm,s.toDisplayString(y(R.name)),1)],12,hm))),128))])])):s.createCommentVNode("",!0),s.renderSlot(j.$slots,"actions"),e.editable?(s.openBlock(),s.createElementBlock("button",{key:1,type:"button",class:s.normalizeClass(["hidden h-8 w-8 items-center justify-center rounded-md transition-all xl:flex",e.simulatorsActive?"animate-pulse bg-emerald-600 text-white hover:bg-emerald-700":"text-indigo-600 hover:bg-slate-100 dark:text-indigo-300 dark:hover:bg-slate-800"]),title:s.unref(n)("header.sandbox"),onClick:O[5]||(O[5]=R=>l("toggle-simulators"))},[s.createVNode(s.unref(bl),{class:"h-[18px] w-[18px]"})],10,gm)):s.createCommentVNode("",!0),s.createElementVNode("div",vm,[s.createVNode(Ao)]),s.createElementVNode("button",{type:"button",class:"flex h-8 items-center gap-1.5 rounded-md bg-blue-600 px-3 text-[13px] font-semibold text-white shadow transition-colors hover:bg-blue-700",onClick:O[6]||(O[6]=R=>l("share"))},[s.createVNode(s.unref(zd),{class:"h-3.5 w-3.5"}),s.createElementVNode("span",ym,s.toDisplayString(s.unref(n)("header.share")),1)]),s.createElementVNode("div",xm,[s.createElementVNode("button",{type:"button",class:"flex h-8 items-center gap-1.5 rounded-full py-0.5 pl-0.5 pr-1.5 transition-colors hover:bg-slate-100 dark:hover:bg-slate-800",title:e.userName,onClick:s.withModifiers($,["stop"])},[e.userAvatar&&!k.value?(s.openBlock(),s.createElementBlock("img",{key:0,src:e.userAvatar,alt:e.userName,referrerpolicy:"no-referrer",class:"h-7 w-7 flex-shrink-0 rounded-full object-cover",onError:O[7]||(O[7]=R=>k.value=!0)},null,40,wm)):(s.openBlock(),s.createElementBlock("span",_m,s.toDisplayString(x.value),1)),s.createElementVNode("span",Sm,s.toDisplayString(e.userName||s.unref(n)("header.account")),1),s.createVNode(s.unref(ei),{class:"h-3.5 w-3.5 flex-shrink-0 text-slate-400"})],8,km),s.createVNode(s.Transition,{"enter-active-class":"transition-all duration-150 ease-out","enter-from-class":"opacity-0 scale-95 translate-y-[-4px]","enter-to-class":"opacity-100 scale-100 translate-y-0","leave-active-class":"transition-all duration-100 ease-in","leave-from-class":"opacity-100 scale-100 translate-y-0","leave-to-class":"opacity-0 scale-95 translate-y-[-4px]"},{default:s.withCtx(()=>[M.value?(s.openBlock(),s.createElementBlock("div",Cm,[s.createElementVNode("div",Em,[s.createElementVNode("p",Nm,s.toDisplayString(e.userName||s.unref(n)("header.account")),1)]),s.renderSlot(j.$slots,"user-menu",{close:()=>M.value=!1})])):s.createCommentVNode("",!0)]),_:3})]),s.createElementVNode("div",Am,[s.createElementVNode("button",{type:"button",class:"flex h-8 w-8 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-slate-800",title:"More",onClick:s.withModifiers(D,["stop"])},[s.createVNode(s.unref(Wc),{class:"h-[18px] w-[18px]"})]),s.createVNode(s.Transition,{"enter-active-class":"transition-all duration-150 ease-out","enter-from-class":"opacity-0 scale-95 translate-y-[-4px]","enter-to-class":"opacity-100 scale-100 translate-y-0","leave-active-class":"transition-all duration-100 ease-in","leave-from-class":"opacity-100 scale-100 translate-y-0","leave-to-class":"opacity-0 scale-95 translate-y-[-4px]"},{default:s.withCtx(()=>[T.value?(s.openBlock(),s.createElementBlock("div",Om,[s.renderSlot(j.$slots,"overflow-actions",{close:()=>T.value=!1}),e.editable?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-slate-50 dark:hover:bg-white/5",onClick:O[8]||(O[8]=R=>{l("toggle-simulators"),T.value=!1})},[s.createVNode(s.unref(bl),{class:"h-4 w-4 text-slate-400"}),s.createElementVNode("span",null,s.toDisplayString(s.unref(n)("header.sandbox")),1)])):s.createCommentVNode("",!0),O[9]||(O[9]=s.createElementVNode("div",{class:"my-1 border-t border-slate-100 dark:border-slate-700/80"},null,-1)),s.createElementVNode("div",Tm,[s.createElementVNode("span",null,s.toDisplayString(s.unref(n)("header.theme")),1),s.createVNode(Ao)])])):s.createCommentVNode("",!0)]),_:3})])])])]))}}),Mm={class:"mb-3 grid grid-cols-10 gap-1.5"},zm=["title","onClick"],Im={class:"space-y-2"},Dm=["title","onClick"],Rm={class:"mt-3 border-t border-slate-100 pt-3 dark:border-slate-700"},Lm={class:"mb-2 text-[10px] font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400"},Bm={class:"flex items-center gap-2"},Pm={class:"flex h-6 w-6 items-center justify-center rounded-full border border-slate-200 dark:border-slate-600"},gl=s.defineComponent({__name:"ColorPickerDropdown",props:{isOpen:{type:Boolean},activeColor:{},defaultColor:{},label:{}},emits:["select","reset","close"],setup(e,{emit:t}){const i=e,n=t,r=[["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#ffffff"],["#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#0000ff","#9900ff","#ff00ff"],["#e6b8af","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#c9daf8","#cfe2f3","#d9d2e9","#ead1dc"],["#dd7e6b","#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#a4c2f4","#9fc5e8","#b4a7d6","#d5a6bd"],["#cc4125","#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6d9eeb","#6fa8dc","#8e7cc3","#c27ba0"],["#a61c00","#cc0000","#e69138","#f1c232","#6aa84f","#45818e","#3c78d8","#3d85c6","#674ea7","#a64d79"],["#85200c","#990000","#b45f06","#bf9000","#38761d","#134f5c","#1155cc","#0b5394","#351c75","#741b47"],["#5b0f00","#660000","#783f04","#7f6000","#274e13","#0c343d","#1c4587","#073763","#20124d","#4a1130"]],a=s.ref("#000000"),o=s.ref(null);s.watch(()=>i.isOpen,m=>{m&&(a.value=i.activeColor||"#000000")});function l(m){n("select",m)}function c(){n("reset")}function f(){n("select",a.value)}function p(m){m.target===m.currentTarget&&n("close")}return(m,d)=>e.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"color-picker-dropdown absolute left-0 top-full z-50 mt-1.5 w-[272px] rounded-lg border border-slate-200 bg-white p-3 shadow-xl dark:border-slate-700 dark:bg-[#0e1525]",onClick:p},[s.createElementVNode("div",Mm,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r[0],h=>(s.openBlock(),s.createElementBlock("button",{key:h,type:"button",class:"h-5 w-5 rounded-full border border-slate-200 transition-transform hover:scale-110 focus:outline-none focus:ring-2 focus:ring-cyan-500 dark:border-slate-600",style:s.normalizeStyle({backgroundColor:h}),title:h,onClick:v=>l(h)},null,12,zm))),128))]),s.createElementVNode("div",Im,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r.slice(1),(h,v)=>(s.openBlock(),s.createElementBlock("div",{key:v,class:"grid grid-cols-10 gap-1.5"},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(h,b=>(s.openBlock(),s.createElementBlock("button",{key:b,type:"button",class:"h-5 w-5 rounded-full border border-slate-200 transition-transform hover:scale-110 focus:outline-none focus:ring-2 focus:ring-cyan-500 dark:border-slate-600",style:s.normalizeStyle({backgroundColor:b}),title:b,onClick:y=>l(b)},null,12,Dm))),128))]))),128))]),s.createElementVNode("div",Rm,[s.createElementVNode("div",Lm,s.toDisplayString(m.$props.label||"Custom"),1),s.createElementVNode("div",Bm,[s.createElementVNode("button",{type:"button",class:"flex h-6 w-6 items-center justify-center rounded-full border border-slate-200 bg-slate-50 hover:bg-slate-100 dark:border-slate-600 dark:bg-slate-800 dark:hover:bg-slate-700",onClick:d[0]||(d[0]=h=>{var v;return(v=o.value)==null?void 0:v.click()})},[s.createVNode(s.unref(gi),{class:"h-3.5 w-3.5 text-slate-600 dark:text-slate-300"})]),s.withDirectives(s.createElementVNode("input",{ref_key:"customInput",ref:o,"onUpdate:modelValue":d[1]||(d[1]=h=>a.value=h),type:"color",class:"sr-only",onChange:f},null,544),[[s.vModelText,a.value]]),s.createElementVNode("div",Pm,[s.createElementVNode("div",{class:"h-4 w-4 rounded-full",style:s.normalizeStyle({backgroundColor:a.value})},null,4)]),s.createElementVNode("button",{type:"button",class:"ml-auto flex h-6 items-center gap-1 rounded-md px-2 text-[11px] font-medium text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-700",onClick:c},[s.createVNode(s.unref(eu),{class:"h-3 w-3"}),d[2]||(d[2]=s.createTextVNode(" Default ",-1))])])])])):s.createCommentVNode("",!0)}}),Vm={id:"editor-toolbar-row",class:"docs-editor-toolbar w-full border-b border-slate-200 bg-white py-1.5 text-slate-600 shadow-sm dark:border-slate-800 dark:bg-[#0b1120] dark:text-slate-300"},Fm={class:"flex min-h-9 w-full items-center gap-1 px-3 flex-nowrap"},Um=["title","aria-label","disabled"],Hm=["title","aria-label","disabled"],jm=["title","aria-label"],qm=["title","aria-label","disabled"],$m=["title","aria-label"],Wm={class:"toolbar-dropdown relative flex-shrink-0"},Gm=["title","aria-label","disabled"],Km={class:"truncate"},Xm={key:0,class:"absolute left-0 top-full z-50 mt-1 min-w-[180px] rounded-lg border border-slate-200 bg-white py-1 text-sm shadow-xl dark:border-slate-700 dark:bg-[#0e1525]"},Jm=["disabled","onClick"],Zm={class:"toolbar-dropdown relative flex-shrink-0"},Qm=["title","aria-label","disabled"],Ym={class:"truncate"},eh={key:0,class:"absolute left-0 top-full z-50 mt-1 min-w-[160px] rounded-lg border border-slate-200 bg-white py-1 text-sm shadow-xl dark:border-slate-700 dark:bg-[#0e1525]"},th=["onClick"],ih=["title","aria-label","disabled"],nh=["value","title","aria-label","disabled","onKeydown"],rh=["title","aria-label","disabled"],ah=["title","aria-label","disabled","onClick"],oh={key:1,class:"text-xs font-medium leading-none"},sh={key:0,class:"mx-1 h-5 w-px flex-shrink-0 bg-slate-200 dark:bg-white/10"},lh={key:1,class:"toolbar-dropdown relative flex-shrink-0"},ch=["title","aria-label","disabled"],uh={key:2,class:"toolbar-dropdown relative flex-shrink-0"},fh=["title","aria-label","disabled"],ph={key:3,class:"mx-1 h-5 w-px flex-shrink-0 bg-slate-200 dark:bg-white/10"},dh={key:4,class:"toolbar-dropdown relative flex-shrink-0"},mh=["title","aria-label","disabled"],hh={key:0,class:"absolute left-0 top-full z-50 mt-1 min-w-[180px] rounded-lg border border-slate-200 bg-white py-1 text-sm shadow-xl dark:border-slate-700 dark:bg-[#0e1525]"},bh=["disabled","onClick"],gh={key:5,class:"toolbar-dropdown relative flex-shrink-0"},vh=["title","aria-label","disabled"],yh={key:0,class:"absolute left-0 top-full z-50 mt-1 min-w-[160px] rounded-lg border border-slate-200 bg-white py-1 text-sm shadow-xl dark:border-slate-700 dark:bg-[#0e1525]"},xh=["disabled","onClick"],kh={key:6,class:"toolbar-dropdown relative flex-shrink-0"},wh=["title","aria-label","disabled"],_h={class:"hidden md:inline"},Sh={key:0,class:"absolute left-0 top-full z-50 mt-1 min-w-[190px] rounded-lg border border-slate-200 bg-white py-1 text-sm shadow-xl dark:border-slate-700 dark:bg-[#0e1525]"},Ch=["disabled","onClick"],Eh=["title","aria-label"],Nh=["title","aria-label"],Ah=["title","aria-label"],Oh=["title","aria-label"],Th=["title","aria-label"],Mh="bg-slate-200 text-slate-900 dark:bg-slate-700 dark:text-slate-100",zh="text-slate-600 dark:text-slate-300 hover:text-slate-900 dark:hover:text-slate-100 hover:bg-slate-100 dark:hover:bg-white/5",bt="docs-editor-toolbar__control inline-flex h-8 flex-shrink-0 items-center justify-center rounded-md p-1 text-slate-600 transition-all disabled:opacity-40 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-white/5",Ih="bg-slate-200 text-slate-900 dark:bg-slate-700 dark:text-slate-100",Dh="text-slate-500 dark:text-slate-400 hover:text-slate-900 dark:hover:text-slate-100 hover:bg-slate-100 dark:hover:bg-white/5",vl=11,Rh=1,Lh=400,nu=s.defineComponent({__name:"EditorToolbar",props:{actions:{},plugins:{},editor:{},activeSidebar:{}},emits:["toggle-sidebar","print","undo","redo","toggle-left-sidebar"],setup(e,{emit:t}){const{t:i}=rt(),n=e,r=t,a={Bold:qc,Italic:Jc,Underline:tu,Strikethrough:Bd,Heading1:ud,Heading2:fd,Heading3:pd,Heading4:dd,Heading5:md,Heading6:hd,List:Gr,ListOrdered:gd,CheckSquare:Rd,Quote:Kr,Link:Qc,Code:ad,Image:bd,Table:Vd,AlignLeft:No,AlignCenter:dl,AlignRight:ml,AlignJustify:hl,FileText:sn,Palette:fl,Highlighter:ul};function o(K){return K?a[K]??null:null}const l=s.computed(()=>{const K=[];for(const I of n.plugins??[])!I.toolbar||I.toolbar.length===0||K.push({pluginId:I.id,items:I.toolbar});return K}),c=s.ref(0);function f(){c.value++}s.watch(()=>n.editor,(K,I)=>{I&&I.off("transaction",f),K&&K.on("transaction",f)},{immediate:!0}),s.onUnmounted(()=>{n.editor&&n.editor.off("transaction",f)});function p(K){c.value;const I=n.editor;if(!I)return!1;switch(K.action){case"toggleBold":return I.isActive("bold");case"toggleItalic":return I.isActive("italic");case"toggleUnderline":return I.isActive("underline");case"toggleStrike":return I.isActive("strike");case"toggleHeading1":return I.isActive("heading",{level:1});case"toggleHeading2":return I.isActive("heading",{level:2});case"toggleHeading3":return I.isActive("heading",{level:3});case"toggleHeading4":return I.isActive("heading",{level:4});case"toggleHeading5":return I.isActive("heading",{level:5});case"toggleHeading6":return I.isActive("heading",{level:6});case"toggleBulletList":return I.isActive("bulletList");case"toggleOrderedList":return I.isActive("orderedList");case"toggleTaskList":return I.isActive("taskList");case"toggleBlockquote":return I.isActive("blockquote");case"toggleCodeBlock":return I.isActive("codeBlock");case"setLink":return I.isActive("link");case"alignLeft":return I.isActive({textAlign:"left"});case"alignCenter":return I.isActive({textAlign:"center"});case"alignRight":return I.isActive({textAlign:"right"});case"alignJustify":return I.isActive({textAlign:"justify"});default:return!1}}function m(K){if(!n.editor)return;const I=n.actions[K.action];if(typeof I=="function"){I(...K.args??[]),n.editor.commands.focus();return}const J=n.editor.commands[K.action];typeof J=="function"&&(J(...K.args??[]),n.editor.commands.focus())}const d=s.computed(()=>{var K;return c.value,(K=n.editor)==null?void 0:K.getAttributes("textStyle").color}),h=s.computed(()=>{var I,J;c.value;const K=(I=n.editor)==null?void 0:I.getAttributes("highlight");if(K!=null&&K.color)return K.color;if((J=n.editor)!=null&&J.isActive("highlight"))return"#ffff00"});function v(K,I){var ze,Ue,qe;const J=n.actions[K];if(typeof J=="function")J(I);else{const Ht=(Ue=(ze=n.editor)==null?void 0:ze.commands)==null?void 0:Ue[K];typeof Ht=="function"&&Ht(I)}(qe=n.editor)==null||qe.commands.focus(),M.value=null}function b(K){var J,ze,Ue,qe;const I=(J=n.editor)==null?void 0:J.chain().focus();if(!I){M.value=null;return}K==="setTextColor"?(ze=I.unsetColor)==null||ze.call(I).run():K==="setHighlight"&&((Ue=I.unsetHighlight)==null||Ue.call(I).run()),(qe=n.editor)==null||qe.commands.focus(),M.value=null}const y=["toggleHeading1","toggleHeading2","toggleHeading3","toggleHeading4","toggleHeading5","toggleHeading6"],g=["alignLeft","alignCenter","alignRight","alignJustify"],x=["toggleBulletList","toggleOrderedList","toggleTaskList"],k=["setLink","insertImage","insertTable","toggleBlockquote","toggleCodeBlock","insertFootnote","insertPageBreak","setPageBreak","togglePageBreak","addPageBreak"],w=["setTextColor","setHighlight"],C=s.computed(()=>l.value.flatMap(K=>K.items)),E=s.computed(()=>C.value.filter(K=>g.includes(K.action))),B=s.computed(()=>C.value.filter(K=>x.includes(K.action))),_=s.computed(()=>C.value.filter(K=>k.includes(K.action))),S=s.computed(()=>C.value.filter(K=>w.includes(K.action))),T=s.computed(()=>S.value.find(K=>K.action==="setTextColor")),D=s.computed(()=>S.value.find(K=>K.action==="setHighlight")),H=s.computed(()=>C.value.filter(K=>!y.includes(K.action)&&!g.includes(K.action)&&!x.includes(K.action)&&!k.includes(K.action)&&!w.includes(K.action))),V=s.computed(()=>{c.value;const K=n.editor;if(K){if(K.isActive({textAlign:"center"}))return dl;if(K.isActive({textAlign:"right"}))return ml;if(K.isActive({textAlign:"justify"}))return hl}return No}),M=s.ref(null);function $(K){M.value=M.value===K?null:K}function P(K){m(K),M.value=null}function W(K){K.target.closest(".toolbar-dropdown")||(M.value=null)}s.onMounted(()=>document.addEventListener("click",W,!0)),s.onUnmounted(()=>document.removeEventListener("click",W,!0));function L(K){return n.activeSidebar===K?Ih:Dh}const Q=s.computed(()=>{var K;return((K=n.plugins)==null?void 0:K.some(I=>I.id==="citation"))??!1}),j=s.computed(()=>{var K,I,J;return!!((J=(I=(K=n.editor)==null?void 0:K.storage)==null?void 0:I.editorContext)!=null&&J.aiStream)});function O(){n.editor&&(n.editor.commands.undo(),n.editor.commands.focus()),r("undo")}function R(){n.editor&&(n.editor.commands.redo(),n.editor.commands.focus()),r("redo")}function U(){r("print")}const oe=s.computed(()=>[{value:"paragraph",label:i("toolbar.normalText")},{value:"heading-1",label:i("header.heading1")},{value:"heading-2",label:i("header.heading2")},{value:"heading-3",label:i("header.heading3")},{value:"heading-4",label:i("header.heading4")},{value:"heading-5",label:i("header.heading5")},{value:"heading-6",label:i("header.heading6")}]);function ie(K){const I=n.editor;if(I){if(K==="paragraph")I.commands.setParagraph();else{const J=parseInt(K.replace("heading-",""),10),ze=n.actions[`toggleHeading${J}`];typeof ze=="function"?ze():I.commands.toggleHeading({level:J})}I.commands.focus()}M.value=null}const ee=s.computed(()=>{c.value;const K=n.editor;if(!K)return"paragraph";for(let I=1;I<=6;I++)if(K.isActive("heading",{level:I}))return`heading-${I}`;return"paragraph"}),te=s.computed(()=>{var K;return((K=oe.value.find(I=>I.value===ee.value))==null?void 0:K.label)??i("toolbar.normalText")}),X=[{value:"arial",label:"Arial"},{value:"inter",label:"Inter"},{value:"serif",label:"Serif"},{value:"mono",label:"Monospace"}],F=s.ref("arial"),q=s.computed(()=>{var K;return((K=X.find(I=>I.value===F.value))==null?void 0:K.label)??"Arial"});function ne(K){var I;F.value=K,M.value=null,(I=n.editor)==null||I.commands.focus()}const se=[8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72],Se=s.computed(()=>{var ze;c.value;const K=n.editor;if(!K)return vl;const I=K.getAttributes("textStyle");if(I!=null&&I.fontSize){const Ue=parseInt(I.fontSize,10);if(!isNaN(Ue))return Ue}const J=K.state.storedMarks;if(J){for(const Ue of J)if(Ue.type.name==="textStyle"&&Ue.attrs.fontSize){const qe=parseInt(Ue.attrs.fontSize,10);if(!isNaN(qe))return qe}}if((ze=K.view)!=null&&ze.dom){const Ue=parseFloat(getComputedStyle(K.view.dom).fontSize);if(!isNaN(Ue)){const qe=Math.round(Ue);return se.reduce((pt,dt)=>Math.abs(dt-qe)<Math.abs(pt-qe)?dt:pt)}}return vl});function Ae(K){if(!n.editor)return;const I=Se.value,J=se.indexOf(I);let ze;J>=0?ze=se[Math.min(Math.max(J+K,0),se.length-1)]:K<0?ze=[...se].reverse().find(qe=>qe<I)??se[0]:ze=se.find(qe=>qe>I)??I,n.editor.commands.setFontSize(`${ze}px`),n.editor.commands.focus()}const fe=s.ref(null);function ke(K){fe.value=String(Se.value),K.target.select()}function G(K){fe.value=K.target.value}function yt(K){if(!n.editor)return;const I=Math.min(Math.max(K,Rh),Lh);n.editor.commands.setFontSize(`${I}px`)}function we(K){var J;const I=parseInt(K.target.value,10);!isNaN(I)&&I!==Se.value&&yt(I),fe.value=null,(J=n.editor)==null||J.commands.focus()}function At(K){var J;fe.value=null;const I=K.target;I.value=String(Se.value),I.blur(),(J=n.editor)==null||J.commands.focus()}return(K,I)=>(s.openBlock(),s.createElementBlock("div",Vm,[s.createElementVNode("div",Fm,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-8"]),title:s.unref(i)("toolbar.undo"),"aria-label":s.unref(i)("toolbar.undo"),disabled:!e.editor,onMousedown:I[0]||(I[0]=s.withModifiers(()=>{},["prevent"])),onClick:O},[s.createVNode(s.unref(Fd),{class:"h-[18px] w-[18px]"})],42,Um),s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-8"]),title:s.unref(i)("toolbar.redo"),"aria-label":s.unref(i)("toolbar.redo"),disabled:!e.editor,onMousedown:I[1]||(I[1]=s.withModifiers(()=>{},["prevent"])),onClick:R},[s.createVNode(s.unref(Ad),{class:"h-[18px] w-[18px]"})],42,Hm),I[39]||(I[39]=s.createElementVNode("span",{class:"mx-1 h-5 w-px flex-shrink-0 bg-slate-200 dark:bg-white/10"},null,-1)),s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-8"]),title:s.unref(i)("toolbar.print"),"aria-label":s.unref(i)("toolbar.print"),onMousedown:I[2]||(I[2]=s.withModifiers(()=>{},["prevent"])),onClick:U},[s.createVNode(s.unref(Nd),{class:"h-[18px] w-[18px]"})],42,jm),s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-8"]),title:s.unref(i)("toolbar.spelling"),"aria-label":s.unref(i)("toolbar.spelling"),disabled:!e.editor,onMousedown:I[3]||(I[3]=s.withModifiers(()=>{},["prevent"]))},[s.createVNode(s.unref(Dd),{class:"h-[18px] w-[18px]"})],42,qm),s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"px-2 text-xs"]),title:s.unref(i)("toolbar.zoom"),"aria-label":s.unref(i)("toolbar.zoom"),onMousedown:I[4]||(I[4]=s.withModifiers(()=>{},["prevent"]))},s.toDisplayString(s.unref(i)("toolbar.zoom")),43,$m),I[40]||(I[40]=s.createElementVNode("span",{class:"mx-1 h-5 w-px flex-shrink-0 bg-slate-200 dark:bg-white/10"},null,-1)),s.createElementVNode("div",Wm,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-[116px] justify-between gap-1 px-2 text-xs font-medium"]),title:s.unref(i)("toolbar.paragraphStyle"),"aria-label":s.unref(i)("toolbar.paragraphStyle"),disabled:!e.editor,onMousedown:I[5]||(I[5]=s.withModifiers(()=>{},["prevent"])),onClick:I[6]||(I[6]=s.withModifiers(J=>$("heading"),["stop"]))},[s.createElementVNode("span",Km,s.toDisplayString(te.value),1),s.createVNode(s.unref(ei),{class:"h-3.5 w-3.5 flex-shrink-0 text-slate-400"})],42,Gm),M.value==="heading"?(s.openBlock(),s.createElementBlock("div",Xm,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(oe.value,J=>(s.openBlock(),s.createElementBlock("button",{key:J.value,type:"button",class:s.normalizeClass(["flex w-full items-center px-3 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-white/5",ee.value===J.value?"text-blue-600 dark:text-blue-300":"text-slate-700 dark:text-slate-200"]),disabled:!e.editor,onMousedown:I[7]||(I[7]=s.withModifiers(()=>{},["prevent"])),onClick:ze=>ie(J.value)},s.toDisplayString(J.label),43,Jm))),128))])):s.createCommentVNode("",!0)]),s.createElementVNode("div",Zm,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-[100px] justify-between gap-1 px-2 text-xs font-medium"]),title:s.unref(i)("toolbar.fontFamily"),"aria-label":s.unref(i)("toolbar.fontFamily"),disabled:!e.editor,onMousedown:I[8]||(I[8]=s.withModifiers(()=>{},["prevent"])),onClick:I[9]||(I[9]=s.withModifiers(J=>$("font"),["stop"]))},[s.createElementVNode("span",Ym,s.toDisplayString(q.value),1),s.createVNode(s.unref(ei),{class:"h-3.5 w-3.5 flex-shrink-0 text-slate-400"})],42,Qm),M.value==="font"?(s.openBlock(),s.createElementBlock("div",eh,[(s.openBlock(),s.createElementBlock(s.Fragment,null,s.renderList(X,J=>s.createElementVNode("button",{key:J.value,type:"button",class:s.normalizeClass(["flex w-full items-center px-3 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-white/5",F.value===J.value?"text-blue-600 dark:text-blue-300":"text-slate-700 dark:text-slate-200"]),onMousedown:I[10]||(I[10]=s.withModifiers(()=>{},["prevent"])),onClick:ze=>ne(J.value)},s.toDisplayString(J.label),43,th)),64))])):s.createCommentVNode("",!0)]),s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-7 text-sm"]),title:s.unref(i)("toolbar.decreaseFontSize"),"aria-label":s.unref(i)("toolbar.decreaseFontSize"),disabled:!e.editor,onMousedown:I[11]||(I[11]=s.withModifiers(J=>Ae(-1),["prevent"]))},[s.createVNode(s.unref(_d),{class:"h-3.5 w-3.5"})],42,ih),s.createElementVNode("input",{type:"text",inputmode:"numeric",class:"h-8 w-8 flex-shrink-0 rounded border border-transparent bg-transparent text-center text-xs text-slate-700 outline-none transition hover:border-slate-300 focus:border-cyan-400 focus:bg-white disabled:opacity-40 dark:text-slate-200 dark:hover:border-slate-600 dark:focus:bg-slate-800",value:fe.value??String(Se.value),title:s.unref(i)("toolbar.fontSize"),"aria-label":s.unref(i)("toolbar.fontSize"),disabled:!e.editor,onFocus:ke,onInput:G,onKeydown:[I[12]||(I[12]=s.withKeys(s.withModifiers(J=>J.target.blur(),["prevent"]),["enter"])),s.withKeys(s.withModifiers(At,["prevent"]),["esc"])],onBlur:we},null,40,nh),s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-7 text-sm"]),title:s.unref(i)("toolbar.increaseFontSize"),"aria-label":s.unref(i)("toolbar.increaseFontSize"),disabled:!e.editor,onMousedown:I[13]||(I[13]=s.withModifiers(J=>Ae(1),["prevent"]))},[s.createVNode(s.unref(gi),{class:"h-3.5 w-3.5"})],42,rh),I[41]||(I[41]=s.createElementVNode("span",{class:"mx-1 h-5 w-px flex-shrink-0 bg-slate-200 dark:bg-white/10"},null,-1)),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(H.value,J=>(s.openBlock(),s.createElementBlock("button",{key:J.id,type:"button",title:J.label??J.id,"aria-label":J.label??J.id,class:s.normalizeClass(["docs-editor-toolbar__button inline-flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-md p-1 transition-all disabled:opacity-40",p(J)?Mh:zh]),disabled:!e.editor,onMousedown:I[14]||(I[14]=s.withModifiers(()=>{},["prevent"])),onClick:ze=>m(J)},[o(J.iconComponent)?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(o(J.iconComponent)),{key:0,class:"h-[18px] w-[18px]"})):J.label?(s.openBlock(),s.createElementBlock("span",oh,s.toDisplayString(J.label.charAt(0)),1)):s.createCommentVNode("",!0)],42,ah))),128)),S.value.length?(s.openBlock(),s.createElementBlock("span",sh)):s.createCommentVNode("",!0),T.value?(s.openBlock(),s.createElementBlock("div",lh,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-8"]),title:T.value.label??"Text color","aria-label":T.value.label??"Text color",disabled:!e.editor,onMousedown:I[15]||(I[15]=s.withModifiers(()=>{},["prevent"])),onClick:I[16]||(I[16]=s.withModifiers(J=>$("textColor"),["stop"]))},[s.createVNode(s.unref(fl),{class:"h-[18px] w-[18px]"})],42,ch),s.createVNode(gl,{"is-open":M.value==="textColor","active-color":d.value,label:"Custom",onSelect:I[17]||(I[17]=J=>v("setTextColor",J)),onReset:I[18]||(I[18]=J=>b("setTextColor")),onClose:I[19]||(I[19]=J=>M.value=null)},null,8,["is-open","active-color"])])):s.createCommentVNode("",!0),D.value?(s.openBlock(),s.createElementBlock("div",uh,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-8"]),title:D.value.label??"Highlight","aria-label":D.value.label??"Highlight",disabled:!e.editor,onMousedown:I[20]||(I[20]=s.withModifiers(()=>{},["prevent"])),onClick:I[21]||(I[21]=s.withModifiers(J=>$("highlight"),["stop"]))},[s.createVNode(s.unref(ul),{class:"h-[18px] w-[18px]"})],42,fh),s.createVNode(gl,{"is-open":M.value==="highlight","active-color":h.value,label:"Custom",onSelect:I[22]||(I[22]=J=>v("setHighlight",J)),onReset:I[23]||(I[23]=J=>b("setHighlight")),onClose:I[24]||(I[24]=J=>M.value=null)},null,8,["is-open","active-color"])])):s.createCommentVNode("",!0),B.value.length||E.value.length||_.value.length?(s.openBlock(),s.createElementBlock("span",ph)):s.createCommentVNode("",!0),B.value.length?(s.openBlock(),s.createElementBlock("div",dh,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"gap-0.5 px-1.5"]),title:s.unref(i)("toolbar.lists"),"aria-label":s.unref(i)("toolbar.lists"),disabled:!e.editor,onMousedown:I[25]||(I[25]=s.withModifiers(()=>{},["prevent"])),onClick:I[26]||(I[26]=s.withModifiers(J=>$("lists"),["stop"]))},[s.createVNode(s.unref(Gr),{class:"h-[18px] w-[18px]"}),s.createVNode(s.unref(ei),{class:"h-3 w-3 text-slate-400"})],42,mh),M.value==="lists"?(s.openBlock(),s.createElementBlock("div",hh,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(B.value,J=>(s.openBlock(),s.createElementBlock("button",{key:J.id,type:"button",class:s.normalizeClass(["flex w-full items-center gap-2.5 px-3 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-white/5",p(J)?"text-blue-600 dark:text-blue-300":"text-slate-700 dark:text-slate-200"]),disabled:!e.editor,onMousedown:I[27]||(I[27]=s.withModifiers(()=>{},["prevent"])),onClick:ze=>P(J)},[o(J.iconComponent)?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(o(J.iconComponent)),{key:0,class:"h-4 w-4"})):s.createCommentVNode("",!0),s.createElementVNode("span",null,s.toDisplayString(J.label??J.id),1)],42,bh))),128))])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),E.value.length?(s.openBlock(),s.createElementBlock("div",gh,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"gap-0.5 px-1.5"]),title:s.unref(i)("toolbar.alignment"),"aria-label":s.unref(i)("toolbar.alignment"),disabled:!e.editor,onMousedown:I[28]||(I[28]=s.withModifiers(()=>{},["prevent"])),onClick:I[29]||(I[29]=s.withModifiers(J=>$("align"),["stop"]))},[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(V.value),{class:"h-[18px] w-[18px]"})),s.createVNode(s.unref(ei),{class:"h-3 w-3 text-slate-400"})],42,vh),M.value==="align"?(s.openBlock(),s.createElementBlock("div",yh,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(E.value,J=>(s.openBlock(),s.createElementBlock("button",{key:J.id,type:"button",class:s.normalizeClass(["flex w-full items-center gap-2.5 px-3 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-white/5",p(J)?"text-blue-600 dark:text-blue-300":"text-slate-700 dark:text-slate-200"]),disabled:!e.editor,onMousedown:I[30]||(I[30]=s.withModifiers(()=>{},["prevent"])),onClick:ze=>P(J)},[o(J.iconComponent)?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(o(J.iconComponent)),{key:0,class:"h-4 w-4"})):s.createCommentVNode("",!0),s.createElementVNode("span",null,s.toDisplayString(J.label??J.id),1)],42,xh))),128))])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),_.value.length?(s.openBlock(),s.createElementBlock("div",kh,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"gap-1 px-2 text-xs font-medium"]),title:s.unref(i)("toolbar.insert"),"aria-label":s.unref(i)("toolbar.insert"),disabled:!e.editor,onMousedown:I[31]||(I[31]=s.withModifiers(()=>{},["prevent"])),onClick:I[32]||(I[32]=s.withModifiers(J=>$("insert"),["stop"]))},[s.createVNode(s.unref(gi),{class:"h-4 w-4"}),s.createElementVNode("span",_h,s.toDisplayString(s.unref(i)("toolbar.insert")),1),s.createVNode(s.unref(ei),{class:"h-3 w-3 text-slate-400"})],42,wh),M.value==="insert"?(s.openBlock(),s.createElementBlock("div",Sh,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(_.value,J=>(s.openBlock(),s.createElementBlock("button",{key:J.id,type:"button",class:s.normalizeClass(["flex w-full items-center gap-2.5 px-3 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-white/5",p(J)?"text-blue-600 dark:text-blue-300":"text-slate-700 dark:text-slate-200"]),disabled:!e.editor,onMousedown:I[33]||(I[33]=s.withModifiers(()=>{},["prevent"])),onClick:ze=>P(J)},[o(J.iconComponent)?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(o(J.iconComponent)),{key:0,class:"h-4 w-4"})):s.createCommentVNode("",!0),s.createElementVNode("span",null,s.toDisplayString(J.label??J.id),1)],42,Ch))),128))])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),I[42]||(I[42]=s.createElementVNode("span",{class:"mx-1 h-5 w-px flex-shrink-0 bg-slate-200 dark:bg-white/10"},null,-1)),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["docs-editor-toolbar__control flex h-8 w-8 items-center justify-center rounded-md transition-all relative",L("comments")]),title:s.unref(i)("toolbar.comments"),"aria-label":s.unref(i)("toolbar.comments"),onClick:I[34]||(I[34]=J=>r("toggle-sidebar","comments"))},[s.createVNode(s.unref(Yc),{class:"h-[18px] w-[18px]"})],10,Eh),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["docs-editor-toolbar__control flex h-8 w-8 items-center justify-center rounded-md transition-all",L("history")]),title:s.unref(i)("toolbar.history"),"aria-label":s.unref(i)("toolbar.history"),onClick:I[35]||(I[35]=J=>r("toggle-sidebar","history"))},[s.createVNode(s.unref(Xc),{class:"h-[18px] w-[18px]"})],10,Nh),j.value?(s.openBlock(),s.createElementBlock("button",{key:7,type:"button",class:s.normalizeClass(["docs-editor-toolbar__control flex h-8 w-8 items-center justify-center rounded-md transition-all",L("ai")]),title:s.unref(i)("toolbar.ai"),"aria-label":s.unref(i)("toolbar.ai"),onClick:I[36]||(I[36]=J=>r("toggle-sidebar","ai"))},[s.createVNode(s.unref(on),{class:"h-[18px] w-[18px]"})],10,Ah)):s.createCommentVNode("",!0),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["docs-editor-toolbar__control flex h-8 w-8 items-center justify-center rounded-md transition-all",L("toc")]),title:s.unref(i)("toolbar.tableOfContents"),"aria-label":s.unref(i)("toolbar.tableOfContents"),onClick:I[37]||(I[37]=J=>r("toggle-sidebar","toc"))},[s.createVNode(s.unref(sn),{class:"h-[18px] w-[18px]"})],10,Oh),Q.value?(s.openBlock(),s.createElementBlock("button",{key:8,type:"button",class:s.normalizeClass(["docs-editor-toolbar__control flex h-8 w-8 items-center justify-center rounded-md transition-all",L("references")]),title:s.unref(i)("toolbar.references"),"aria-label":s.unref(i)("toolbar.references"),onClick:I[38]||(I[38]=J=>r("toggle-sidebar","references"))},[s.createVNode(s.unref(Co),{class:"h-[18px] w-[18px]"})],10,Th)):s.createCommentVNode("",!0)])]))}}),Bh={key:0,class:"flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-semibold text-cyan-600 dark:text-cyan-400"},Ph=["title"],Vh=["disabled"],Fh=["onClick"],Uh={key:0,class:"relative"},Hh={key:0,class:"absolute left-0 top-full z-10 mt-1 flex min-w-44 flex-col rounded-xl border border-slate-200 bg-white p-1 shadow-2xl dark:border-white/10 dark:bg-[#0c1329]"},jh=["onClick"],yl="bg-cyan-500/15 text-cyan-600 dark:text-cyan-400 font-bold",qh="text-slate-600 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-white/5 hover:text-slate-900 dark:hover:text-white",$h=s.defineComponent({__name:"BubbleMenu",props:{visible:{type:Boolean},actions:{},position:{},editor:{}},setup(e){const t=e,i=s.ref(0),n=s.ref(!1);function r(){i.value++}s.watch(()=>t.editor,(b,y)=>{y&&y.off("transaction",r),b&&b.on("transaction",r)},{immediate:!0}),s.onUnmounted(()=>{t.editor&&t.editor.off("transaction",r)}),s.watch(i,()=>{n.value=!1});const a=s.computed(()=>{var b,y,g,x;return i.value,[{id:"bold",label:"Bold",action:"toggleBold",icon:qc,active:(b=t.editor)==null?void 0:b.isActive("bold")},{id:"italic",label:"Italic",action:"toggleItalic",icon:Jc,active:(y=t.editor)==null?void 0:y.isActive("italic")},{id:"underline",label:"Underline",action:"toggleUnderline",icon:tu,active:(g=t.editor)==null?void 0:g.isActive("underline")},{id:"link",label:"Link",action:"setLink",icon:Qc,active:(x=t.editor)==null?void 0:x.isActive("link")}]}),o=s.computed(()=>{var b,y,g;return i.value,!!((g=(y=(b=t.editor)==null?void 0:b.storage)==null?void 0:y.editorContext)!=null&&g.aiStream)}),l=s.computed(()=>{var b,y,g;return i.value,((g=(y=(b=t.editor)==null?void 0:b.storage)==null?void 0:y.ai)==null?void 0:g.preview)??null}),c=[{id:"rewrite",label:"Rewrite",action:"rewrite"},{id:"summarize",label:"Summarize",action:"summarize"},{id:"grammar",label:"Fix grammar",action:"grammar"},{id:"tone",label:"Make formal",action:"tone",prompt:"make it more formal"},{id:"translate",label:"Translate to English",action:"translate",prompt:"translate to English"},{id:"expand",label:"Expand",action:"expand"},{id:"shorten",label:"Shorten",action:"shorten"}];function f(){var b;return((b=t.editor)==null?void 0:b.commands)??null}function p(b){var y;n.value=!1,(y=f())==null||y.aiTransform({action:b.action,...b.prompt?{prompt:b.prompt}:{}})}function m(){var b;(b=f())==null||b.aiAccept()}function d(){var b;(b=f())==null||b.aiReject()}const h=s.computed(()=>t.position?{top:`${t.position.top}px`,left:`${t.position.left}px`}:{});function v(b){var g,x,k,w,C;if(b==="setLink"){if((g=t.editor)!=null&&g.isActive("link")){t.editor.chain().focus().unsetLink().run();return}const E=typeof window<"u"?window.prompt("Enter link URL:","https://"):null;if(E){const B=t.actions[b];typeof B=="function"?B({href:E,target:"_blank"}):(w=(k=(x=t.editor)==null?void 0:x.chain().focus()).setLink)==null||w.call(k,{href:E,target:"_blank"}).run()}return}const y=t.actions[b];if(typeof y=="function")y();else if(t.editor){const E=t.editor.chain().focus();(C=E[b])==null||C.call(E).run()}}return(b,y)=>e.visible?(s.openBlock(),s.createElementBlock("div",{key:0,"data-testid":"bubble-menu",class:"docs-editor-bubble-menu fixed z-50 flex gap-1 rounded-xl border border-slate-200 bg-white p-1.5 shadow-2xl dark:border-white/10 dark:bg-[#0c1329]",style:s.normalizeStyle(h.value),onMousedown:y[1]||(y[1]=s.withModifiers(()=>{},["prevent"]))},[l.value?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[l.value.status==="streaming"?(s.openBlock(),s.createElementBlock("span",Bh,[s.createVNode(s.unref(vd),{class:"h-3.5 w-3.5 animate-spin"}),y[2]||(y[2]=s.createElementVNode("span",null,"AI writing…",-1))])):l.value.status==="error"?(s.openBlock(),s.createElementBlock("span",{key:1,class:"flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-semibold text-red-600 dark:text-red-400",title:l.value.error},[s.createVNode(s.unref(id),{class:"h-3.5 w-3.5"}),y[3]||(y[3]=s.createElementVNode("span",null,"AI error",-1))],8,Ph)):s.createCommentVNode("",!0),s.createElementVNode("button",{type:"button",disabled:l.value.status!=="done",class:s.normalizeClass(["docs-editor-bubble-menu__button flex items-center gap-1 rounded-lg px-2.5 py-1.5 text-xs font-semibold transition-all",l.value.status!=="done"?"cursor-not-allowed text-slate-300 dark:text-slate-600":"text-emerald-600 hover:bg-emerald-50 dark:text-emerald-400 dark:hover:bg-emerald-500/10"]),title:"Accept (Enter)",onClick:m},[s.createVNode(s.unref(Wr),{class:"h-3.5 w-3.5"}),y[4]||(y[4]=s.createElementVNode("span",null,"Accept",-1))],10,Vh),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["docs-editor-bubble-menu__button flex items-center gap-1 rounded-lg px-2.5 py-1.5 text-xs font-semibold transition-all","text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-500/10"]),title:"Reject (Esc)",onClick:d},[s.createVNode(s.unref(Dt),{class:"h-3.5 w-3.5"}),y[5]||(y[5]=s.createElementVNode("span",null,"Reject",-1))])],64)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(a.value,g=>(s.openBlock(),s.createElementBlock("button",{key:g.id,type:"button",class:s.normalizeClass(["docs-editor-bubble-menu__button flex items-center gap-1 rounded-lg px-2.5 py-1.5 text-xs font-semibold transition-all",g.active?yl:qh]),onClick:x=>v(g.action)},[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(g.icon),{class:"h-3.5 w-3.5"})),s.createElementVNode("span",null,s.toDisplayString(g.label),1)],10,Fh))),128)),o.value?(s.openBlock(),s.createElementBlock("div",Uh,[s.createElementVNode("button",{type:"button",class:s.normalizeClass(["docs-editor-bubble-menu__button flex items-center gap-1 rounded-lg px-2.5 py-1.5 text-xs font-semibold transition-all",n.value?yl:"text-cyan-600 hover:bg-cyan-50 dark:text-cyan-400 dark:hover:bg-cyan-500/10"]),onClick:y[0]||(y[0]=g=>n.value=!n.value)},[s.createVNode(s.unref(on),{class:"h-3.5 w-3.5"}),y[6]||(y[6]=s.createElementVNode("span",null,"AI",-1))],2),n.value?(s.openBlock(),s.createElementBlock("div",Hh,[(s.openBlock(),s.createElementBlock(s.Fragment,null,s.renderList(c,g=>s.createElementVNode("button",{key:g.id,type:"button",class:"flex items-center gap-2 rounded-lg px-3 py-1.5 text-left text-xs font-semibold text-slate-600 transition-all hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-white/5 dark:hover:text-white",onClick:x=>p(g)},[s.createElementVNode("span",null,s.toDisplayString(g.label),1)],8,jh)),64))])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)],64))],36)):s.createCommentVNode("",!0)}}),ru=cs($h,[["__scopeId","data-v-e75fb4f8"]]),Wh={id:"editor-footer-row",class:"flex h-9 flex-shrink-0 items-center justify-between border-t border-slate-200 bg-white px-4 font-sans text-[11px] text-slate-400 dark:border-slate-800 dark:bg-[#0b1120]"},Gh={class:"flex items-center gap-2"},Kh={class:"flex items-center gap-1 font-bold"},Xh={key:0,class:"relative mr-1 flex h-2 w-2"},Jh={key:1,class:"relative mr-1 flex h-2 w-2"},Zh={key:2,class:"font-mono text-[10px] uppercase tracking-wide text-emerald-600 dark:text-cyan-400"},Qh={key:3,class:"font-mono text-[10px] uppercase tracking-wide text-amber-600 dark:text-amber-500"},Yh={class:"flex items-center gap-1.5 font-sans text-[11px] font-medium text-slate-500 dark:text-slate-400"},eb={key:0,class:"animate-pulse font-semibold text-cyan-600 dark:text-cyan-400"},tb={key:1,class:"font-semibold text-amber-600 dark:text-amber-500"},ib={key:2,class:"flex items-center gap-1"},nb={class:"rounded bg-slate-100 px-1.5 py-0.5 font-mono text-[10px] text-slate-700 dark:bg-white/5 dark:text-slate-300"},rb={class:"flex items-center gap-3 font-semibold text-slate-400 dark:text-slate-500"},ab=["value","title","aria-label"],ob=["value"],sb={key:0,class:"font-medium text-slate-500 dark:text-slate-400"},lb={key:1},cb={class:"font-mono text-slate-600 dark:text-slate-300"},ub={class:"font-mono text-slate-600 dark:text-slate-300"},fb={class:"font-mono text-slate-600 dark:text-slate-300"},pb={class:"font-mono text-slate-600 dark:text-slate-300"},au=s.defineComponent({__name:"StatusBar",props:{connectionState:{default:"connected"},savingStatus:{default:"saved"},lastSaved:{default:void 0},wordCount:{default:0},charCount:{default:0},pageCount:{default:1},currentPage:{default:1},pageSize:{default:"a4"},pageSizes:{default:()=>[]},pageless:{type:Boolean,default:!1}},emits:["update:pageSize"],setup(e,{emit:t}){const{t:i}=rt(),n=e,r=t,a=s.computed(()=>n.lastSaved?new Date(n.lastSaved).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}):i("statusBar.never")),o=s.computed(()=>{var l,c;return((c=(l=n.pageSizes)==null?void 0:l.find(f=>f.id===n.pageSize))==null?void 0:c.name)??n.pageSize.toUpperCase()});return(l,c)=>(s.openBlock(),s.createElementBlock("footer",Wh,[s.createElementVNode("div",Gh,[s.createElementVNode("span",Kh,[e.connectionState==="connected"?(s.openBlock(),s.createElementBlock("span",Xh,[...c[1]||(c[1]=[s.createElementVNode("span",{class:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75"},null,-1),s.createElementVNode("span",{class:"relative inline-flex h-2 w-2 rounded-full bg-emerald-500"},null,-1)])])):(s.openBlock(),s.createElementBlock("span",Jh,[...c[2]||(c[2]=[s.createElementVNode("span",{class:"h-2 w-2 animate-spin rounded-full border border-amber-500 border-t-transparent"},null,-1)])])),e.connectionState==="connected"?(s.openBlock(),s.createElementBlock("span",Zh,s.toDisplayString(s.unref(i)("statusBar.liveSyncActive")),1)):(s.openBlock(),s.createElementBlock("span",Qh,s.toDisplayString(s.unref(i)("statusBar.connecting")),1))]),c[3]||(c[3]=s.createElementVNode("span",{class:"text-slate-200 dark:text-white/10"},"|",-1)),s.createElementVNode("span",Yh,[s.createVNode(s.unref(Od),{class:s.normalizeClass(["h-3 w-3",e.savingStatus==="saving"?"animate-spin text-cyan-500":"text-emerald-500"])},null,8,["class"]),e.savingStatus==="saving"?(s.openBlock(),s.createElementBlock("span",eb,s.toDisplayString(s.unref(i)("statusBar.saving")),1)):e.savingStatus==="offline"?(s.openBlock(),s.createElementBlock("span",tb,s.toDisplayString(s.unref(i)("statusBar.offline")),1)):(s.openBlock(),s.createElementBlock("span",ib,[s.createElementVNode("span",null,s.toDisplayString(s.unref(i)("statusBar.lastSavedAt")),1),s.createElementVNode("strong",nb,s.toDisplayString(a.value),1)]))])]),s.createElementVNode("div",rb,[s.createElementVNode("select",{value:e.pageSize,title:o.value,class:"h-6 cursor-pointer rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[11px] font-medium text-slate-600 outline-none hover:border-slate-300 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300","aria-label":s.unref(i)("statusBar.pageSize"),onChange:c[0]||(c[0]=f=>r("update:pageSize",f.target.value))},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.pageSizes,f=>(s.openBlock(),s.createElementBlock("option",{key:f.id,value:f.id},s.toDisplayString(f.name),9,ob))),128))],40,ab),c[4]||(c[4]=s.createElementVNode("span",{class:"text-slate-200 dark:text-white/10"},"•",-1)),e.pageless?(s.openBlock(),s.createElementBlock("span",sb,s.toDisplayString(s.unref(i)("statusBar.pageless")),1)):(s.openBlock(),s.createElementBlock("span",lb,[s.createTextVNode(s.toDisplayString(s.unref(i)("statusBar.page"))+" ",1),s.createElementVNode("strong",cb,s.toDisplayString(e.currentPage),1),s.createTextVNode(" "+s.toDisplayString(s.unref(i)("statusBar.of"))+" ",1),s.createElementVNode("strong",ub,s.toDisplayString(e.pageCount),1)])),c[5]||(c[5]=s.createElementVNode("span",{class:"text-slate-200 dark:text-white/10"},"•",-1)),s.createElementVNode("span",null,[s.createElementVNode("strong",fb,s.toDisplayString(e.wordCount),1),s.createTextVNode(" "+s.toDisplayString(s.unref(i)("statusBar.words")),1)]),c[6]||(c[6]=s.createElementVNode("span",{class:"text-slate-200 dark:text-white/10"},"•",-1)),s.createElementVNode("span",null,[s.createElementVNode("strong",pb,s.toDisplayString(e.charCount),1),s.createTextVNode(" "+s.toDisplayString(s.unref(i)("statusBar.characters")),1)])])]))}}),db={class:"docs-editor-ruler relative h-6 w-full flex-shrink-0 overflow-hidden border-b border-slate-200 bg-slate-50 dark:border-slate-800 dark:bg-[#0a0f1e]"},mb={class:"absolute inset-x-0 top-2.5 h-full"},hb={key:0,class:"absolute -top-2 left-0.5 text-[9px] text-slate-400"},bb=s.defineComponent({__name:"RulerBar",props:{layoutOptions:{}},setup(e){const t=e,i=s.computed(()=>{var o,l;return{pageWidth:((o=t.layoutOptions)==null?void 0:o.pageWidth)??794,margins:((l=t.layoutOptions)==null?void 0:l.margins)??{top:96,bottom:96,left:96,right:96}}}),n=s.computed(()=>{const o=Math.floor(i.value.pageWidth/48);return Array.from({length:o+1},(l,c)=>c*48)}),r=s.computed(()=>`${i.value.margins.left}px`),a=s.computed(()=>`${i.value.pageWidth-i.value.margins.right}px`);return(o,l)=>(s.openBlock(),s.createElementBlock("div",db,[s.createElementVNode("div",{class:"absolute inset-y-0 mx-auto h-full",style:s.normalizeStyle({width:`${i.value.pageWidth}px`,left:"50%",transform:"translateX(-50%)"})},[s.createElementVNode("div",{class:"absolute top-0 z-10 h-0 w-0 border-l-[4px] border-r-[4px] border-t-[6px] border-l-transparent border-r-transparent border-t-blue-400",style:s.normalizeStyle({left:r.value,transform:"translateX(-4px)"})},null,4),s.createElementVNode("div",{class:"absolute top-0 z-10 h-0 w-0 border-l-[4px] border-r-[4px] border-t-[6px] border-l-transparent border-r-transparent border-t-blue-400",style:s.normalizeStyle({left:a.value,transform:"translateX(-4px)"})},null,4),s.createElementVNode("div",mb,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n.value,c=>(s.openBlock(),s.createElementBlock("div",{key:c,class:s.normalizeClass(["absolute top-0 border-l border-slate-300 dark:border-slate-600",c%96===0?"h-3":"h-1.5"]),style:s.normalizeStyle({left:`${c}px`})},[c%96===0&&c>0?(s.openBlock(),s.createElementBlock("span",hb,s.toDisplayString(c/96),1)):s.createCommentVNode("",!0)],6))),128))])],4)]))}}),gb={class:"relative h-full w-full"},vb={key:0,class:"absolute -top-2 right-3 text-[9px] text-slate-400"},yb=s.defineComponent({__name:"VerticalRuler",props:{layoutOptions:{}},setup(e){const t=e,i=s.computed(()=>{var r,a;return{pageHeight:((r=t.layoutOptions)==null?void 0:r.pageHeight)??1123,margins:((a=t.layoutOptions)==null?void 0:a.margins)??{top:96,bottom:96,left:96,right:96}}}),n=s.computed(()=>{const r=Math.floor(i.value.pageHeight/48);return Array.from({length:r+1},(a,o)=>o*48)});return(r,a)=>(s.openBlock(),s.createElementBlock("div",{class:"docs-editor-vertical-ruler sticky top-0 hidden w-6 flex-shrink-0 border-r border-slate-200 bg-slate-50 dark:border-slate-800 dark:bg-[#0a0f1e] lg:block",style:s.normalizeStyle({minHeight:`${i.value.pageHeight}px`})},[s.createElementVNode("div",gb,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n.value,o=>(s.openBlock(),s.createElementBlock("div",{key:o,class:s.normalizeClass(["absolute right-0 border-t border-slate-300 dark:border-slate-600",o%96===0?"w-3":"w-1.5"]),style:s.normalizeStyle({top:`${o}px`})},[o%96===0&&o>0?(s.openBlock(),s.createElementBlock("span",vb,s.toDisplayString(o/96),1)):s.createCommentVNode("",!0)],6))),128))])],4))}}),xb={class:"toc-sidebar flex h-full w-80 flex-shrink-0 flex-col border-r border-slate-200 bg-white/80 text-slate-800 backdrop-blur-xl transition-all animate-fadeIn dark:border-white/5 dark:bg-[#0a0f1e]/85 dark:text-slate-100"},kb={class:"flex items-center justify-between border-b border-slate-200 p-4 dark:border-white/5"},wb={class:"flex items-center gap-1.5 font-mono text-xs font-bold uppercase tracking-widest text-slate-500 dark:text-slate-400"},_b={class:"mt-1 text-[10px] leading-relaxed text-slate-400 dark:text-slate-500"},Sb=["title"],Cb={key:0,class:"px-4 pb-2 pt-3"},Eb={class:"relative flex items-center"},Nb=["placeholder"],Ab={class:"custom-scrollbar flex-1 overflow-y-auto p-4"},Ob={key:0,class:"flex flex-col items-center justify-center py-12 text-center"},Tb={class:"mb-3 rounded-full bg-cyan-500/10 p-3 text-cyan-500 dark:bg-cyan-400/5"},Mb={class:"text-xs font-bold text-slate-700 dark:text-slate-300"},zb={class:"mt-1.5 max-w-[200px] text-[10px] leading-relaxed text-slate-400 dark:text-slate-500"},Ib={class:"mt-5 w-full space-y-2 px-4 font-sans"},Db={class:"mb-1.5 block text-left text-[9px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500"},Rb=["onClick"],Lb={class:"flex items-center gap-1.5"},Bb={key:1,class:"flex flex-col items-center justify-center py-12 text-center text-slate-400"},Pb={class:"text-xs font-semibold"},Vb={class:"mt-1 text-[10px] text-slate-400"},Fb={key:2,class:"space-y-1 font-sans"},Ub={class:"mb-2.5 block text-[9px] font-bold uppercase tracking-widest text-slate-400 dark:text-slate-500"},Hb={class:"relative ml-1.5 space-y-1.5 border-l border-slate-100 pl-1.5 dark:border-white/5"},jb=["onClick"],qb={class:"flex min-w-0 flex-1 items-center gap-2"},$b={class:"border-t border-slate-200 bg-slate-50/50 p-3.5 text-[10px] leading-relaxed text-slate-400 dark:border-white/5 dark:bg-slate-900/30 dark:text-slate-500"},Wb={class:"flex items-start gap-1.5"},Gb=60,ou=s.defineComponent({__name:"TOCSidebar",props:{editor:{}},emits:["close"],setup(e,{emit:t}){const i=e,n=t,{t:r}=rt(),a=s.ref([]),o=s.ref(""),l=s.ref(null);let c=null;function f(){c!==null&&clearTimeout(c),c=setTimeout(()=>{c=null,p()},Gb)}function p(){if(!i.editor)return;const g=[];i.editor.state.doc.descendants((x,k)=>{if(x.type.name==="heading"){const w=x.attrs.level;if(w===1||w===2||w===3){const C=x.textContent.trim();g.push({id:`heading-${k}`,text:C||r("sidebars.toc.untitledHeading").replace("{level}",String(w)),level:w,pos:k})}}return!0}),a.value=g}function m(){const g=i.editor;if(!g)return;const{from:x}=g.state.selection,k=g.state.doc.resolve(Math.max(0,x-1));for(let w=k.depth;w>0;w--){const C=k.node(w);if(C&&C.type.name==="heading"){l.value=`heading-${k.before(w+1)-1}`;return}}l.value=null}s.onMounted(()=>{var g,x;p(),m(),(g=i.editor)==null||g.on("update",f),(x=i.editor)==null||x.on("selectionUpdate",m)}),s.onUnmounted(()=>{var g,x;(g=i.editor)==null||g.off("update",f),(x=i.editor)==null||x.off("selectionUpdate",m),c!==null&&(clearTimeout(c),c=null)}),s.watch(()=>i.editor,(g,x)=>{x==null||x.off("update",f),x==null||x.off("selectionUpdate",m),c!==null&&(clearTimeout(c),c=null),p(),m(),g==null||g.on("update",f),g==null||g.on("selectionUpdate",m)});const d=s.computed(()=>a.value.filter(g=>g.text.toLowerCase().includes(o.value.toLowerCase())));function h(g){i.editor&&(i.editor.chain().focus().setTextSelection(g.pos).run(),l.value=g.id,setTimeout(()=>{var w;const x=document.querySelector(".docs-editor-scroll");if(!x)return;const k=x.querySelectorAll(".ProseMirror h1, .ProseMirror h2, .ProseMirror h3");for(const C of Array.from(k))if(((w=C.textContent)==null?void 0:w.trim())===g.text){C.scrollIntoView({behavior:"smooth",block:"center"});return}},50))}function v(g){if(!i.editor)return;const x=r(g===1?"header.heading1":g===2?"header.heading2":"header.heading3"),k=r("sidebars.toc.newSection"),w=r("sidebars.toc.startWriting");i.editor.chain().focus().insertContent(`<h${g}>${k.replace("{tag}",x)}</h${g}><p>${w}</p>`).run()}function b(g,x){const k="group w-full flex items-center justify-between rounded-lg p-1.5 text-left transition-all relative",w="bg-cyan-500/10 text-cyan-600 dark:text-cyan-400",C="text-slate-600 hover:bg-slate-50 dark:text-slate-300 dark:hover:bg-white/5";return g===1?[k,x?w:C,"pl-0 font-bold text-xs text-slate-800 dark:text-slate-200"]:g===2?[k,x?w:C,"pl-3.5 font-semibold text-[11px] text-slate-600 dark:text-slate-300"]:[k,x?w:C,"pl-6 text-[10px] text-slate-400 dark:text-slate-400"]}function y(g){return g===1?"bg-cyan-500":g===2?"bg-emerald-500":"bg-amber-500"}return(g,x)=>(s.openBlock(),s.createElementBlock("div",xb,[s.createElementVNode("div",kb,[s.createElementVNode("div",null,[s.createElementVNode("h3",wb,[s.createVNode(s.unref(Gr),{class:"h-4 w-4 text-cyan-500"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.toc.title")),1)]),s.createElementVNode("p",_b,s.toDisplayString(s.unref(r)("sidebars.toc.empty")),1)]),s.createElementVNode("button",{type:"button",class:"rounded-lg p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/5 dark:hover:text-white",title:s.unref(r)("sidebars.toc.closeOutline"),onClick:x[0]||(x[0]=k=>n("close"))},[s.createVNode(s.unref(Dt),{class:"h-4 w-4"})],8,Sb)]),a.value.length>0?(s.openBlock(),s.createElementBlock("div",Cb,[s.createElementVNode("div",Eb,[s.createVNode(s.unref(Xr),{class:"absolute left-3 h-3.5 w-3.5 text-slate-400 dark:text-slate-500"}),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":x[1]||(x[1]=k=>o.value=k),type:"text",placeholder:s.unref(r)("sidebars.toc.searchHeadings"),class:"w-full rounded-xl border border-slate-200/80 bg-slate-50 py-2 pl-9 pr-8 text-xs text-slate-700 transition-all focus:outline-none focus:ring-1 focus:ring-cyan-500/50 dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200 dark:focus:ring-cyan-400/30"},null,8,Nb),[[s.vModelText,o.value]]),o.value?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"absolute right-2.5 rounded-md p-0.5 text-slate-400 hover:bg-slate-200 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-white",onClick:x[2]||(x[2]=k=>o.value="")},[s.createVNode(s.unref(Dt),{class:"h-3 w-3"})])):s.createCommentVNode("",!0)])])):s.createCommentVNode("",!0),s.createElementVNode("div",Ab,[a.value.length===0?(s.openBlock(),s.createElementBlock("div",Ob,[s.createElementVNode("div",Tb,[s.createVNode(s.unref(Gr),{class:"h-6 w-6"})]),s.createElementVNode("h4",Mb,s.toDisplayString(s.unref(r)("sidebars.toc.noHeadings")),1),s.createElementVNode("p",zb,s.toDisplayString(s.unref(r)("sidebars.toc.noHeadingsDescription")),1),s.createElementVNode("div",Ib,[s.createElementVNode("span",Db,s.toDisplayString(s.unref(r)("sidebars.toc.quickInsert")),1),(s.openBlock(),s.createElementBlock(s.Fragment,null,s.renderList([1,2,3],k=>s.createElementVNode("button",{key:k,type:"button",class:"flex w-full items-center justify-between rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-[11px] font-semibold text-slate-700 transition-all hover:bg-slate-100 dark:border-white/10 dark:bg-white/[0.02] dark:text-slate-300 dark:hover:bg-white/5",onClick:w=>v(k)},[s.createElementVNode("span",Lb,[s.createVNode(s.unref(Kc),{class:s.normalizeClass(["h-3 w-3",k===1?"text-cyan-500":k===2?"text-emerald-500":"text-amber-500"])},null,8,["class"]),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.toc.headingLevel").replace("{level}",String(k))),1)]),s.createVNode(s.unref(gi),{class:"h-3.5 w-3.5 text-slate-400"})],8,Rb)),64))])])):d.value.length===0?(s.openBlock(),s.createElementBlock("div",Bb,[s.createVNode(s.unref(Xr),{class:"mb-2 h-5 w-5 text-slate-300"}),s.createElementVNode("p",Pb,s.toDisplayString(s.unref(r)("sidebars.toc.noMatchingHeaders")),1),s.createElementVNode("p",Vb,s.toDisplayString(s.unref(r)("sidebars.toc.tryDifferentTerm")),1)])):(s.openBlock(),s.createElementBlock("div",Fb,[s.createElementVNode("span",Ub,s.toDisplayString(s.unref(r)("sidebars.toc.outlineLayout")),1),s.createElementVNode("div",Hb,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(d.value,k=>(s.openBlock(),s.createElementBlock("button",{key:k.id,type:"button",class:s.normalizeClass(b(k.level,l.value===k.id)),onClick:w=>h(k)},[s.createElementVNode("div",qb,[s.createElementVNode("span",{class:s.normalizeClass(["h-1.5 w-1.5 shrink-0 rounded-full transition-all",[y(k.level),l.value===k.id?"scale-125 opacity-100":"opacity-40 group-hover:scale-110 group-hover:opacity-100"]])},null,2),s.createElementVNode("span",{class:s.normalizeClass(["flex-1 truncate leading-tight",l.value===k.id?"text-cyan-600 dark:text-cyan-400":""])},s.toDisplayString(k.text),3)]),s.createVNode(s.unref(ed),{class:s.normalizeClass(["h-3 w-3 shrink-0 text-cyan-500 opacity-0 transition-opacity group-hover:opacity-100",l.value===k.id?"opacity-100 text-cyan-600 dark:text-cyan-400":""])},null,8,["class"])],10,jb))),128))])]))]),s.createElementVNode("div",$b,[s.createElementVNode("div",Wb,[s.createVNode(s.unref(Cd),{class:"mt-0.5 h-3.5 w-3.5 shrink-0 text-cyan-500"}),s.createElementVNode("p",null,s.toDisplayString(s.unref(r)("sidebars.toc.outlineSync")),1)])])]))}}),Kb={class:"references-sidebar flex h-full w-80 flex-shrink-0 flex-col border-l border-slate-200 bg-white/80 text-slate-800 backdrop-blur-xl transition-all animate-fadeIn dark:border-white/5 dark:bg-[#0a0f1e]/85 dark:text-slate-100"},Xb={class:"flex items-center justify-between border-b border-slate-200 p-4 dark:border-white/5"},Jb={class:"flex items-center gap-1.5 font-mono text-xs font-bold uppercase tracking-widest text-slate-500 dark:text-slate-400"},Zb={class:"mt-1 text-[10px] leading-relaxed text-slate-400 dark:text-slate-500"},Qb=["title"],Yb={class:"border-b border-slate-100 px-4 pb-3 pt-3 dark:border-white/5"},eg={class:"mb-1.5 block text-[9px] font-bold uppercase tracking-widest text-slate-400 dark:text-slate-500"},tg=["value"],ig=["value"],ng={class:"flex items-center gap-2 px-4 pb-2 pt-3"},rg={class:"relative flex flex-1 items-center"},ag=["placeholder"],og=["title"],sg={class:"custom-scrollbar flex-1 overflow-y-auto p-4"},lg={key:0,class:"flex flex-col items-center justify-center py-12 text-center"},cg={class:"mb-3 rounded-full bg-cyan-500/10 p-3 text-cyan-500 dark:bg-cyan-400/5"},ug={class:"text-xs font-bold text-slate-700 dark:text-slate-300"},fg={class:"mt-1.5 max-w-[220px] text-[10px] leading-relaxed text-slate-400 dark:text-slate-500"},pg={key:1,class:"flex flex-col items-center justify-center py-12 text-center text-slate-400"},dg={class:"text-xs font-semibold"},mg={key:2,class:"space-y-2 font-sans"},hg={class:"min-w-0 flex-1"},bg=["title"],gg={class:"mt-0.5 truncate text-[10px] text-slate-500 dark:text-slate-400"},vg={key:0},yg={key:1},xg={key:2},kg={class:"mt-1.5 inline-block rounded bg-slate-200/70 px-1.5 py-0.5 text-[9px] font-mono uppercase tracking-wide text-slate-500 dark:bg-white/10 dark:text-slate-400"},wg={class:"mt-2.5 flex items-center gap-1.5"},_g=["onClick"],Sg=["title","onClick"],Cg=["title","onClick"],Eg={key:0,class:"border-t border-slate-200 dark:border-white/5"},Ng={key:0,class:"space-y-3 px-4 pb-4"},Ag={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},Og={class:"flex items-center gap-1.5"},Tg=["placeholder"],Mg=["disabled","title"],zg={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},Ig=["disabled"],Dg={key:0,class:"text-[10px] leading-relaxed text-slate-500 dark:text-slate-400"},Rg={class:"flex items-center gap-2 border-b border-slate-100 px-4 py-3 dark:border-white/5"},Lg=["title"],Bg={class:"text-xs font-bold text-slate-700 dark:text-slate-300"},Pg={class:"custom-scrollbar flex-1 overflow-y-auto p-4"},Vg={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},Fg=["value"],Ug={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},Hg={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},jg={class:"space-y-2"},qg=["onUpdate:modelValue","placeholder"],$g=["onUpdate:modelValue","placeholder"],Wg=["onClick"],Gg={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},Kg={key:0},Xg={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},Jg={key:1,class:"grid grid-cols-2 gap-2"},Zg={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},Qg={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},Yg={key:2,class:"grid grid-cols-3 gap-2"},ev={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},tv={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},iv={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},nv={key:3},rv={key:4},av={class:"flex items-center gap-2 pt-1.5"},ov=["disabled"],sv=s.defineComponent({__name:"ReferencesSidebar",props:{sources:{},activeStyle:{},pickerMode:{type:Boolean,default:!1},availableStyles:{default:()=>[{id:"chicago-notes-bibliography",name:"Chicago (notes & bibliography)"},{id:"chicago-author-date",name:"Chicago (author-date)"},{id:"apa",name:"APA"},{id:"modern-language-association",name:"MLA"}]},canImport:{type:Boolean,default:!1},importing:{type:Boolean,default:!1},importMessage:{default:""}},emits:["close","insert","create","update","remove","update:style","import-doi","import-bibliography"],setup(e,{emit:t}){const i=e,n=t,{t:r}=rt(),a=s.ref(""),o=["book","article-journal","chapter","webpage","report","thesis","document"];function l(X){const F=X.author??[];if(F.length===0)return r("sidebars.references.anonymous");const q=F[0],ne=q.family??q.literal??"";return F.length>1?`${ne} ${r("sidebars.references.etAl")}`:ne}function c(X){var q,ne;const F=(ne=(q=X.issued)==null?void 0:q["date-parts"])==null?void 0:ne[0];return F!=null&&F[0]?String(F[0]):""}function f(X){const F=`sidebars.references.types.${X}`,q=r(F);return q===F?X:q}const p=s.computed(()=>{const X=a.value.trim().toLowerCase();return X?i.sources.filter(F=>[F.title,F["container-title"],F.publisher,F.DOI,F.URL,...(F.author??[]).map(ne=>`${ne.family??""} ${ne.given??""} ${ne.literal??""}`)].filter(Boolean).join(" ").toLowerCase().includes(X)):i.sources}),m=s.ref("list"),d=s.ref(null),h=s.ref("book"),v=s.ref(""),b=s.ref([{family:"",given:""}]),y=s.ref(""),g=s.ref(""),x=s.ref(""),k=s.ref(""),w=s.ref(""),C=s.ref(""),E=s.ref(""),B=s.ref(""),_=s.ref("");function S(){h.value="book",v.value="",b.value=[{family:"",given:""}],y.value="",g.value="",x.value="",k.value="",w.value="",C.value="",E.value="",B.value="",_.value=""}function T(){d.value=null,S(),m.value="form"}function D(X){d.value=X.id,h.value=X.type||"book",v.value=X.title??"",b.value=(X.author??[]).filter(q=>!q.literal).map(q=>({family:q.family??"",given:q.given??""}));const F=(X.author??[]).find(q=>q.literal);b.value.length===0&&(b.value=[{family:(F==null?void 0:F.literal)??"",given:""}]),y.value=c(X),g.value=X.publisher??"",x.value=X["publisher-place"]??"",k.value=X["container-title"]??"",w.value=X.volume??"",C.value=X.issue??"",E.value=X.page??"",B.value=X.DOI??"",_.value=X.URL??"",m.value="form"}function H(){b.value.push({family:"",given:""})}function V(X){b.value.splice(X,1),b.value.length===0&&b.value.push({family:"",given:""})}const M=s.computed(()=>["book","chapter","report","thesis","document"].includes(h.value)),$=s.computed(()=>["article-journal","chapter"].includes(h.value)),P=s.computed(()=>["article-journal","chapter"].includes(h.value)),W=s.computed(()=>["webpage","report"].includes(h.value)),L=s.computed(()=>v.value.trim().length>0);function Q(){const X=b.value.filter(ne=>ne.family.trim()||ne.given.trim()).map(ne=>({family:ne.family.trim(),given:ne.given.trim()})),F=parseInt(y.value,10),q={id:d.value??crypto.randomUUID(),type:h.value,title:v.value.trim()};return X.length>0&&(q.author=X),Number.isFinite(F)&&(q.issued={"date-parts":[[F]]}),g.value.trim()&&(q.publisher=g.value.trim()),x.value.trim()&&(q["publisher-place"]=x.value.trim()),k.value.trim()&&(q["container-title"]=k.value.trim()),w.value.trim()&&(q.volume=w.value.trim()),C.value.trim()&&(q.issue=C.value.trim()),E.value.trim()&&(q.page=E.value.trim()),B.value.trim()&&(q.DOI=B.value.trim()),_.value.trim()&&(q.URL=_.value.trim()),q}function j(){if(!L.value)return;const X=Q();d.value?n("update",X):n("create",X),m.value="list"}function O(X){window.confirm(r("sidebars.references.confirmDelete").replace("{title}",X.title??X.id))&&n("remove",X.id)}const R=s.ref(!1),U=s.ref(""),oe=s.ref(null);function ie(){const X=U.value.trim();!X||i.importing||(n("import-doi",X),U.value="")}function ee(){var X;i.importing||(X=oe.value)==null||X.click()}async function te(X){var Se;const F=X.target,q=(Se=F.files)==null?void 0:Se[0];if(F.value="",!q)return;const ne=/\.ris$/i.test(q.name)?"ris":"bibtex",se=await q.text();n("import-bibliography",{format:ne,text:se})}return(X,F)=>(s.openBlock(),s.createElementBlock("div",Kb,[s.createElementVNode("div",Xb,[s.createElementVNode("div",null,[s.createElementVNode("h3",Jb,[s.createVNode(s.unref(Co),{class:"h-4 w-4 text-cyan-500"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.references.title")),1)]),s.createElementVNode("p",Zb,s.toDisplayString(s.unref(r)("sidebars.references.subtitle")),1)]),s.createElementVNode("button",{type:"button",class:"rounded-lg p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/5 dark:hover:text-white",title:s.unref(r)("sidebars.references.close"),onClick:F[0]||(F[0]=q=>n("close"))},[s.createVNode(s.unref(Dt),{class:"h-4 w-4"})],8,Qb)]),m.value==="list"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createElementVNode("div",Yb,[s.createElementVNode("label",eg,s.toDisplayString(s.unref(r)("sidebars.references.citationStyle")),1),s.createElementVNode("select",{value:e.activeStyle,class:"w-full rounded-xl border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs text-slate-700 transition-all focus:outline-none focus:ring-1 focus:ring-cyan-500/50 dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200",onChange:F[1]||(F[1]=q=>n("update:style",q.target.value))},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.availableStyles,q=>(s.openBlock(),s.createElementBlock("option",{key:q.id,value:q.id},s.toDisplayString(q.name),9,ig))),128))],40,tg)]),s.createElementVNode("div",ng,[s.createElementVNode("div",rg,[s.createVNode(s.unref(Xr),{class:"absolute left-3 h-3.5 w-3.5 text-slate-400 dark:text-slate-500"}),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[2]||(F[2]=q=>a.value=q),type:"text",placeholder:s.unref(r)("sidebars.references.searchSources"),class:"w-full rounded-xl border border-slate-200/80 bg-slate-50 py-2 pl-9 pr-8 text-xs text-slate-700 transition-all focus:outline-none focus:ring-1 focus:ring-cyan-500/50 dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200 dark:focus:ring-cyan-400/30"},null,8,ag),[[s.vModelText,a.value]]),a.value?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"absolute right-2.5 rounded-md p-0.5 text-slate-400 hover:bg-slate-200 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-white",onClick:F[3]||(F[3]=q=>a.value="")},[s.createVNode(s.unref(Dt),{class:"h-3 w-3"})])):s.createCommentVNode("",!0)]),s.createElementVNode("button",{type:"button",class:"flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-xl bg-blue-600 text-white shadow transition-colors hover:bg-blue-700",title:s.unref(r)("sidebars.references.addSource"),onClick:T},[s.createVNode(s.unref(gi),{class:"h-4 w-4"})],8,og)]),s.createElementVNode("div",sg,[e.sources.length===0?(s.openBlock(),s.createElementBlock("div",lg,[s.createElementVNode("div",cg,[s.createVNode(s.unref(Co),{class:"h-6 w-6"})]),s.createElementVNode("h4",ug,s.toDisplayString(s.unref(r)("sidebars.references.noSources")),1),s.createElementVNode("p",fg,s.toDisplayString(s.unref(r)("sidebars.references.noSourcesDescription")),1),s.createElementVNode("button",{type:"button",class:"mt-5 flex items-center gap-1.5 rounded-lg bg-blue-600 px-4 py-2 text-[11px] font-semibold text-white shadow transition-colors hover:bg-blue-700",onClick:T},[s.createVNode(s.unref(gi),{class:"h-3.5 w-3.5"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.references.addSource")),1)])])):p.value.length===0?(s.openBlock(),s.createElementBlock("div",pg,[s.createVNode(s.unref(Xr),{class:"mb-2 h-5 w-5 text-slate-300"}),s.createElementVNode("p",dg,s.toDisplayString(s.unref(r)("sidebars.references.noMatchingSources")),1)])):(s.openBlock(),s.createElementBlock("div",mg,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(p.value,q=>(s.openBlock(),s.createElementBlock("div",{key:q.id,class:"group rounded-xl border border-slate-200/80 bg-slate-50/60 p-3 transition-all hover:border-slate-300 dark:border-white/10 dark:bg-white/[0.02] dark:hover:border-white/20"},[s.createElementVNode("div",hg,[s.createElementVNode("p",{class:"truncate text-xs font-semibold text-slate-800 dark:text-slate-200",title:q.title},s.toDisplayString(q.title),9,bg),s.createElementVNode("p",gg,[s.createTextVNode(s.toDisplayString(l(q)),1),c(q)?(s.openBlock(),s.createElementBlock("span",vg," ("+s.toDisplayString(c(q))+")",1)):s.createCommentVNode("",!0),q["container-title"]?(s.openBlock(),s.createElementBlock("span",yg," · "+s.toDisplayString(q["container-title"]),1)):q.publisher?(s.openBlock(),s.createElementBlock("span",xg," · "+s.toDisplayString(q.publisher),1)):s.createCommentVNode("",!0)]),s.createElementVNode("span",kg,s.toDisplayString(f(q.type)),1)]),s.createElementVNode("div",wg,[s.createElementVNode("button",{type:"button",class:s.normalizeClass(["flex flex-1 items-center justify-center gap-1 rounded-lg px-2 py-1.5 text-[10px] font-semibold transition-colors",e.pickerMode?"bg-blue-600 text-white hover:bg-blue-700":"bg-slate-200/80 text-slate-700 hover:bg-blue-600 hover:text-white dark:bg-white/10 dark:text-slate-300 dark:hover:bg-blue-600"]),onClick:ne=>n("insert",q.id)},[s.createVNode(s.unref(Kr),{class:"h-3 w-3"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.references.cite")),1)],10,_g),s.createElementVNode("button",{type:"button",class:"flex h-7 w-7 items-center justify-center rounded-lg text-slate-400 transition-colors hover:bg-slate-200 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-white",title:s.unref(r)("sidebars.references.edit"),onClick:ne=>D(q)},[s.createVNode(s.unref(eu),{class:"h-3.5 w-3.5"})],8,Sg),s.createElementVNode("button",{type:"button",class:"flex h-7 w-7 items-center justify-center rounded-lg text-slate-400 transition-colors hover:bg-red-50 hover:text-red-500 dark:hover:bg-red-500/10",title:s.unref(r)("sidebars.references.delete"),onClick:ne=>O(q)},[s.createVNode(s.unref(us),{class:"h-3.5 w-3.5"})],8,Cg)])]))),128))]))]),e.canImport?(s.openBlock(),s.createElementBlock("div",Eg,[s.createElementVNode("button",{type:"button",class:"flex w-full items-center justify-between px-4 py-2.5 text-[10px] font-bold uppercase tracking-widest text-slate-400 transition-colors hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300",onClick:F[4]||(F[4]=q=>R.value=!R.value)},[s.createElementVNode("span",null,s.toDisplayString(s.unref(r)("sidebars.references.import.title")),1),s.createVNode(s.unref(ei),{class:s.normalizeClass(["h-3.5 w-3.5 transition-transform",R.value?"rotate-180":""])},null,8,["class"])]),R.value?(s.openBlock(),s.createElementBlock("div",Ng,[s.createElementVNode("div",null,[s.createElementVNode("label",Ag,s.toDisplayString(s.unref(r)("sidebars.references.import.fromDoi")),1),s.createElementVNode("div",Og,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[5]||(F[5]=q=>U.value=q),type:"text",placeholder:s.unref(r)("sidebars.references.import.doiPlaceholder"),class:"min-w-0 flex-1 rounded-lg border border-slate-200/80 bg-slate-50 px-2.5 py-1.5 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200",onKeydown:s.withKeys(ie,["enter"])},null,40,Tg),[[s.vModelText,U.value]]),s.createElementVNode("button",{type:"button",disabled:e.importing||!U.value.trim(),class:"flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-lg bg-blue-600 text-white transition-colors hover:bg-blue-700 disabled:opacity-40",title:s.unref(r)("sidebars.references.import.importDoi"),onClick:ie},[s.createVNode(s.unref(Gc),{class:"h-3.5 w-3.5"})],8,Mg)])]),s.createElementVNode("div",null,[s.createElementVNode("label",zg,s.toDisplayString(s.unref(r)("sidebars.references.import.fromFile")),1),s.createElementVNode("button",{type:"button",disabled:e.importing,class:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-slate-300 px-3 py-2 text-[11px] font-semibold text-slate-500 transition-colors hover:border-blue-400 hover:text-blue-600 disabled:opacity-40 dark:border-white/15 dark:text-slate-400 dark:hover:border-blue-500 dark:hover:text-blue-400",onClick:ee},[s.createVNode(s.unref(ld),{class:"h-3.5 w-3.5"}),s.createTextVNode(" "+s.toDisplayString(e.importing?s.unref(r)("sidebars.references.import.importing"):s.unref(r)("sidebars.references.import.pickFile")),1)],8,Ig),s.createElementVNode("input",{ref_key:"bibFileInput",ref:oe,type:"file",accept:".bib,.ris,application/x-bibtex,text/plain",class:"hidden",onChange:te},null,544)]),e.importMessage?(s.openBlock(),s.createElementBlock("p",Dg,s.toDisplayString(e.importMessage),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)],64)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createElementVNode("div",Rg,[s.createElementVNode("button",{type:"button",class:"rounded-lg p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/5 dark:hover:text-white",title:s.unref(r)("sidebars.references.back"),onClick:F[6]||(F[6]=q=>m.value="list")},[s.createVNode(s.unref(Yp),{class:"h-4 w-4"})],8,Lg),s.createElementVNode("h4",Bg,s.toDisplayString(d.value?s.unref(r)("sidebars.references.editSource"):s.unref(r)("sidebars.references.addSource")),1)]),s.createElementVNode("div",Pg,[s.createElementVNode("form",{class:"space-y-3.5",onSubmit:s.withModifiers(j,["prevent"])},[s.createElementVNode("div",null,[s.createElementVNode("label",Vg,s.toDisplayString(s.unref(r)("sidebars.references.form.type")),1),s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":F[7]||(F[7]=q=>h.value=q),class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},[(s.openBlock(),s.createElementBlock(s.Fragment,null,s.renderList(o,q=>s.createElementVNode("option",{key:q,value:q},s.toDisplayString(f(q)),9,Fg)),64))],512),[[s.vModelSelect,h.value]])]),s.createElementVNode("div",null,[s.createElementVNode("label",Ug,s.toDisplayString(s.unref(r)("sidebars.references.form.title"))+" *",1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[8]||(F[8]=q=>v.value=q),type:"text",required:"",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,v.value]])]),s.createElementVNode("div",null,[s.createElementVNode("label",Hg,s.toDisplayString(s.unref(r)("sidebars.references.form.authors")),1),s.createElementVNode("div",jg,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(b.value,(q,ne)=>(s.openBlock(),s.createElementBlock("div",{key:ne,class:"flex items-center gap-1.5"},[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":se=>q.family=se,type:"text",placeholder:s.unref(r)("sidebars.references.form.familyName"),class:"w-1/2 rounded-lg border border-slate-200/80 bg-slate-50 px-2.5 py-1.5 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,8,qg),[[s.vModelText,q.family]]),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":se=>q.given=se,type:"text",placeholder:s.unref(r)("sidebars.references.form.givenName"),class:"w-1/2 rounded-lg border border-slate-200/80 bg-slate-50 px-2.5 py-1.5 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,8,$g),[[s.vModelText,q.given]]),s.createElementVNode("button",{type:"button",class:"flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-lg text-slate-400 hover:bg-red-50 hover:text-red-500 dark:hover:bg-red-500/10",onClick:se=>V(ne)},[s.createVNode(s.unref(Dt),{class:"h-3.5 w-3.5"})],8,Wg)]))),128))]),s.createElementVNode("button",{type:"button",class:"mt-1.5 flex items-center gap-1 text-[10px] font-semibold text-blue-600 hover:text-blue-700 dark:text-blue-400",onClick:H},[s.createVNode(s.unref(gi),{class:"h-3 w-3"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.references.form.addAuthor")),1)])]),s.createElementVNode("div",null,[s.createElementVNode("label",Gg,s.toDisplayString(s.unref(r)("sidebars.references.form.year")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[9]||(F[9]=q=>y.value=q),type:"number",min:"0",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,y.value]])]),$.value?(s.openBlock(),s.createElementBlock("div",Kg,[s.createElementVNode("label",Xg,s.toDisplayString(h.value==="chapter"?s.unref(r)("sidebars.references.form.bookTitle"):s.unref(r)("sidebars.references.form.journal")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[10]||(F[10]=q=>k.value=q),type:"text",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,k.value]])])):s.createCommentVNode("",!0),M.value?(s.openBlock(),s.createElementBlock("div",Jg,[s.createElementVNode("div",null,[s.createElementVNode("label",Zg,s.toDisplayString(s.unref(r)("sidebars.references.form.publisher")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[11]||(F[11]=q=>g.value=q),type:"text",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,g.value]])]),s.createElementVNode("div",null,[s.createElementVNode("label",Qg,s.toDisplayString(s.unref(r)("sidebars.references.form.publisherPlace")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[12]||(F[12]=q=>x.value=q),type:"text",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,x.value]])])])):s.createCommentVNode("",!0),P.value?(s.openBlock(),s.createElementBlock("div",Yg,[s.createElementVNode("div",null,[s.createElementVNode("label",ev,s.toDisplayString(s.unref(r)("sidebars.references.form.volume")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[13]||(F[13]=q=>w.value=q),type:"text",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,w.value]])]),s.createElementVNode("div",null,[s.createElementVNode("label",tv,s.toDisplayString(s.unref(r)("sidebars.references.form.issue")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[14]||(F[14]=q=>C.value=q),type:"text",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,C.value]])]),s.createElementVNode("div",null,[s.createElementVNode("label",iv,s.toDisplayString(s.unref(r)("sidebars.references.form.pages")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[15]||(F[15]=q=>E.value=q),type:"text",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,E.value]])])])):s.createCommentVNode("",!0),h.value==="article-journal"?(s.openBlock(),s.createElementBlock("div",nv,[F[19]||(F[19]=s.createElementVNode("label",{class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},"DOI",-1)),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[16]||(F[16]=q=>B.value=q),type:"text",placeholder:"10.xxxx/xxxxx",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,B.value]])])):s.createCommentVNode("",!0),W.value?(s.openBlock(),s.createElementBlock("div",rv,[F[20]||(F[20]=s.createElementVNode("label",{class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},"URL",-1)),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[17]||(F[17]=q=>_.value=q),type:"url",placeholder:"https://…",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,_.value]])])):s.createCommentVNode("",!0),s.createElementVNode("div",av,[s.createElementVNode("button",{type:"submit",disabled:!L.value,class:"flex-1 rounded-lg bg-blue-600 px-4 py-2 text-xs font-semibold text-white shadow transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-40"},s.toDisplayString(d.value?s.unref(r)("sidebars.references.form.save"):s.unref(r)("sidebars.references.form.create")),9,ov),s.createElementVNode("button",{type:"button",class:"rounded-lg border border-slate-200 px-4 py-2 text-xs font-semibold text-slate-600 transition-colors hover:bg-slate-50 dark:border-white/10 dark:text-slate-300 dark:hover:bg-white/5",onClick:F[18]||(F[18]=q=>m.value="list")},s.toDisplayString(s.unref(r)("sidebars.references.form.cancel")),1)])],32)])],64))]))}});function Qe(e){this.content=e}Qe.prototype={constructor:Qe,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,i){var n=i&&i!=e?this.remove(i):this,r=n.find(e),a=n.content.slice();return r==-1?a.push(i||e,t):(a[r+1]=t,i&&(a[r]=i)),new Qe(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var i=this.content.slice();return i.splice(t,2),new Qe(i)},addToStart:function(e,t){return new Qe([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var i=this.remove(e).content.slice();return i.push(e,t),new Qe(i)},addBefore:function(e,t,i){var n=this.remove(t),r=n.content.slice(),a=n.find(e);return r.splice(a==-1?r.length:a,0,t,i),new Qe(r)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Qe.from(e),e.size?new Qe(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Qe.from(e),e.size?new Qe(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Qe.from(e);for(var i=0;i<e.content.length;i+=2)t=t.remove(e.content[i]);return t},toObject:function(){var e={};return this.forEach(function(t,i){e[t]=i}),e},get size(){return this.content.length>>1}};Qe.from=function(e){if(e instanceof Qe)return e;var t=[];if(e)for(var i in e)t.push(i,e[i]);return new Qe(t)};function su(e,t,i){for(let n=0;;n++){if(n==e.childCount||n==t.childCount)return e.childCount==t.childCount?null:i;let r=e.child(n),a=t.child(n);if(r==a){i+=r.nodeSize;continue}if(!r.sameMarkup(a))return i;if(r.isText&&r.text!=a.text){let o=r.text,l=a.text,c=0;for(;o[c]==l[c];c++)i++;return c&&c<o.length&&c<l.length&&uu(o.charCodeAt(c-1))&&cu(o.charCodeAt(c))&&i--,i}if(r.content.size||a.content.size){let o=su(r.content,a.content,i+1);if(o!=null)return o}i+=r.nodeSize}}function lu(e,t,i,n){for(let r=e.childCount,a=t.childCount;;){if(r==0||a==0)return r==a?null:{a:i,b:n};let o=e.child(--r),l=t.child(--a),c=o.nodeSize;if(o==l){i-=c,n-=c;continue}if(!o.sameMarkup(l))return{a:i,b:n};if(o.isText&&o.text!=l.text){let f=o.text,p=l.text,m=f.length,d=p.length;for(;m>0&&d>0&&f[m-1]==p[d-1];)m--,d--,i--,n--;return m&&d&&m<f.length&&uu(f.charCodeAt(m-1))&&cu(f.charCodeAt(m))&&(i++,n++),{a:i,b:n}}if(o.content.size||l.content.size){let f=lu(o.content,l.content,i-1,n-1);if(f)return f}i-=c,n-=c}}function cu(e){return e>=56320&&e<57344}function uu(e){return e>=55296&&e<56320}class Z{constructor(t,i){if(this.content=t,this.size=i||0,i==null)for(let n=0;n<t.length;n++)this.size+=t[n].nodeSize}nodesBetween(t,i,n,r=0,a){for(let o=0,l=0;l<i;o++){let c=this.content[o],f=l+c.nodeSize;if(f>t&&n(c,r+l,a||null,o)!==!1&&c.content.size){let p=l+1;c.nodesBetween(Math.max(0,t-p),Math.min(c.content.size,i-p),n,r+p)}l=f}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,i,n,r){let a="",o=!0;return this.nodesBetween(t,i,(l,c)=>{let f=l.isText?l.text.slice(Math.max(t,c)-c,i-c):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&f||l.isTextblock)&&n&&(o?o=!1:a+=n),a+=f},0),a}append(t){if(!t.size)return this;if(!this.size)return t;let i=this.lastChild,n=t.firstChild,r=this.content.slice(),a=0;for(i.isText&&i.sameMarkup(n)&&(r[r.length-1]=i.withText(i.text+n.text),a=1);a<t.content.length;a++)r.push(t.content[a]);return new Z(r,this.size+t.size)}cut(t,i=this.size){if(t==0&&i==this.size)return this;let n=[],r=0;if(i>t)for(let a=0,o=0;o<i;a++){let l=this.content[a],c=o+l.nodeSize;c>t&&((o<t||c>i)&&(l.isText?l=l.cut(Math.max(0,t-o),Math.min(l.text.length,i-o)):l=l.cut(Math.max(0,t-o-1),Math.min(l.content.size,i-o-1))),n.push(l),r+=l.nodeSize),o=c}return new Z(n,r)}cutByIndex(t,i){return t==i?Z.empty:t==0&&i==this.content.length?this:new Z(this.content.slice(t,i))}replaceChild(t,i){let n=this.content[t];if(n==i)return this;let r=this.content.slice(),a=this.size+i.nodeSize-n.nodeSize;return r[t]=i,new Z(r,a)}addToStart(t){return new Z([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new Z(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let i=0;i<this.content.length;i++)if(!this.content[i].eq(t.content[i]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let i=this.content[t];if(!i)throw new RangeError("Index "+t+" out of range for "+this);return i}maybeChild(t){return this.content[t]||null}forEach(t){for(let i=0,n=0;i<this.content.length;i++){let r=this.content[i];t(r,n,i),n+=r.nodeSize}}findDiffStart(t,i=0){return su(this,t,i)}findDiffEnd(t,i=this.size,n=t.size){return lu(this,t,i,n)}findIndex(t){if(t==0)return kr(0,t);if(t==this.size)return kr(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let i=0,n=0;;i++){let r=this.child(i),a=n+r.nodeSize;if(a>=t)return a==t?kr(i+1,a):kr(i,n);n=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,i){if(!i)return Z.empty;if(!Array.isArray(i))throw new RangeError("Invalid input for Fragment.fromJSON");return Z.fromArray(i.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return Z.empty;let i,n=0;for(let r=0;r<t.length;r++){let a=t[r];n+=a.nodeSize,r&&a.isText&&t[r-1].sameMarkup(a)?(i||(i=t.slice(0,r)),i[i.length-1]=a.withText(i[i.length-1].text+a.text)):i&&i.push(a)}return new Z(i||t,n)}static from(t){if(!t)return Z.empty;if(t instanceof Z)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new Z([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Z.empty=new Z([],0);const to={index:0,offset:0};function kr(e,t){return to.index=e,to.offset=t,to}function Jr(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let i=Array.isArray(e);if(Array.isArray(t)!=i)return!1;if(i){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Jr(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Jr(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}let Re=class Oo{constructor(t,i){this.type=t,this.attrs=i}addToSet(t){let i,n=!1;for(let r=0;r<t.length;r++){let a=t[r];if(this.eq(a))return t;if(this.type.excludes(a.type))i||(i=t.slice(0,r));else{if(a.type.excludes(this.type))return t;!n&&a.type.rank>this.type.rank&&(i||(i=t.slice(0,r)),i.push(this),n=!0),i&&i.push(a)}}return i||(i=t.slice()),n||i.push(this),i}removeFromSet(t){for(let i=0;i<t.length;i++)if(this.eq(t[i]))return t.slice(0,i).concat(t.slice(i+1));return t}isInSet(t){for(let i=0;i<t.length;i++)if(this.eq(t[i]))return!0;return!1}eq(t){return this==t||this.type==t.type&&Jr(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let i in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,i){if(!i)throw new RangeError("Invalid input for Mark.fromJSON");let n=t.marks[i.type];if(!n)throw new RangeError(`There is no mark type ${i.type} in this schema`);let r=n.create(i.attrs);return n.checkAttrs(r.attrs),r}static sameSet(t,i){if(t==i)return!0;if(t.length!=i.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].eq(i[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return Oo.none;if(t instanceof Oo)return[t];let i=t.slice();return i.sort((n,r)=>n.type.rank-r.type.rank),i}};Re.none=[];class Pn extends Error{}class ae{constructor(t,i,n){this.content=t,this.openStart=i,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,i){let n=pu(this.content,t+this.openStart,i,this.openStart+1,this.openEnd+1);return n&&new ae(n,this.openStart,this.openEnd)}removeBetween(t,i){return new ae(fu(this.content,t+this.openStart,i+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,i){if(!i)return ae.empty;let n=i.openStart||0,r=i.openEnd||0;if(typeof n!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ae(Z.fromJSON(t,i.content),n,r)}static maxOpen(t,i=!0){let n=0,r=0;for(let a=t.firstChild;a&&!a.isLeaf&&(i||!a.type.spec.isolating);a=a.firstChild)n++;for(let a=t.lastChild;a&&!a.isLeaf&&(i||!a.type.spec.isolating);a=a.lastChild)r++;return new ae(t,n,r)}}ae.empty=new ae(Z.empty,0,0);function fu(e,t,i){let{index:n,offset:r}=e.findIndex(t),a=e.maybeChild(n),{index:o,offset:l}=e.findIndex(i);if(r==t||a.isText){if(l!=i&&!e.child(o).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(i))}if(n!=o)throw new RangeError("Removing non-flat range");return e.replaceChild(n,a.copy(fu(a.content,t-r-1,i-r-1)))}function pu(e,t,i,n,r,a){let{index:o,offset:l}=e.findIndex(t),c=e.maybeChild(o);if(l==t||c.isText)return a&&n<=0&&r<=0&&!a.canReplace(o,o,i)?null:e.cut(0,t).append(i).append(e.cut(t));let f=pu(c.content,t-l-1,i,o==0?n-1:0,o==e.childCount-1?r-1:0,c);return f&&e.replaceChild(o,c.copy(f))}function lv(e,t,i){if(i.openStart>e.depth)throw new Pn("Inserted content deeper than insertion position");if(e.depth-i.openStart!=t.depth-i.openEnd)throw new Pn("Inconsistent open depths");return du(e,t,i,0)}function du(e,t,i,n){let r=e.index(n),a=e.node(n);if(r==t.index(n)&&n<e.depth-i.openStart){let o=du(e,t,i,n+1);return a.copy(a.content.replaceChild(r,o))}else if(i.content.size)if(!i.openStart&&!i.openEnd&&e.depth==n&&t.depth==n){let o=e.parent,l=o.content;return Bi(o,l.cut(0,e.parentOffset).append(i.content).append(l.cut(t.parentOffset)))}else{let{start:o,end:l}=cv(i,e);return Bi(a,hu(e,o,l,t,n))}else return Bi(a,Zr(e,t,n))}function mu(e,t){if(!t.type.compatibleContent(e.type))throw new Pn("Cannot join "+t.type.name+" onto "+e.type.name)}function To(e,t,i){let n=e.node(i);return mu(n,t.node(i)),n}function Li(e,t){let i=t.length-1;i>=0&&e.isText&&e.sameMarkup(t[i])?t[i]=e.withText(t[i].text+e.text):t.push(e)}function On(e,t,i,n){let r=(t||e).node(i),a=0,o=t?t.index(i):r.childCount;e&&(a=e.index(i),e.depth>i?a++:e.textOffset&&(Li(e.nodeAfter,n),a++));for(let l=a;l<o;l++)Li(r.child(l),n);t&&t.depth==i&&t.textOffset&&Li(t.nodeBefore,n)}function Bi(e,t){if(!e.type.validContent(t))throw new Pn("Invalid content for node "+e.type.name);return e.copy(t)}function hu(e,t,i,n,r){let a=e.depth>r&&To(e,t,r+1),o=n.depth>r&&To(i,n,r+1),l=[];return On(null,e,r,l),a&&o&&t.index(r)==i.index(r)?(mu(a,o),Li(Bi(a,hu(e,t,i,n,r+1)),l)):(a&&Li(Bi(a,Zr(e,t,r+1)),l),On(t,i,r,l),o&&Li(Bi(o,Zr(i,n,r+1)),l)),On(n,null,r,l),new Z(l)}function Zr(e,t,i){let n=[];if(On(null,e,i,n),e.depth>i){let r=To(e,t,i+1);Li(Bi(r,Zr(e,t,i+1)),n)}return On(t,null,i,n),new Z(n)}function cv(e,t){let i=t.depth-e.openStart,r=t.node(i).copy(e.content);for(let a=i-1;a>=0;a--)r=t.node(a).copy(Z.from(r));return{start:r.resolveNoCache(e.openStart+i),end:r.resolveNoCache(r.content.size-e.openEnd-i)}}class Vn{constructor(t,i,n){this.pos=t,this.path=i,this.parentOffset=n,this.depth=i.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,i=this.index(this.depth);if(i==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=t.child(i);return n?t.child(i).cut(n):r}get nodeBefore(){let t=this.index(this.depth),i=this.pos-this.path[this.path.length-1];return i?this.parent.child(t).cut(0,i):t==0?null:this.parent.child(t-1)}posAtIndex(t,i){i=this.resolveDepth(i);let n=this.path[i*3],r=i==0?0:this.path[i*3-1]+1;for(let a=0;a<t;a++)r+=n.child(a).nodeSize;return r}marks(){let t=this.parent,i=this.index();if(t.content.size==0)return Re.none;if(this.textOffset)return t.child(i).marks;let n=t.maybeChild(i-1),r=t.maybeChild(i);if(!n){let l=n;n=r,r=l}let a=n.marks;for(var o=0;o<a.length;o++)a[o].type.spec.inclusive===!1&&(!r||!a[o].isInSet(r.marks))&&(a=a[o--].removeFromSet(a));return a}marksAcross(t){let i=this.parent.maybeChild(this.index());if(!i||!i.isInline)return null;let n=i.marks,r=t.parent.maybeChild(t.index());for(var a=0;a<n.length;a++)n[a].type.spec.inclusive===!1&&(!r||!n[a].isInSet(r.marks))&&(n=n[a--].removeFromSet(n));return n}sharedDepth(t){for(let i=this.depth;i>0;i--)if(this.start(i)<=t&&this.end(i)>=t)return i;return 0}blockRange(t=this,i){if(t.pos<this.pos)return t.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!i||i(this.node(n))))return new Qr(this,t,n);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let i=1;i<=this.depth;i++)t+=(t?"/":"")+this.node(i).type.name+"_"+this.index(i-1);return t+":"+this.parentOffset}static resolve(t,i){if(!(i>=0&&i<=t.content.size))throw new RangeError("Position "+i+" out of range");let n=[],r=0,a=i;for(let o=t;;){let{index:l,offset:c}=o.content.findIndex(a),f=a-c;if(n.push(o,l,r+c),!f||(o=o.child(l),o.isText))break;a=f-1,r+=c+1}return new Vn(i,n,a)}static resolveCached(t,i){let n=xl.get(t);if(n)for(let a=0;a<n.elts.length;a++){let o=n.elts[a];if(o.pos==i)return o}else xl.set(t,n=new uv);let r=n.elts[n.i]=Vn.resolve(t,i);return n.i=(n.i+1)%fv,r}}class uv{constructor(){this.elts=[],this.i=0}}const fv=12,xl=new WeakMap;class Qr{constructor(t,i,n){this.$from=t,this.$to=i,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const pv=Object.create(null);let Pi=class Mo{constructor(t,i,n,r=Re.none){this.type=t,this.attrs=i,this.marks=r,this.content=n||Z.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,i,n,r=0){this.content.nodesBetween(t,i,n,r,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,i,n,r){return this.content.textBetween(t,i,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,i,n){return this.type==t&&Jr(this.attrs,i||t.defaultAttrs||pv)&&Re.sameSet(this.marks,n||Re.none)}copy(t=null){return t==this.content?this:new Mo(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Mo(this.type,this.attrs,this.content,t)}cut(t,i=this.content.size){return t==0&&i==this.content.size?this:this.copy(this.content.cut(t,i))}slice(t,i=this.content.size,n=!1){if(t==i)return ae.empty;let r=this.resolve(t),a=this.resolve(i),o=n?0:r.sharedDepth(i),l=r.start(o),f=r.node(o).content.cut(r.pos-l,a.pos-l);return new ae(f,r.depth-o,a.depth-o)}replace(t,i,n){return lv(this.resolve(t),this.resolve(i),n)}nodeAt(t){for(let i=this;;){let{index:n,offset:r}=i.content.findIndex(t);if(i=i.maybeChild(n),!i)return null;if(r==t||i.isText)return i;t-=r+1}}childAfter(t){let{index:i,offset:n}=this.content.findIndex(t);return{node:this.content.maybeChild(i),index:i,offset:n}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:i,offset:n}=this.content.findIndex(t);if(n<t)return{node:this.content.child(i),index:i,offset:n};let r=this.content.child(i-1);return{node:r,index:i-1,offset:n-r.nodeSize}}resolve(t){return Vn.resolveCached(this,t)}resolveNoCache(t){return Vn.resolve(this,t)}rangeHasMark(t,i,n){let r=!1;return i>t&&this.nodesBetween(t,i,a=>(n.isInSet(a.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),bu(this.marks,t)}contentMatchAt(t){let i=this.type.contentMatch.matchFragment(this.content,0,t);if(!i)throw new Error("Called contentMatchAt on a node with invalid content");return i}canReplace(t,i,n=Z.empty,r=0,a=n.childCount){let o=this.contentMatchAt(t).matchFragment(n,r,a),l=o&&o.matchFragment(this.content,i);if(!l||!l.validEnd)return!1;for(let c=r;c<a;c++)if(!this.type.allowsMarks(n.child(c).marks))return!1;return!0}canReplaceWith(t,i,n,r){if(r&&!this.type.allowsMarks(r))return!1;let a=this.contentMatchAt(t).matchType(n),o=a&&a.matchFragment(this.content,i);return o?o.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=Re.none;for(let i=0;i<this.marks.length;i++){let n=this.marks[i];n.type.checkAttrs(n.attrs),t=n.addToSet(t)}if(!Re.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(i=>i.type.name)}`);this.content.forEach(i=>i.check())}toJSON(){let t={type:this.type.name};for(let i in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(i=>i.toJSON())),t}static fromJSON(t,i){if(!i)throw new RangeError("Invalid input for Node.fromJSON");let n;if(i.marks){if(!Array.isArray(i.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=i.marks.map(t.markFromJSON)}if(i.type=="text"){if(typeof i.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(i.text,n)}let r=Z.fromJSON(t,i.content),a=t.nodeType(i.type).create(i.attrs,r,n);return a.type.checkAttrs(a.attrs),a}};Pi.prototype.text=void 0;class Yr extends Pi{constructor(t,i,n,r){if(super(t,i,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):bu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,i){return this.text.slice(t,i)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Yr(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Yr(this.type,this.attrs,t,this.marks)}cut(t=0,i=this.text.length){return t==0&&i==this.text.length?this:this.withText(this.text.slice(t,i))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function bu(e,t){for(let i=e.length-1;i>=0;i--)t=e[i].type.name+"("+t+")";return t}class Ui{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,i){let n=new dv(t,i);if(n.next==null)return Ui.empty;let r=gu(n);n.next&&n.err("Unexpected trailing text");let a=xv(yv(r));return kv(a,n),a}matchType(t){for(let i=0;i<this.next.length;i++)if(this.next[i].type==t)return this.next[i].next;return null}matchFragment(t,i=0,n=t.childCount){let r=this;for(let a=i;r&&a<n;a++)r=r.matchType(t.child(a).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:i}=this.next[t];if(!(i.isText||i.hasRequiredAttrs()))return i}return null}compatible(t){for(let i=0;i<this.next.length;i++)for(let n=0;n<t.next.length;n++)if(this.next[i].type==t.next[n].type)return!0;return!1}fillBefore(t,i=!1,n=0){let r=[this];function a(o,l){let c=o.matchFragment(t,n);if(c&&(!i||c.validEnd))return Z.from(l.map(f=>f.createAndFill()));for(let f=0;f<o.next.length;f++){let{type:p,next:m}=o.next[f];if(!(p.isText||p.hasRequiredAttrs())&&r.indexOf(m)==-1){r.push(m);let d=a(m,l.concat(p));if(d)return d}}return null}return a(this,[])}findWrapping(t){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==t)return this.wrapCache[n+1];let i=this.computeWrapping(t);return this.wrapCache.push(t,i),i}computeWrapping(t){let i=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),a=r.match;if(a.matchType(t)){let o=[];for(let l=r;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<a.next.length;o++){let{type:l,next:c}=a.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in i)&&(!r.type||c.validEnd)&&(n.push({match:l.contentMatch,type:l,via:r}),i[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function i(n){t.push(n);for(let r=0;r<n.next.length;r++)t.indexOf(n.next[r].next)==-1&&i(n.next[r].next)}return i(this),t.map((n,r)=>{let a=r+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)a+=(o?", ":"")+n.next[o].type.name+"->"+t.indexOf(n.next[o].next);return a}).join(`
442
+ */const Dt=re("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Hd=["title"],Ao=s.defineComponent({__name:"ThemeToggle",setup(e){const{isDark:t,toggle:i}=Ba(),{t:n}=rt();return(r,a)=>(s.openBlock(),s.createElementBlock("button",{type:"button",class:"p-2 rounded-lg border border-slate-200 bg-slate-50 text-slate-500 transition-colors hover:border-slate-300 hover:text-slate-700 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-400 dark:hover:border-slate-600 dark:hover:text-slate-200",title:s.unref(t)?s.unref(n)("theme.lightMode"):s.unref(n)("theme.darkMode"),onClick:a[0]||(a[0]=(...o)=>s.unref(i)&&s.unref(i)(...o))},[s.unref(t)?(s.openBlock(),s.createBlock(s.unref(Pd),{key:0,class:"h-4 w-4"})):(s.openBlock(),s.createBlock(s.unref(Sd),{key:1,class:"h-4 w-4"}))],8,Hd))}}),jd="data:image/png;base64,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",qd="data:image/png;base64,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",$d={class:"sticky top-0 z-40 flex h-14 flex-col border-b border-slate-200 bg-white transition-colors duration-200 dark:border-slate-800 dark:bg-[#0b1120]"},Wd={class:"flex h-full w-full items-center justify-between gap-4 px-3 md:px-4"},Gd={class:"flex items-center gap-3"},Kd=["title"],Xd=["src"],Jd={class:"flex min-w-0 flex-col gap-0.5"},Zd={class:"flex items-center gap-1.5"},Qd=["title"],Yd=["title"],em={class:"header-menu-container hidden items-center gap-0 md:flex"},tm=["onClick","onMouseenter"],im={key:0,class:"absolute left-0 top-full z-50 mt-1 min-w-[220px] rounded-lg border border-slate-200 bg-white py-1 text-sm text-slate-700 shadow-xl dark:border-slate-700 dark:bg-[#0e1525] dark:text-slate-200",style:{"transform-origin":"top left"}},nm={key:0,class:"my-1 border-t border-slate-100 dark:border-slate-700/80"},rm=["onMouseenter"],am={type:"button",class:"flex w-full items-center justify-between px-4 py-2 text-left hover:bg-slate-50 dark:hover:bg-white/5"},om={key:0,class:"absolute left-full top-0 z-50 ml-1 min-w-[200px] rounded-lg border border-slate-200 bg-white py-1 text-sm text-slate-700 shadow-xl dark:border-slate-700 dark:bg-[#0e1525] dark:text-slate-200"},sm=["onClick"],lm={key:0,class:"rounded bg-slate-100 px-1 py-0.5 text-[9px] font-mono text-slate-500 dark:bg-slate-700 dark:text-slate-400"},cm=["onClick"],um={key:0,class:"text-blue-600 dark:text-blue-400"},fm={key:1,class:"text-[11px] text-slate-400 dark:text-slate-500"},pm={class:"flex flex-shrink-0 items-center gap-1.5"},dm={key:0,class:"hidden items-center gap-2 lg:flex"},mm={class:"flex -space-x-1.5 overflow-hidden"},hm=["title"],bm={class:"drop-shadow-sm"},gm=["title"],vm={class:"hidden xl:block"},ym={class:"hidden sm:inline"},xm={class:"header-user-container relative flex-shrink-0"},km=["title"],wm=["src","alt"],_m={key:1,class:"flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-cyan-500 to-blue-600 text-xs font-bold text-white"},Sm={class:"hidden max-w-[140px] truncate text-sm font-medium text-slate-700 dark:text-slate-200 sm:inline"},Cm={key:0,class:"absolute right-0 top-full z-50 mt-1 min-w-[200px] rounded-lg border border-slate-200 bg-white py-1 text-sm text-slate-700 shadow-xl dark:border-slate-700 dark:bg-[#0e1525] dark:text-slate-200",style:{"transform-origin":"top right"}},Em={class:"border-b border-slate-100 px-4 py-2 dark:border-slate-700/80"},Nm={class:"truncate text-sm font-semibold text-slate-800 dark:text-slate-100"},Am={class:"header-more-container relative xl:hidden"},Om={key:0,class:"absolute right-0 top-full z-50 mt-1 min-w-[210px] rounded-lg border border-slate-200 bg-white py-1 text-sm text-slate-700 shadow-xl dark:border-slate-700 dark:bg-[#0e1525] dark:text-slate-200",style:{"transform-origin":"top right"}},Tm={class:"flex items-center justify-between px-4 py-2"},iu=s.defineComponent({__name:"HeaderBar",props:{title:{default:"Untitled Document"},editable:{type:Boolean,default:!0},collaborators:{default:()=>[]},starred:{type:Boolean,default:!1},pageless:{type:Boolean,default:!1},outlineOpen:{type:Boolean,default:!1},showRuler:{type:Boolean,default:!0},focusMode:{type:Boolean,default:!1},currentUserId:{default:""},simulatorsActive:{type:Boolean,default:!1},userName:{default:""},userAvatar:{default:""}},emits:["back","update:title","toggle-star","toggle-simulators","export","share","menu-click"],setup(e,{emit:t}){const{setLocale:i,t:n}=rt(),{isDark:r}=Ba(),a=Hc(),o=e,l=t,c=s.ref(!1),f=s.ref(o.title),p=s.ref(null),m=s.ref(null),d=s.ref(!1);s.watch(()=>o.title,j=>{f.value=j});const h=async()=>{var j,O;c.value=!0,await s.nextTick(),(j=p.value)==null||j.focus(),(O=p.value)==null||O.select()},v=()=>{const j=f.value.trim();j&&j!==o.title&&l("update:title",j),f.value=o.title,c.value=!1},b=s.computed(()=>r.value?jd:qd),y=j=>j.split(" ").map(O=>O[0]).join("").slice(0,2).toUpperCase(),g=j=>{l("export",j),m.value=null},x=s.computed(()=>y(o.userName)||"?"),k=s.ref(!1),w=typeof navigator<"u"&&/mac/i.test(navigator.platform);function C(j){return w?`⌘${j}`:`Ctrl+${j.replace("⇧","Shift+")}`}const E=s.computed(()=>({File:{label:n("header.file"),items:[{label:n("header.new"),action:"new-doc"},{label:n("header.open"),action:"open-doc"},{label:n("header.makeACopy"),action:"duplicate"},{label:"divider",divider:!0},{label:n("header.share"),action:"share"},{label:n("header.email"),action:"email"},{label:n("header.download"),sub:[{label:n("header.docx"),action:"export:docx",badge:"DOCX"},{label:n("header.pdf"),action:"export:pdf",badge:"PDF"},{label:n("header.odt"),action:"export:odt",badge:"ODT"},{label:n("header.txt"),action:"export:txt",badge:"TXT"},{label:n("header.rtf"),action:"export:rtf",badge:"RTF"},{label:n("header.htmlZip"),action:"export:html-zip",badge:"ZIP"},{label:n("header.html"),action:"export:html",badge:"HTML"},{label:n("header.markdown"),action:"export:markdown",badge:"MD"}]},{label:"divider",divider:!0},{label:n("header.rename"),action:"rename"},{label:n("header.move"),action:"move"},{label:n("header.addToStarred"),action:"add-to-starred"},{label:n("header.moveToTrash"),action:"trash"},{label:"divider",divider:!0},{label:n("header.versionHistory"),action:"version-history"},{label:"divider",divider:!0},{label:n("header.details"),action:"details"},{label:n("header.security"),action:"security"},{label:"divider",divider:!0},{label:n("header.language"),sub:a.map(j=>({label:Uc(j),action:`set-locale:${j}`}))},{label:n("header.pageSetup"),action:"page-setup"},{label:n("header.print"),action:"print"}]},Edit:{label:n("header.edit"),items:[{label:n("header.undo"),action:"undo",shortcut:C("Z")},{label:n("header.redo"),action:"redo",shortcut:C("Y")},{label:"divider",divider:!0},{label:n("header.cut"),action:"cut",shortcut:C("X")},{label:n("header.copy"),action:"copy",shortcut:C("C")},{label:n("header.paste"),action:"paste",shortcut:C("V")},{label:n("header.pasteWithoutFormatting"),action:"paste-without-formatting",shortcut:C("⇧V")},{label:"divider",divider:!0},{label:n("header.selectAll"),action:"select-all",shortcut:C("A")},{label:n("header.delete"),action:"delete"},{label:"divider",divider:!0},{label:n("header.findAndReplace"),action:"find-replace",shortcut:C("⇧H")}]},View:{label:n("header.view"),items:[{label:n("header.showSidebar"),action:"toggle-left-sidebar",checked:o.outlineOpen},{label:"divider",divider:!0},{label:n("header.focusMode"),action:"toggle-focus-mode",checked:o.focusMode},{label:n("header.showRuler"),action:"toggle-ruler",checked:o.showRuler}]},Insert:{label:n("header.insert"),items:[{label:n("header.meetingNotes"),action:"meeting-notes"},{label:n("header.emailDraft"),action:"email-draft"},{label:"divider",divider:!0},{label:n("header.image"),action:"insert-image"},{label:n("header.table"),action:"insert-table"},{label:n("header.codeBlock"),action:"insert-code"},{label:n("header.horizontalLine"),action:"horizontal-line"},{label:"divider",divider:!0},{label:n("header.link"),action:"insert-link",shortcut:C("K")},{label:"divider",divider:!0},{label:n("header.break"),sub:[{label:n("header.pageBreak"),action:"insert-page-break",shortcut:n("header.pageBreakShortcut")}]},{label:"divider",divider:!0},{label:n("header.header"),action:"insert-header"},{label:n("header.footer"),action:"insert-footer"},{label:n("header.footnote"),action:"insert-footnote"},{label:n("header.tableOfContents"),action:"insert-toc"},{label:"divider",divider:!0},{label:n("header.pageNumbers"),sub:[{label:n("header.pageNumberInHeader"),action:"page-numbers-header"},{label:n("header.pageNumberInFooter"),action:"page-numbers-footer"}]}]},Format:{label:n("header.format"),items:[{label:n("header.bold"),action:"bold"},{label:n("header.italic"),action:"italic"},{label:n("header.underline"),action:"underline"},{label:"divider",divider:!0},{label:n("header.heading1"),action:"heading1"},{label:n("header.heading2"),action:"heading2"},{label:n("header.heading3"),action:"heading3"},{label:"divider",divider:!0},{label:n("header.alignIndent"),sub:[{label:n("header.alignLeft"),action:"align-left"},{label:n("header.alignCenter"),action:"align-center"},{label:n("header.alignRight"),action:"align-right"},{label:n("header.alignJustify"),action:"align-justify"}]},{label:n("header.bulletsNumbering"),sub:[{label:n("header.bulletList"),action:"bullet-list"},{label:n("header.numberedList"),action:"numbered-list"},{label:n("header.taskList"),action:"task-list"}]},{label:"divider",divider:!0},{label:n("header.pagelessFormat"),action:"toggle-pageless",checked:o.pageless},{label:"divider",divider:!0},{label:n("header.clearFormatting"),action:"clear-formatting"}]},Tools:{label:n("header.tools"),items:[{label:n("header.spellCheck"),action:"spellcheck"},{label:n("header.wordCount"),action:"word-count"},{label:"divider",divider:!0},{label:n("header.preferences"),action:"preferences"}]},Extensions:{label:n("header.extensions"),items:[{label:n("header.manageExtensions"),action:"manage-extensions"}]},Help:{label:n("header.help"),items:[{label:n("header.keyboardShortcuts"),action:"keyboard-shortcuts"},{label:"divider",divider:!0},{label:n("header.reportIssue"),action:"report-issue"},{label:n("header.about"),action:"about"}]}})),B=s.computed(()=>Object.keys(E.value)),_=s.ref(null),S=j=>{const O=m.value!==j;m.value=O?j:null,_.value=null,d.value=O},T=s.ref(!1),D=()=>{T.value=!T.value},H=s.ref(!1),V=j=>{i(j),H.value=!1},M=s.ref(!1),$=()=>{M.value=!M.value},P=j=>{if(j.startsWith("export:")){const O=j.replace("export:","");g(O)}else if(j==="share")l("share"),m.value=null;else if(j==="add-to-starred")l("toggle-star"),m.value=null;else if(j==="rename")h(),m.value=null;else if(j.startsWith("set-locale:")){const O=j.replace("set-locale:","");V(O)}else l("menu-click",j);_.value=null,d.value=!1},W=j=>{const O=j.target;O.closest(".header-menu-container")||(m.value=null,_.value=null,d.value=!1),O.closest(".header-more-container")||(T.value=!1),O.closest(".header-user-container")||(M.value=!1)};function L(j){d.value&&m.value!==j&&(m.value=j,_.value=null)}function Q(j){m.value&&j.key==="Escape"&&(m.value=null,_.value=null,d.value=!1)}return s.onMounted(()=>{document.addEventListener("click",W,!0),document.addEventListener("keydown",Q)}),s.onUnmounted(()=>{document.removeEventListener("click",W,!0),document.removeEventListener("keydown",Q)}),(j,O)=>(s.openBlock(),s.createElementBlock("header",$d,[s.createElementVNode("div",Wd,[s.createElementVNode("div",Gd,[s.createElementVNode("button",{type:"button",class:"flex h-9 cursor-pointer items-center justify-center hover:opacity-90 transition-opacity",title:s.unref(n)("header.backToDocuments"),onClick:O[0]||(O[0]=R=>l("back"))},[s.createElementVNode("img",{src:b.value,alt:"Docflow",class:"h-9 w-auto"},null,8,Xd)],8,Kd),s.createElementVNode("div",Jd,[s.createElementVNode("div",Zd,[c.value?s.withDirectives((s.openBlock(),s.createElementBlock("input",{key:0,ref_key:"titleInputEl",ref:p,"onUpdate:modelValue":O[1]||(O[1]=R=>f.value=R),type:"text",class:"min-w-[150px] border-b-2 border-cyan-500 bg-transparent px-1 py-0 text-sm font-semibold text-slate-800 focus:outline-none dark:text-slate-100 md:min-w-[240px]",onBlur:v,onKeydown:s.withKeys(v,["enter"])},null,544)),[[s.vModelText,f.value]]):(s.openBlock(),s.createElementBlock("h1",{key:1,class:"max-w-[180px] cursor-text truncate rounded px-1 py-0 text-sm font-semibold text-slate-800 hover:bg-slate-50 dark:text-slate-100 dark:hover:bg-slate-800/60 md:max-w-[280px]",title:s.unref(n)("header.clickToRename"),onClick:O[2]||(O[2]=R=>void h())},s.toDisplayString(o.title),9,Qd)),s.createElementVNode("button",{type:"button",class:"flex h-6 w-6 items-center justify-center rounded-full text-slate-400 transition-colors hover:text-amber-500",title:e.starred?s.unref(n)("header.unstarDocument"):s.unref(n)("header.starDocument"),onClick:O[3]||(O[3]=R=>l("toggle-star"))},[s.createVNode(s.unref(Ld),{class:s.normalizeClass(["h-4 w-4",e.starred?"fill-amber-400 text-amber-500":""])},null,8,["class"])],8,Yd)]),s.createElementVNode("nav",em,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(B.value,R=>(s.openBlock(),s.createElementBlock("div",{key:R,class:"relative"},[s.createElementVNode("button",{type:"button",class:s.normalizeClass(["flex items-center gap-0.5 rounded px-2 py-0.5 text-[13px] transition-colors",m.value===R?"bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300":"text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800"]),onClick:s.withModifiers(U=>S(R),["stop"]),onMouseenter:U=>L(R)},s.toDisplayString(E.value[R].label),43,tm),s.createVNode(s.Transition,{"enter-active-class":"transition-all duration-150 ease-out","enter-from-class":"opacity-0 scale-95 translate-y-[-4px]","enter-to-class":"opacity-100 scale-100 translate-y-0","leave-active-class":"transition-all duration-100 ease-in","leave-from-class":"opacity-100 scale-100 translate-y-0","leave-to-class":"opacity-0 scale-95 translate-y-[-4px]"},{default:s.withCtx(()=>[m.value===R?(s.openBlock(),s.createElementBlock("div",im,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(E.value[R].items,(U,oe)=>(s.openBlock(),s.createElementBlock(s.Fragment,{key:oe},[U.divider?(s.openBlock(),s.createElementBlock("div",nm)):U.sub?(s.openBlock(),s.createElementBlock("div",{key:1,class:"relative",onMouseenter:ie=>_.value=`${R}-${oe}`,onMouseleave:O[4]||(O[4]=ie=>_.value=null)},[s.createElementVNode("button",am,[s.createElementVNode("span",null,s.toDisplayString(U.label),1),s.createVNode(s.unref(ei),{class:"h-3.5 w-3.5 -rotate-90 text-slate-400"})]),s.createVNode(s.Transition,{"enter-active-class":"transition-all duration-100 ease-out","enter-from-class":"opacity-0 translate-x-2","enter-to-class":"opacity-100 translate-x-0","leave-active-class":"transition-all duration-75 ease-in","leave-from-class":"opacity-100 translate-x-0","leave-to-class":"opacity-0 translate-x-2"},{default:s.withCtx(()=>[_.value===`${R}-${oe}`?(s.openBlock(),s.createElementBlock("div",om,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(U.sub,ie=>(s.openBlock(),s.createElementBlock("button",{key:ie.action,type:"button",class:"flex w-full items-center justify-between px-4 py-2 text-left hover:bg-slate-50 dark:hover:bg-white/5",onClick:s.withModifiers(ee=>P(ie.action),["stop"])},[s.createElementVNode("span",null,s.toDisplayString(ie.label),1),ie.badge?(s.openBlock(),s.createElementBlock("span",lm,s.toDisplayString(ie.badge),1)):s.createCommentVNode("",!0)],8,sm))),128))])):s.createCommentVNode("",!0)]),_:2},1024)],40,rm)):(s.openBlock(),s.createElementBlock("button",{key:2,type:"button",class:"flex w-full items-center justify-between gap-6 px-4 py-2 text-left hover:bg-slate-50 dark:hover:bg-white/5",onClick:s.withModifiers(ie=>P(U.action),["stop"])},[s.createElementVNode("span",null,s.toDisplayString(U.label),1),U.checked?(s.openBlock(),s.createElementBlock("span",um,[s.createVNode(s.unref(Wr),{class:"h-3.5 w-3.5"})])):U.shortcut?(s.openBlock(),s.createElementBlock("span",fm,s.toDisplayString(U.shortcut),1)):s.createCommentVNode("",!0)],8,cm))],64))),128))])):s.createCommentVNode("",!0)]),_:2},1024)]))),128))])])]),s.createElementVNode("div",pm,[e.collaborators.length>0?(s.openBlock(),s.createElementBlock("div",dm,[s.createElementVNode("div",mm,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.collaborators,R=>(s.openBlock(),s.createElementBlock("div",{key:R.userId,class:"flex h-7 w-7 flex-shrink-0 cursor-help items-center justify-center rounded-full border-2 border-white text-[10px] font-bold text-white dark:border-slate-900",style:s.normalizeStyle({backgroundColor:R.color}),title:`${R.name} ${R.userId===e.currentUserId?"(You)":""} ${R.isTyping?"is typing...":""}`},[s.createElementVNode("span",bm,s.toDisplayString(y(R.name)),1)],12,hm))),128))])])):s.createCommentVNode("",!0),s.renderSlot(j.$slots,"actions"),e.editable?(s.openBlock(),s.createElementBlock("button",{key:1,type:"button",class:s.normalizeClass(["hidden h-8 w-8 items-center justify-center rounded-md transition-all xl:flex",e.simulatorsActive?"animate-pulse bg-emerald-600 text-white hover:bg-emerald-700":"text-indigo-600 hover:bg-slate-100 dark:text-indigo-300 dark:hover:bg-slate-800"]),title:s.unref(n)("header.sandbox"),onClick:O[5]||(O[5]=R=>l("toggle-simulators"))},[s.createVNode(s.unref(bl),{class:"h-[18px] w-[18px]"})],10,gm)):s.createCommentVNode("",!0),s.createElementVNode("div",vm,[s.createVNode(Ao)]),s.createElementVNode("button",{type:"button",class:"flex h-8 items-center gap-1.5 rounded-md bg-blue-600 px-3 text-[13px] font-semibold text-white shadow transition-colors hover:bg-blue-700",onClick:O[6]||(O[6]=R=>l("share"))},[s.createVNode(s.unref(zd),{class:"h-3.5 w-3.5"}),s.createElementVNode("span",ym,s.toDisplayString(s.unref(n)("header.share")),1)]),s.createElementVNode("div",xm,[s.createElementVNode("button",{type:"button",class:"flex h-8 items-center gap-1.5 rounded-full py-0.5 pl-0.5 pr-1.5 transition-colors hover:bg-slate-100 dark:hover:bg-slate-800",title:e.userName,onClick:s.withModifiers($,["stop"])},[e.userAvatar&&!k.value?(s.openBlock(),s.createElementBlock("img",{key:0,src:e.userAvatar,alt:e.userName,referrerpolicy:"no-referrer",class:"h-7 w-7 flex-shrink-0 rounded-full object-cover",onError:O[7]||(O[7]=R=>k.value=!0)},null,40,wm)):(s.openBlock(),s.createElementBlock("span",_m,s.toDisplayString(x.value),1)),s.createElementVNode("span",Sm,s.toDisplayString(e.userName||s.unref(n)("header.account")),1),s.createVNode(s.unref(ei),{class:"h-3.5 w-3.5 flex-shrink-0 text-slate-400"})],8,km),s.createVNode(s.Transition,{"enter-active-class":"transition-all duration-150 ease-out","enter-from-class":"opacity-0 scale-95 translate-y-[-4px]","enter-to-class":"opacity-100 scale-100 translate-y-0","leave-active-class":"transition-all duration-100 ease-in","leave-from-class":"opacity-100 scale-100 translate-y-0","leave-to-class":"opacity-0 scale-95 translate-y-[-4px]"},{default:s.withCtx(()=>[M.value?(s.openBlock(),s.createElementBlock("div",Cm,[s.createElementVNode("div",Em,[s.createElementVNode("p",Nm,s.toDisplayString(e.userName||s.unref(n)("header.account")),1)]),s.renderSlot(j.$slots,"user-menu",{close:()=>M.value=!1})])):s.createCommentVNode("",!0)]),_:3})]),s.createElementVNode("div",Am,[s.createElementVNode("button",{type:"button",class:"flex h-8 w-8 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-slate-800",title:"More",onClick:s.withModifiers(D,["stop"])},[s.createVNode(s.unref(Wc),{class:"h-[18px] w-[18px]"})]),s.createVNode(s.Transition,{"enter-active-class":"transition-all duration-150 ease-out","enter-from-class":"opacity-0 scale-95 translate-y-[-4px]","enter-to-class":"opacity-100 scale-100 translate-y-0","leave-active-class":"transition-all duration-100 ease-in","leave-from-class":"opacity-100 scale-100 translate-y-0","leave-to-class":"opacity-0 scale-95 translate-y-[-4px]"},{default:s.withCtx(()=>[T.value?(s.openBlock(),s.createElementBlock("div",Om,[s.renderSlot(j.$slots,"overflow-actions",{close:()=>T.value=!1}),e.editable?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-slate-50 dark:hover:bg-white/5",onClick:O[8]||(O[8]=R=>{l("toggle-simulators"),T.value=!1})},[s.createVNode(s.unref(bl),{class:"h-4 w-4 text-slate-400"}),s.createElementVNode("span",null,s.toDisplayString(s.unref(n)("header.sandbox")),1)])):s.createCommentVNode("",!0),O[9]||(O[9]=s.createElementVNode("div",{class:"my-1 border-t border-slate-100 dark:border-slate-700/80"},null,-1)),s.createElementVNode("div",Tm,[s.createElementVNode("span",null,s.toDisplayString(s.unref(n)("header.theme")),1),s.createVNode(Ao)])])):s.createCommentVNode("",!0)]),_:3})])])])]))}}),Mm={class:"mb-3 grid grid-cols-10 gap-1.5"},zm=["title","onClick"],Im={class:"space-y-2"},Dm=["title","onClick"],Rm={class:"mt-3 border-t border-slate-100 pt-3 dark:border-slate-700"},Lm={class:"mb-2 text-[10px] font-semibold uppercase tracking-wide text-slate-500 dark:text-slate-400"},Bm={class:"flex items-center gap-2"},Pm={class:"flex h-6 w-6 items-center justify-center rounded-full border border-slate-200 dark:border-slate-600"},gl=s.defineComponent({__name:"ColorPickerDropdown",props:{isOpen:{type:Boolean},activeColor:{},defaultColor:{},label:{}},emits:["select","reset","close"],setup(e,{emit:t}){const i=e,n=t,r=[["#000000","#434343","#666666","#999999","#b7b7b7","#cccccc","#d9d9d9","#ffffff"],["#980000","#ff0000","#ff9900","#ffff00","#00ff00","#00ffff","#4a86e8","#0000ff","#9900ff","#ff00ff"],["#e6b8af","#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#c9daf8","#cfe2f3","#d9d2e9","#ead1dc"],["#dd7e6b","#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#a4c2f4","#9fc5e8","#b4a7d6","#d5a6bd"],["#cc4125","#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6d9eeb","#6fa8dc","#8e7cc3","#c27ba0"],["#a61c00","#cc0000","#e69138","#f1c232","#6aa84f","#45818e","#3c78d8","#3d85c6","#674ea7","#a64d79"],["#85200c","#990000","#b45f06","#bf9000","#38761d","#134f5c","#1155cc","#0b5394","#351c75","#741b47"],["#5b0f00","#660000","#783f04","#7f6000","#274e13","#0c343d","#1c4587","#073763","#20124d","#4a1130"]],a=s.ref("#000000"),o=s.ref(null);s.watch(()=>i.isOpen,m=>{m&&(a.value=i.activeColor||"#000000")});function l(m){n("select",m)}function c(){n("reset")}function f(){n("select",a.value)}function p(m){m.target===m.currentTarget&&n("close")}return(m,d)=>e.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"color-picker-dropdown absolute left-0 top-full z-50 mt-1.5 w-[272px] rounded-lg border border-slate-200 bg-white p-3 shadow-xl dark:border-slate-700 dark:bg-[#0e1525]",onClick:p},[s.createElementVNode("div",Mm,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r[0],h=>(s.openBlock(),s.createElementBlock("button",{key:h,type:"button",class:"h-5 w-5 rounded-full border border-slate-200 transition-transform hover:scale-110 focus:outline-none focus:ring-2 focus:ring-cyan-500 dark:border-slate-600",style:s.normalizeStyle({backgroundColor:h}),title:h,onClick:v=>l(h)},null,12,zm))),128))]),s.createElementVNode("div",Im,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(r.slice(1),(h,v)=>(s.openBlock(),s.createElementBlock("div",{key:v,class:"grid grid-cols-10 gap-1.5"},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(h,b=>(s.openBlock(),s.createElementBlock("button",{key:b,type:"button",class:"h-5 w-5 rounded-full border border-slate-200 transition-transform hover:scale-110 focus:outline-none focus:ring-2 focus:ring-cyan-500 dark:border-slate-600",style:s.normalizeStyle({backgroundColor:b}),title:b,onClick:y=>l(b)},null,12,Dm))),128))]))),128))]),s.createElementVNode("div",Rm,[s.createElementVNode("div",Lm,s.toDisplayString(m.$props.label||"Custom"),1),s.createElementVNode("div",Bm,[s.createElementVNode("button",{type:"button",class:"flex h-6 w-6 items-center justify-center rounded-full border border-slate-200 bg-slate-50 hover:bg-slate-100 dark:border-slate-600 dark:bg-slate-800 dark:hover:bg-slate-700",onClick:d[0]||(d[0]=h=>{var v;return(v=o.value)==null?void 0:v.click()})},[s.createVNode(s.unref(gi),{class:"h-3.5 w-3.5 text-slate-600 dark:text-slate-300"})]),s.withDirectives(s.createElementVNode("input",{ref_key:"customInput",ref:o,"onUpdate:modelValue":d[1]||(d[1]=h=>a.value=h),type:"color",class:"sr-only",onChange:f},null,544),[[s.vModelText,a.value]]),s.createElementVNode("div",Pm,[s.createElementVNode("div",{class:"h-4 w-4 rounded-full",style:s.normalizeStyle({backgroundColor:a.value})},null,4)]),s.createElementVNode("button",{type:"button",class:"ml-auto flex h-6 items-center gap-1 rounded-md px-2 text-[11px] font-medium text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-700",onClick:c},[s.createVNode(s.unref(eu),{class:"h-3 w-3"}),d[2]||(d[2]=s.createTextVNode(" Default ",-1))])])])])):s.createCommentVNode("",!0)}}),Vm={id:"editor-toolbar-row",class:"docs-editor-toolbar w-full border-b border-slate-200 bg-white py-1.5 text-slate-600 shadow-sm dark:border-slate-800 dark:bg-[#0b1120] dark:text-slate-300"},Fm={class:"flex min-h-9 w-full items-center gap-1 px-3 flex-nowrap"},Um=["title","aria-label","disabled"],Hm=["title","aria-label","disabled"],jm=["title","aria-label"],qm=["title","aria-label","disabled"],$m=["title","aria-label"],Wm={class:"toolbar-dropdown relative flex-shrink-0"},Gm=["title","aria-label","disabled"],Km={class:"truncate"},Xm={key:0,class:"absolute left-0 top-full z-50 mt-1 min-w-[180px] rounded-lg border border-slate-200 bg-white py-1 text-sm shadow-xl dark:border-slate-700 dark:bg-[#0e1525]"},Jm=["disabled","onClick"],Zm={class:"toolbar-dropdown relative flex-shrink-0"},Qm=["title","aria-label","disabled"],Ym={class:"truncate"},eh={key:0,class:"absolute left-0 top-full z-50 mt-1 min-w-[160px] rounded-lg border border-slate-200 bg-white py-1 text-sm shadow-xl dark:border-slate-700 dark:bg-[#0e1525]"},th=["onClick"],ih=["title","aria-label","disabled"],nh=["value","title","aria-label","disabled","onKeydown"],rh=["title","aria-label","disabled"],ah=["title","aria-label","disabled","onClick"],oh={key:1,class:"text-xs font-medium leading-none"},sh={key:0,class:"mx-1 h-5 w-px flex-shrink-0 bg-slate-200 dark:bg-white/10"},lh={key:1,class:"toolbar-dropdown relative flex-shrink-0"},ch=["title","aria-label","disabled"],uh={key:2,class:"toolbar-dropdown relative flex-shrink-0"},fh=["title","aria-label","disabled"],ph={key:3,class:"mx-1 h-5 w-px flex-shrink-0 bg-slate-200 dark:bg-white/10"},dh={key:4,class:"toolbar-dropdown relative flex-shrink-0"},mh=["title","aria-label","disabled"],hh={key:0,class:"absolute left-0 top-full z-50 mt-1 min-w-[180px] rounded-lg border border-slate-200 bg-white py-1 text-sm shadow-xl dark:border-slate-700 dark:bg-[#0e1525]"},bh=["disabled","onClick"],gh={key:5,class:"toolbar-dropdown relative flex-shrink-0"},vh=["title","aria-label","disabled"],yh={key:0,class:"absolute left-0 top-full z-50 mt-1 min-w-[160px] rounded-lg border border-slate-200 bg-white py-1 text-sm shadow-xl dark:border-slate-700 dark:bg-[#0e1525]"},xh=["disabled","onClick"],kh={key:6,class:"toolbar-dropdown relative flex-shrink-0"},wh=["title","aria-label","disabled"],_h={class:"hidden md:inline"},Sh={key:0,class:"absolute left-0 top-full z-50 mt-1 min-w-[190px] rounded-lg border border-slate-200 bg-white py-1 text-sm shadow-xl dark:border-slate-700 dark:bg-[#0e1525]"},Ch=["disabled","onClick"],Eh=["title","aria-label"],Nh=["title","aria-label"],Ah=["title","aria-label"],Oh=["title","aria-label"],Th=["title","aria-label"],Mh="bg-slate-200 text-slate-900 dark:bg-slate-700 dark:text-slate-100",zh="text-slate-600 dark:text-slate-300 hover:text-slate-900 dark:hover:text-slate-100 hover:bg-slate-100 dark:hover:bg-white/5",bt="docs-editor-toolbar__control inline-flex h-8 flex-shrink-0 items-center justify-center rounded-md p-1 text-slate-600 transition-all disabled:opacity-40 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-white/5",Ih="bg-slate-200 text-slate-900 dark:bg-slate-700 dark:text-slate-100",Dh="text-slate-500 dark:text-slate-400 hover:text-slate-900 dark:hover:text-slate-100 hover:bg-slate-100 dark:hover:bg-white/5",vl=11,Rh=1,Lh=400,nu=s.defineComponent({__name:"EditorToolbar",props:{actions:{},plugins:{},editor:{},activeSidebar:{}},emits:["toggle-sidebar","print","undo","redo","toggle-left-sidebar"],setup(e,{emit:t}){const{t:i}=rt(),n=e,r=t,a={Bold:qc,Italic:Jc,Underline:tu,Strikethrough:Bd,Heading1:ud,Heading2:fd,Heading3:pd,Heading4:dd,Heading5:md,Heading6:hd,List:Gr,ListOrdered:gd,CheckSquare:Rd,Quote:Kr,Link:Qc,Code:ad,Image:bd,Table:Vd,AlignLeft:No,AlignCenter:dl,AlignRight:ml,AlignJustify:hl,FileText:sn,Palette:fl,Highlighter:ul};function o(K){return K?a[K]??null:null}const l=s.computed(()=>{const K=[];for(const I of n.plugins??[])!I.toolbar||I.toolbar.length===0||K.push({pluginId:I.id,items:I.toolbar});return K}),c=s.ref(0);function f(){c.value++}s.watch(()=>n.editor,(K,I)=>{I&&I.off("transaction",f),K&&K.on("transaction",f)},{immediate:!0}),s.onUnmounted(()=>{n.editor&&n.editor.off("transaction",f)});function p(K){c.value;const I=n.editor;if(!I)return!1;switch(K.action){case"toggleBold":return I.isActive("bold");case"toggleItalic":return I.isActive("italic");case"toggleUnderline":return I.isActive("underline");case"toggleStrike":return I.isActive("strike");case"toggleHeading1":return I.isActive("heading",{level:1});case"toggleHeading2":return I.isActive("heading",{level:2});case"toggleHeading3":return I.isActive("heading",{level:3});case"toggleHeading4":return I.isActive("heading",{level:4});case"toggleHeading5":return I.isActive("heading",{level:5});case"toggleHeading6":return I.isActive("heading",{level:6});case"toggleBulletList":return I.isActive("bulletList");case"toggleOrderedList":return I.isActive("orderedList");case"toggleTaskList":return I.isActive("taskList");case"toggleBlockquote":return I.isActive("blockquote");case"toggleCodeBlock":return I.isActive("codeBlock");case"setLink":return I.isActive("link");case"alignLeft":return I.isActive({textAlign:"left"});case"alignCenter":return I.isActive({textAlign:"center"});case"alignRight":return I.isActive({textAlign:"right"});case"alignJustify":return I.isActive({textAlign:"justify"});default:return!1}}function m(K){if(!n.editor)return;const I=n.actions[K.action];if(typeof I=="function"){I(...K.args??[]),n.editor.commands.focus();return}const J=n.editor.commands[K.action];typeof J=="function"&&(J(...K.args??[]),n.editor.commands.focus())}const d=s.computed(()=>{var K;return c.value,(K=n.editor)==null?void 0:K.getAttributes("textStyle").color}),h=s.computed(()=>{var I,J;c.value;const K=(I=n.editor)==null?void 0:I.getAttributes("highlight");if(K!=null&&K.color)return K.color;if((J=n.editor)!=null&&J.isActive("highlight"))return"#ffff00"});function v(K,I){var ze,Ue,qe;const J=n.actions[K];if(typeof J=="function")J(I);else{const jt=(Ue=(ze=n.editor)==null?void 0:ze.commands)==null?void 0:Ue[K];typeof jt=="function"&&jt(I)}(qe=n.editor)==null||qe.commands.focus(),M.value=null}function b(K){var J,ze,Ue,qe;const I=(J=n.editor)==null?void 0:J.chain().focus();if(!I){M.value=null;return}K==="setTextColor"?(ze=I.unsetColor)==null||ze.call(I).run():K==="setHighlight"&&((Ue=I.unsetHighlight)==null||Ue.call(I).run()),(qe=n.editor)==null||qe.commands.focus(),M.value=null}const y=["toggleHeading1","toggleHeading2","toggleHeading3","toggleHeading4","toggleHeading5","toggleHeading6"],g=["alignLeft","alignCenter","alignRight","alignJustify"],x=["toggleBulletList","toggleOrderedList","toggleTaskList"],k=["setLink","insertImage","insertTable","toggleBlockquote","toggleCodeBlock","insertFootnote","insertPageBreak","setPageBreak","togglePageBreak","addPageBreak"],w=["setTextColor","setHighlight"],C=s.computed(()=>l.value.flatMap(K=>K.items)),E=s.computed(()=>C.value.filter(K=>g.includes(K.action))),B=s.computed(()=>C.value.filter(K=>x.includes(K.action))),_=s.computed(()=>C.value.filter(K=>k.includes(K.action))),S=s.computed(()=>C.value.filter(K=>w.includes(K.action))),T=s.computed(()=>S.value.find(K=>K.action==="setTextColor")),D=s.computed(()=>S.value.find(K=>K.action==="setHighlight")),H=s.computed(()=>C.value.filter(K=>!y.includes(K.action)&&!g.includes(K.action)&&!x.includes(K.action)&&!k.includes(K.action)&&!w.includes(K.action))),V=s.computed(()=>{c.value;const K=n.editor;if(K){if(K.isActive({textAlign:"center"}))return dl;if(K.isActive({textAlign:"right"}))return ml;if(K.isActive({textAlign:"justify"}))return hl}return No}),M=s.ref(null);function $(K){M.value=M.value===K?null:K}function P(K){m(K),M.value=null}function W(K){K.target.closest(".toolbar-dropdown")||(M.value=null)}s.onMounted(()=>document.addEventListener("click",W,!0)),s.onUnmounted(()=>document.removeEventListener("click",W,!0));function L(K){return n.activeSidebar===K?Ih:Dh}const Q=s.computed(()=>{var K;return((K=n.plugins)==null?void 0:K.some(I=>I.id==="citation"))??!1}),j=s.computed(()=>{var K,I,J;return!!((J=(I=(K=n.editor)==null?void 0:K.storage)==null?void 0:I.editorContext)!=null&&J.aiStream)});function O(){n.editor&&(n.editor.commands.undo(),n.editor.commands.focus()),r("undo")}function R(){n.editor&&(n.editor.commands.redo(),n.editor.commands.focus()),r("redo")}function U(){r("print")}const oe=s.computed(()=>[{value:"paragraph",label:i("toolbar.normalText")},{value:"heading-1",label:i("header.heading1")},{value:"heading-2",label:i("header.heading2")},{value:"heading-3",label:i("header.heading3")},{value:"heading-4",label:i("header.heading4")},{value:"heading-5",label:i("header.heading5")},{value:"heading-6",label:i("header.heading6")}]);function ie(K){const I=n.editor;if(I){if(K==="paragraph")I.commands.setParagraph();else{const J=parseInt(K.replace("heading-",""),10),ze=n.actions[`toggleHeading${J}`];typeof ze=="function"?ze():I.commands.toggleHeading({level:J})}I.commands.focus()}M.value=null}const ee=s.computed(()=>{c.value;const K=n.editor;if(!K)return"paragraph";for(let I=1;I<=6;I++)if(K.isActive("heading",{level:I}))return`heading-${I}`;return"paragraph"}),te=s.computed(()=>{var K;return((K=oe.value.find(I=>I.value===ee.value))==null?void 0:K.label)??i("toolbar.normalText")}),X=[{value:"arial",label:"Arial"},{value:"inter",label:"Inter"},{value:"serif",label:"Serif"},{value:"mono",label:"Monospace"}],F=s.ref("arial"),q=s.computed(()=>{var K;return((K=X.find(I=>I.value===F.value))==null?void 0:K.label)??"Arial"});function ne(K){var I;F.value=K,M.value=null,(I=n.editor)==null||I.commands.focus()}const se=[8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72],Se=s.computed(()=>{var ze;c.value;const K=n.editor;if(!K)return vl;const I=K.getAttributes("textStyle");if(I!=null&&I.fontSize){const Ue=parseInt(I.fontSize,10);if(!isNaN(Ue))return Ue}const J=K.state.storedMarks;if(J){for(const Ue of J)if(Ue.type.name==="textStyle"&&Ue.attrs.fontSize){const qe=parseInt(Ue.attrs.fontSize,10);if(!isNaN(qe))return qe}}if((ze=K.view)!=null&&ze.dom){const Ue=parseFloat(getComputedStyle(K.view.dom).fontSize);if(!isNaN(Ue)){const qe=Math.round(Ue);return se.reduce((pt,dt)=>Math.abs(dt-qe)<Math.abs(pt-qe)?dt:pt)}}return vl});function Ae(K){if(!n.editor)return;const I=Se.value,J=se.indexOf(I);let ze;J>=0?ze=se[Math.min(Math.max(J+K,0),se.length-1)]:K<0?ze=[...se].reverse().find(qe=>qe<I)??se[0]:ze=se.find(qe=>qe>I)??I,n.editor.commands.setFontSize(`${ze}px`),n.editor.commands.focus()}const fe=s.ref(null);function ke(K){fe.value=String(Se.value),K.target.select()}function G(K){fe.value=K.target.value}function yt(K){if(!n.editor)return;const I=Math.min(Math.max(K,Rh),Lh);n.editor.commands.setFontSize(`${I}px`)}function we(K){var J;const I=parseInt(K.target.value,10);!isNaN(I)&&I!==Se.value&&yt(I),fe.value=null,(J=n.editor)==null||J.commands.focus()}function At(K){var J;fe.value=null;const I=K.target;I.value=String(Se.value),I.blur(),(J=n.editor)==null||J.commands.focus()}return(K,I)=>(s.openBlock(),s.createElementBlock("div",Vm,[s.createElementVNode("div",Fm,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-8"]),title:s.unref(i)("toolbar.undo"),"aria-label":s.unref(i)("toolbar.undo"),disabled:!e.editor,onMousedown:I[0]||(I[0]=s.withModifiers(()=>{},["prevent"])),onClick:O},[s.createVNode(s.unref(Fd),{class:"h-[18px] w-[18px]"})],42,Um),s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-8"]),title:s.unref(i)("toolbar.redo"),"aria-label":s.unref(i)("toolbar.redo"),disabled:!e.editor,onMousedown:I[1]||(I[1]=s.withModifiers(()=>{},["prevent"])),onClick:R},[s.createVNode(s.unref(Ad),{class:"h-[18px] w-[18px]"})],42,Hm),I[39]||(I[39]=s.createElementVNode("span",{class:"mx-1 h-5 w-px flex-shrink-0 bg-slate-200 dark:bg-white/10"},null,-1)),s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-8"]),title:s.unref(i)("toolbar.print"),"aria-label":s.unref(i)("toolbar.print"),onMousedown:I[2]||(I[2]=s.withModifiers(()=>{},["prevent"])),onClick:U},[s.createVNode(s.unref(Nd),{class:"h-[18px] w-[18px]"})],42,jm),s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-8"]),title:s.unref(i)("toolbar.spelling"),"aria-label":s.unref(i)("toolbar.spelling"),disabled:!e.editor,onMousedown:I[3]||(I[3]=s.withModifiers(()=>{},["prevent"]))},[s.createVNode(s.unref(Dd),{class:"h-[18px] w-[18px]"})],42,qm),s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"px-2 text-xs"]),title:s.unref(i)("toolbar.zoom"),"aria-label":s.unref(i)("toolbar.zoom"),onMousedown:I[4]||(I[4]=s.withModifiers(()=>{},["prevent"]))},s.toDisplayString(s.unref(i)("toolbar.zoom")),43,$m),I[40]||(I[40]=s.createElementVNode("span",{class:"mx-1 h-5 w-px flex-shrink-0 bg-slate-200 dark:bg-white/10"},null,-1)),s.createElementVNode("div",Wm,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-[116px] justify-between gap-1 px-2 text-xs font-medium"]),title:s.unref(i)("toolbar.paragraphStyle"),"aria-label":s.unref(i)("toolbar.paragraphStyle"),disabled:!e.editor,onMousedown:I[5]||(I[5]=s.withModifiers(()=>{},["prevent"])),onClick:I[6]||(I[6]=s.withModifiers(J=>$("heading"),["stop"]))},[s.createElementVNode("span",Km,s.toDisplayString(te.value),1),s.createVNode(s.unref(ei),{class:"h-3.5 w-3.5 flex-shrink-0 text-slate-400"})],42,Gm),M.value==="heading"?(s.openBlock(),s.createElementBlock("div",Xm,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(oe.value,J=>(s.openBlock(),s.createElementBlock("button",{key:J.value,type:"button",class:s.normalizeClass(["flex w-full items-center px-3 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-white/5",ee.value===J.value?"text-blue-600 dark:text-blue-300":"text-slate-700 dark:text-slate-200"]),disabled:!e.editor,onMousedown:I[7]||(I[7]=s.withModifiers(()=>{},["prevent"])),onClick:ze=>ie(J.value)},s.toDisplayString(J.label),43,Jm))),128))])):s.createCommentVNode("",!0)]),s.createElementVNode("div",Zm,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-[100px] justify-between gap-1 px-2 text-xs font-medium"]),title:s.unref(i)("toolbar.fontFamily"),"aria-label":s.unref(i)("toolbar.fontFamily"),disabled:!e.editor,onMousedown:I[8]||(I[8]=s.withModifiers(()=>{},["prevent"])),onClick:I[9]||(I[9]=s.withModifiers(J=>$("font"),["stop"]))},[s.createElementVNode("span",Ym,s.toDisplayString(q.value),1),s.createVNode(s.unref(ei),{class:"h-3.5 w-3.5 flex-shrink-0 text-slate-400"})],42,Qm),M.value==="font"?(s.openBlock(),s.createElementBlock("div",eh,[(s.openBlock(),s.createElementBlock(s.Fragment,null,s.renderList(X,J=>s.createElementVNode("button",{key:J.value,type:"button",class:s.normalizeClass(["flex w-full items-center px-3 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-white/5",F.value===J.value?"text-blue-600 dark:text-blue-300":"text-slate-700 dark:text-slate-200"]),onMousedown:I[10]||(I[10]=s.withModifiers(()=>{},["prevent"])),onClick:ze=>ne(J.value)},s.toDisplayString(J.label),43,th)),64))])):s.createCommentVNode("",!0)]),s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-7 text-sm"]),title:s.unref(i)("toolbar.decreaseFontSize"),"aria-label":s.unref(i)("toolbar.decreaseFontSize"),disabled:!e.editor,onMousedown:I[11]||(I[11]=s.withModifiers(J=>Ae(-1),["prevent"]))},[s.createVNode(s.unref(_d),{class:"h-3.5 w-3.5"})],42,ih),s.createElementVNode("input",{type:"text",inputmode:"numeric",class:"h-8 w-8 flex-shrink-0 rounded border border-transparent bg-transparent text-center text-xs text-slate-700 outline-none transition hover:border-slate-300 focus:border-cyan-400 focus:bg-white disabled:opacity-40 dark:text-slate-200 dark:hover:border-slate-600 dark:focus:bg-slate-800",value:fe.value??String(Se.value),title:s.unref(i)("toolbar.fontSize"),"aria-label":s.unref(i)("toolbar.fontSize"),disabled:!e.editor,onFocus:ke,onInput:G,onKeydown:[I[12]||(I[12]=s.withKeys(s.withModifiers(J=>J.target.blur(),["prevent"]),["enter"])),s.withKeys(s.withModifiers(At,["prevent"]),["esc"])],onBlur:we},null,40,nh),s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-7 text-sm"]),title:s.unref(i)("toolbar.increaseFontSize"),"aria-label":s.unref(i)("toolbar.increaseFontSize"),disabled:!e.editor,onMousedown:I[13]||(I[13]=s.withModifiers(J=>Ae(1),["prevent"]))},[s.createVNode(s.unref(gi),{class:"h-3.5 w-3.5"})],42,rh),I[41]||(I[41]=s.createElementVNode("span",{class:"mx-1 h-5 w-px flex-shrink-0 bg-slate-200 dark:bg-white/10"},null,-1)),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(H.value,J=>(s.openBlock(),s.createElementBlock("button",{key:J.id,type:"button",title:J.label??J.id,"aria-label":J.label??J.id,class:s.normalizeClass(["docs-editor-toolbar__button inline-flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-md p-1 transition-all disabled:opacity-40",p(J)?Mh:zh]),disabled:!e.editor,onMousedown:I[14]||(I[14]=s.withModifiers(()=>{},["prevent"])),onClick:ze=>m(J)},[o(J.iconComponent)?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(o(J.iconComponent)),{key:0,class:"h-[18px] w-[18px]"})):J.label?(s.openBlock(),s.createElementBlock("span",oh,s.toDisplayString(J.label.charAt(0)),1)):s.createCommentVNode("",!0)],42,ah))),128)),S.value.length?(s.openBlock(),s.createElementBlock("span",sh)):s.createCommentVNode("",!0),T.value?(s.openBlock(),s.createElementBlock("div",lh,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-8"]),title:T.value.label??"Text color","aria-label":T.value.label??"Text color",disabled:!e.editor,onMousedown:I[15]||(I[15]=s.withModifiers(()=>{},["prevent"])),onClick:I[16]||(I[16]=s.withModifiers(J=>$("textColor"),["stop"]))},[s.createVNode(s.unref(fl),{class:"h-[18px] w-[18px]"})],42,ch),s.createVNode(gl,{"is-open":M.value==="textColor","active-color":d.value,label:"Custom",onSelect:I[17]||(I[17]=J=>v("setTextColor",J)),onReset:I[18]||(I[18]=J=>b("setTextColor")),onClose:I[19]||(I[19]=J=>M.value=null)},null,8,["is-open","active-color"])])):s.createCommentVNode("",!0),D.value?(s.openBlock(),s.createElementBlock("div",uh,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"w-8"]),title:D.value.label??"Highlight","aria-label":D.value.label??"Highlight",disabled:!e.editor,onMousedown:I[20]||(I[20]=s.withModifiers(()=>{},["prevent"])),onClick:I[21]||(I[21]=s.withModifiers(J=>$("highlight"),["stop"]))},[s.createVNode(s.unref(ul),{class:"h-[18px] w-[18px]"})],42,fh),s.createVNode(gl,{"is-open":M.value==="highlight","active-color":h.value,label:"Custom",onSelect:I[22]||(I[22]=J=>v("setHighlight",J)),onReset:I[23]||(I[23]=J=>b("setHighlight")),onClose:I[24]||(I[24]=J=>M.value=null)},null,8,["is-open","active-color"])])):s.createCommentVNode("",!0),B.value.length||E.value.length||_.value.length?(s.openBlock(),s.createElementBlock("span",ph)):s.createCommentVNode("",!0),B.value.length?(s.openBlock(),s.createElementBlock("div",dh,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"gap-0.5 px-1.5"]),title:s.unref(i)("toolbar.lists"),"aria-label":s.unref(i)("toolbar.lists"),disabled:!e.editor,onMousedown:I[25]||(I[25]=s.withModifiers(()=>{},["prevent"])),onClick:I[26]||(I[26]=s.withModifiers(J=>$("lists"),["stop"]))},[s.createVNode(s.unref(Gr),{class:"h-[18px] w-[18px]"}),s.createVNode(s.unref(ei),{class:"h-3 w-3 text-slate-400"})],42,mh),M.value==="lists"?(s.openBlock(),s.createElementBlock("div",hh,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(B.value,J=>(s.openBlock(),s.createElementBlock("button",{key:J.id,type:"button",class:s.normalizeClass(["flex w-full items-center gap-2.5 px-3 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-white/5",p(J)?"text-blue-600 dark:text-blue-300":"text-slate-700 dark:text-slate-200"]),disabled:!e.editor,onMousedown:I[27]||(I[27]=s.withModifiers(()=>{},["prevent"])),onClick:ze=>P(J)},[o(J.iconComponent)?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(o(J.iconComponent)),{key:0,class:"h-4 w-4"})):s.createCommentVNode("",!0),s.createElementVNode("span",null,s.toDisplayString(J.label??J.id),1)],42,bh))),128))])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),E.value.length?(s.openBlock(),s.createElementBlock("div",gh,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"gap-0.5 px-1.5"]),title:s.unref(i)("toolbar.alignment"),"aria-label":s.unref(i)("toolbar.alignment"),disabled:!e.editor,onMousedown:I[28]||(I[28]=s.withModifiers(()=>{},["prevent"])),onClick:I[29]||(I[29]=s.withModifiers(J=>$("align"),["stop"]))},[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(V.value),{class:"h-[18px] w-[18px]"})),s.createVNode(s.unref(ei),{class:"h-3 w-3 text-slate-400"})],42,vh),M.value==="align"?(s.openBlock(),s.createElementBlock("div",yh,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(E.value,J=>(s.openBlock(),s.createElementBlock("button",{key:J.id,type:"button",class:s.normalizeClass(["flex w-full items-center gap-2.5 px-3 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-white/5",p(J)?"text-blue-600 dark:text-blue-300":"text-slate-700 dark:text-slate-200"]),disabled:!e.editor,onMousedown:I[30]||(I[30]=s.withModifiers(()=>{},["prevent"])),onClick:ze=>P(J)},[o(J.iconComponent)?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(o(J.iconComponent)),{key:0,class:"h-4 w-4"})):s.createCommentVNode("",!0),s.createElementVNode("span",null,s.toDisplayString(J.label??J.id),1)],42,xh))),128))])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),_.value.length?(s.openBlock(),s.createElementBlock("div",kh,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([bt,"gap-1 px-2 text-xs font-medium"]),title:s.unref(i)("toolbar.insert"),"aria-label":s.unref(i)("toolbar.insert"),disabled:!e.editor,onMousedown:I[31]||(I[31]=s.withModifiers(()=>{},["prevent"])),onClick:I[32]||(I[32]=s.withModifiers(J=>$("insert"),["stop"]))},[s.createVNode(s.unref(gi),{class:"h-4 w-4"}),s.createElementVNode("span",_h,s.toDisplayString(s.unref(i)("toolbar.insert")),1),s.createVNode(s.unref(ei),{class:"h-3 w-3 text-slate-400"})],42,wh),M.value==="insert"?(s.openBlock(),s.createElementBlock("div",Sh,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(_.value,J=>(s.openBlock(),s.createElementBlock("button",{key:J.id,type:"button",class:s.normalizeClass(["flex w-full items-center gap-2.5 px-3 py-1.5 text-left hover:bg-slate-50 dark:hover:bg-white/5",p(J)?"text-blue-600 dark:text-blue-300":"text-slate-700 dark:text-slate-200"]),disabled:!e.editor,onMousedown:I[33]||(I[33]=s.withModifiers(()=>{},["prevent"])),onClick:ze=>P(J)},[o(J.iconComponent)?(s.openBlock(),s.createBlock(s.resolveDynamicComponent(o(J.iconComponent)),{key:0,class:"h-4 w-4"})):s.createCommentVNode("",!0),s.createElementVNode("span",null,s.toDisplayString(J.label??J.id),1)],42,Ch))),128))])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0),I[42]||(I[42]=s.createElementVNode("span",{class:"mx-1 h-5 w-px flex-shrink-0 bg-slate-200 dark:bg-white/10"},null,-1)),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["docs-editor-toolbar__control flex h-8 w-8 items-center justify-center rounded-md transition-all relative",L("comments")]),title:s.unref(i)("toolbar.comments"),"aria-label":s.unref(i)("toolbar.comments"),onClick:I[34]||(I[34]=J=>r("toggle-sidebar","comments"))},[s.createVNode(s.unref(Yc),{class:"h-[18px] w-[18px]"})],10,Eh),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["docs-editor-toolbar__control flex h-8 w-8 items-center justify-center rounded-md transition-all",L("history")]),title:s.unref(i)("toolbar.history"),"aria-label":s.unref(i)("toolbar.history"),onClick:I[35]||(I[35]=J=>r("toggle-sidebar","history"))},[s.createVNode(s.unref(Xc),{class:"h-[18px] w-[18px]"})],10,Nh),j.value?(s.openBlock(),s.createElementBlock("button",{key:7,type:"button",class:s.normalizeClass(["docs-editor-toolbar__control flex h-8 w-8 items-center justify-center rounded-md transition-all",L("ai")]),title:s.unref(i)("toolbar.ai"),"aria-label":s.unref(i)("toolbar.ai"),onClick:I[36]||(I[36]=J=>r("toggle-sidebar","ai"))},[s.createVNode(s.unref(on),{class:"h-[18px] w-[18px]"})],10,Ah)):s.createCommentVNode("",!0),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["docs-editor-toolbar__control flex h-8 w-8 items-center justify-center rounded-md transition-all",L("toc")]),title:s.unref(i)("toolbar.tableOfContents"),"aria-label":s.unref(i)("toolbar.tableOfContents"),onClick:I[37]||(I[37]=J=>r("toggle-sidebar","toc"))},[s.createVNode(s.unref(sn),{class:"h-[18px] w-[18px]"})],10,Oh),Q.value?(s.openBlock(),s.createElementBlock("button",{key:8,type:"button",class:s.normalizeClass(["docs-editor-toolbar__control flex h-8 w-8 items-center justify-center rounded-md transition-all",L("references")]),title:s.unref(i)("toolbar.references"),"aria-label":s.unref(i)("toolbar.references"),onClick:I[38]||(I[38]=J=>r("toggle-sidebar","references"))},[s.createVNode(s.unref(Co),{class:"h-[18px] w-[18px]"})],10,Th)):s.createCommentVNode("",!0)])]))}}),Bh={key:0,class:"flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-semibold text-cyan-600 dark:text-cyan-400"},Ph=["title"],Vh=["disabled"],Fh=["onClick"],Uh={key:0,class:"relative"},Hh={key:0,class:"absolute left-0 top-full z-10 mt-1 flex min-w-44 flex-col rounded-xl border border-slate-200 bg-white p-1 shadow-2xl dark:border-white/10 dark:bg-[#0c1329]"},jh=["onClick"],yl="bg-cyan-500/15 text-cyan-600 dark:text-cyan-400 font-bold",qh="text-slate-600 dark:text-slate-300 hover:bg-slate-100 dark:hover:bg-white/5 hover:text-slate-900 dark:hover:text-white",$h=s.defineComponent({__name:"BubbleMenu",props:{visible:{type:Boolean},actions:{},position:{},editor:{}},setup(e){const t=e,i=s.ref(0),n=s.ref(!1);function r(){i.value++}s.watch(()=>t.editor,(b,y)=>{y&&y.off("transaction",r),b&&b.on("transaction",r)},{immediate:!0}),s.onUnmounted(()=>{t.editor&&t.editor.off("transaction",r)}),s.watch(i,()=>{n.value=!1});const a=s.computed(()=>{var b,y,g,x;return i.value,[{id:"bold",label:"Bold",action:"toggleBold",icon:qc,active:(b=t.editor)==null?void 0:b.isActive("bold")},{id:"italic",label:"Italic",action:"toggleItalic",icon:Jc,active:(y=t.editor)==null?void 0:y.isActive("italic")},{id:"underline",label:"Underline",action:"toggleUnderline",icon:tu,active:(g=t.editor)==null?void 0:g.isActive("underline")},{id:"link",label:"Link",action:"setLink",icon:Qc,active:(x=t.editor)==null?void 0:x.isActive("link")}]}),o=s.computed(()=>{var b,y,g;return i.value,!!((g=(y=(b=t.editor)==null?void 0:b.storage)==null?void 0:y.editorContext)!=null&&g.aiStream)}),l=s.computed(()=>{var b,y,g;return i.value,((g=(y=(b=t.editor)==null?void 0:b.storage)==null?void 0:y.ai)==null?void 0:g.preview)??null}),c=[{id:"rewrite",label:"Rewrite",action:"rewrite"},{id:"summarize",label:"Summarize",action:"summarize"},{id:"grammar",label:"Fix grammar",action:"grammar"},{id:"tone",label:"Make formal",action:"tone",prompt:"make it more formal"},{id:"translate",label:"Translate to English",action:"translate",prompt:"translate to English"},{id:"expand",label:"Expand",action:"expand"},{id:"shorten",label:"Shorten",action:"shorten"}];function f(){var b;return((b=t.editor)==null?void 0:b.commands)??null}function p(b){var y;n.value=!1,(y=f())==null||y.aiTransform({action:b.action,...b.prompt?{prompt:b.prompt}:{}})}function m(){var b;(b=f())==null||b.aiAccept()}function d(){var b;(b=f())==null||b.aiReject()}const h=s.computed(()=>t.position?{top:`${t.position.top}px`,left:`${t.position.left}px`}:{});function v(b){var g,x,k,w,C;if(b==="setLink"){if((g=t.editor)!=null&&g.isActive("link")){t.editor.chain().focus().unsetLink().run();return}const E=typeof window<"u"?window.prompt("Enter link URL:","https://"):null;if(E){const B=t.actions[b];typeof B=="function"?B({href:E,target:"_blank"}):(w=(k=(x=t.editor)==null?void 0:x.chain().focus()).setLink)==null||w.call(k,{href:E,target:"_blank"}).run()}return}const y=t.actions[b];if(typeof y=="function")y();else if(t.editor){const E=t.editor.chain().focus();(C=E[b])==null||C.call(E).run()}}return(b,y)=>e.visible?(s.openBlock(),s.createElementBlock("div",{key:0,"data-testid":"bubble-menu",class:"docs-editor-bubble-menu fixed z-50 flex gap-1 rounded-xl border border-slate-200 bg-white p-1.5 shadow-2xl dark:border-white/10 dark:bg-[#0c1329]",style:s.normalizeStyle(h.value),onMousedown:y[1]||(y[1]=s.withModifiers(()=>{},["prevent"]))},[l.value?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[l.value.status==="streaming"?(s.openBlock(),s.createElementBlock("span",Bh,[s.createVNode(s.unref(vd),{class:"h-3.5 w-3.5 animate-spin"}),y[2]||(y[2]=s.createElementVNode("span",null,"AI writing…",-1))])):l.value.status==="error"?(s.openBlock(),s.createElementBlock("span",{key:1,class:"flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-semibold text-red-600 dark:text-red-400",title:l.value.error},[s.createVNode(s.unref(id),{class:"h-3.5 w-3.5"}),y[3]||(y[3]=s.createElementVNode("span",null,"AI error",-1))],8,Ph)):s.createCommentVNode("",!0),s.createElementVNode("button",{type:"button",disabled:l.value.status!=="done",class:s.normalizeClass(["docs-editor-bubble-menu__button flex items-center gap-1 rounded-lg px-2.5 py-1.5 text-xs font-semibold transition-all",l.value.status!=="done"?"cursor-not-allowed text-slate-300 dark:text-slate-600":"text-emerald-600 hover:bg-emerald-50 dark:text-emerald-400 dark:hover:bg-emerald-500/10"]),title:"Accept (Enter)",onClick:m},[s.createVNode(s.unref(Wr),{class:"h-3.5 w-3.5"}),y[4]||(y[4]=s.createElementVNode("span",null,"Accept",-1))],10,Vh),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["docs-editor-bubble-menu__button flex items-center gap-1 rounded-lg px-2.5 py-1.5 text-xs font-semibold transition-all","text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-500/10"]),title:"Reject (Esc)",onClick:d},[s.createVNode(s.unref(Dt),{class:"h-3.5 w-3.5"}),y[5]||(y[5]=s.createElementVNode("span",null,"Reject",-1))])],64)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(a.value,g=>(s.openBlock(),s.createElementBlock("button",{key:g.id,type:"button",class:s.normalizeClass(["docs-editor-bubble-menu__button flex items-center gap-1 rounded-lg px-2.5 py-1.5 text-xs font-semibold transition-all",g.active?yl:qh]),onClick:x=>v(g.action)},[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(g.icon),{class:"h-3.5 w-3.5"})),s.createElementVNode("span",null,s.toDisplayString(g.label),1)],10,Fh))),128)),o.value?(s.openBlock(),s.createElementBlock("div",Uh,[s.createElementVNode("button",{type:"button",class:s.normalizeClass(["docs-editor-bubble-menu__button flex items-center gap-1 rounded-lg px-2.5 py-1.5 text-xs font-semibold transition-all",n.value?yl:"text-cyan-600 hover:bg-cyan-50 dark:text-cyan-400 dark:hover:bg-cyan-500/10"]),onClick:y[0]||(y[0]=g=>n.value=!n.value)},[s.createVNode(s.unref(on),{class:"h-3.5 w-3.5"}),y[6]||(y[6]=s.createElementVNode("span",null,"AI",-1))],2),n.value?(s.openBlock(),s.createElementBlock("div",Hh,[(s.openBlock(),s.createElementBlock(s.Fragment,null,s.renderList(c,g=>s.createElementVNode("button",{key:g.id,type:"button",class:"flex items-center gap-2 rounded-lg px-3 py-1.5 text-left text-xs font-semibold text-slate-600 transition-all hover:bg-slate-100 hover:text-slate-900 dark:text-slate-300 dark:hover:bg-white/5 dark:hover:text-white",onClick:x=>p(g)},[s.createElementVNode("span",null,s.toDisplayString(g.label),1)],8,jh)),64))])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)],64))],36)):s.createCommentVNode("",!0)}}),ru=cs($h,[["__scopeId","data-v-e75fb4f8"]]),Wh={id:"editor-footer-row",class:"flex h-9 flex-shrink-0 items-center justify-between border-t border-slate-200 bg-white px-4 font-sans text-[11px] text-slate-400 dark:border-slate-800 dark:bg-[#0b1120]"},Gh={class:"flex items-center gap-2"},Kh={class:"flex items-center gap-1 font-bold"},Xh={key:0,class:"relative mr-1 flex h-2 w-2"},Jh={key:1,class:"relative mr-1 flex h-2 w-2"},Zh={key:2,class:"font-mono text-[10px] uppercase tracking-wide text-emerald-600 dark:text-cyan-400"},Qh={key:3,class:"font-mono text-[10px] uppercase tracking-wide text-amber-600 dark:text-amber-500"},Yh={class:"flex items-center gap-1.5 font-sans text-[11px] font-medium text-slate-500 dark:text-slate-400"},eb={key:0,class:"animate-pulse font-semibold text-cyan-600 dark:text-cyan-400"},tb={key:1,class:"font-semibold text-amber-600 dark:text-amber-500"},ib={key:2,class:"flex items-center gap-1"},nb={class:"rounded bg-slate-100 px-1.5 py-0.5 font-mono text-[10px] text-slate-700 dark:bg-white/5 dark:text-slate-300"},rb={class:"flex items-center gap-3 font-semibold text-slate-400 dark:text-slate-500"},ab=["value","title","aria-label"],ob=["value"],sb={key:0,class:"font-medium text-slate-500 dark:text-slate-400"},lb={key:1},cb={class:"font-mono text-slate-600 dark:text-slate-300"},ub={class:"font-mono text-slate-600 dark:text-slate-300"},fb={class:"font-mono text-slate-600 dark:text-slate-300"},pb={class:"font-mono text-slate-600 dark:text-slate-300"},au=s.defineComponent({__name:"StatusBar",props:{connectionState:{default:"connected"},savingStatus:{default:"saved"},lastSaved:{default:void 0},wordCount:{default:0},charCount:{default:0},pageCount:{default:1},currentPage:{default:1},pageSize:{default:"a4"},pageSizes:{default:()=>[]},pageless:{type:Boolean,default:!1}},emits:["update:pageSize"],setup(e,{emit:t}){const{t:i}=rt(),n=e,r=t,a=s.computed(()=>n.lastSaved?new Date(n.lastSaved).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}):i("statusBar.never")),o=s.computed(()=>{var l,c;return((c=(l=n.pageSizes)==null?void 0:l.find(f=>f.id===n.pageSize))==null?void 0:c.name)??n.pageSize.toUpperCase()});return(l,c)=>(s.openBlock(),s.createElementBlock("footer",Wh,[s.createElementVNode("div",Gh,[s.createElementVNode("span",Kh,[e.connectionState==="connected"?(s.openBlock(),s.createElementBlock("span",Xh,[...c[1]||(c[1]=[s.createElementVNode("span",{class:"absolute inline-flex h-full w-full animate-ping rounded-full bg-emerald-400 opacity-75"},null,-1),s.createElementVNode("span",{class:"relative inline-flex h-2 w-2 rounded-full bg-emerald-500"},null,-1)])])):(s.openBlock(),s.createElementBlock("span",Jh,[...c[2]||(c[2]=[s.createElementVNode("span",{class:"h-2 w-2 animate-spin rounded-full border border-amber-500 border-t-transparent"},null,-1)])])),e.connectionState==="connected"?(s.openBlock(),s.createElementBlock("span",Zh,s.toDisplayString(s.unref(i)("statusBar.liveSyncActive")),1)):(s.openBlock(),s.createElementBlock("span",Qh,s.toDisplayString(s.unref(i)("statusBar.connecting")),1))]),c[3]||(c[3]=s.createElementVNode("span",{class:"text-slate-200 dark:text-white/10"},"|",-1)),s.createElementVNode("span",Yh,[s.createVNode(s.unref(Od),{class:s.normalizeClass(["h-3 w-3",e.savingStatus==="saving"?"animate-spin text-cyan-500":"text-emerald-500"])},null,8,["class"]),e.savingStatus==="saving"?(s.openBlock(),s.createElementBlock("span",eb,s.toDisplayString(s.unref(i)("statusBar.saving")),1)):e.savingStatus==="offline"?(s.openBlock(),s.createElementBlock("span",tb,s.toDisplayString(s.unref(i)("statusBar.offline")),1)):(s.openBlock(),s.createElementBlock("span",ib,[s.createElementVNode("span",null,s.toDisplayString(s.unref(i)("statusBar.lastSavedAt")),1),s.createElementVNode("strong",nb,s.toDisplayString(a.value),1)]))])]),s.createElementVNode("div",rb,[s.createElementVNode("select",{value:e.pageSize,title:o.value,class:"h-6 cursor-pointer rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[11px] font-medium text-slate-600 outline-none hover:border-slate-300 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300","aria-label":s.unref(i)("statusBar.pageSize"),onChange:c[0]||(c[0]=f=>r("update:pageSize",f.target.value))},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.pageSizes,f=>(s.openBlock(),s.createElementBlock("option",{key:f.id,value:f.id},s.toDisplayString(f.name),9,ob))),128))],40,ab),c[4]||(c[4]=s.createElementVNode("span",{class:"text-slate-200 dark:text-white/10"},"•",-1)),e.pageless?(s.openBlock(),s.createElementBlock("span",sb,s.toDisplayString(s.unref(i)("statusBar.pageless")),1)):(s.openBlock(),s.createElementBlock("span",lb,[s.createTextVNode(s.toDisplayString(s.unref(i)("statusBar.page"))+" ",1),s.createElementVNode("strong",cb,s.toDisplayString(e.currentPage),1),s.createTextVNode(" "+s.toDisplayString(s.unref(i)("statusBar.of"))+" ",1),s.createElementVNode("strong",ub,s.toDisplayString(e.pageCount),1)])),c[5]||(c[5]=s.createElementVNode("span",{class:"text-slate-200 dark:text-white/10"},"•",-1)),s.createElementVNode("span",null,[s.createElementVNode("strong",fb,s.toDisplayString(e.wordCount),1),s.createTextVNode(" "+s.toDisplayString(s.unref(i)("statusBar.words")),1)]),c[6]||(c[6]=s.createElementVNode("span",{class:"text-slate-200 dark:text-white/10"},"•",-1)),s.createElementVNode("span",null,[s.createElementVNode("strong",pb,s.toDisplayString(e.charCount),1),s.createTextVNode(" "+s.toDisplayString(s.unref(i)("statusBar.characters")),1)])])]))}}),db={class:"docs-editor-ruler relative h-6 w-full flex-shrink-0 overflow-hidden border-b border-slate-200 bg-slate-50 dark:border-slate-800 dark:bg-[#0a0f1e]"},mb={class:"absolute inset-x-0 top-2.5 h-full"},hb={key:0,class:"absolute -top-2 left-0.5 text-[9px] text-slate-400"},bb=s.defineComponent({__name:"RulerBar",props:{layoutOptions:{}},setup(e){const t=e,i=s.computed(()=>{var o,l;return{pageWidth:((o=t.layoutOptions)==null?void 0:o.pageWidth)??794,margins:((l=t.layoutOptions)==null?void 0:l.margins)??{top:96,bottom:96,left:96,right:96}}}),n=s.computed(()=>{const o=Math.floor(i.value.pageWidth/48);return Array.from({length:o+1},(l,c)=>c*48)}),r=s.computed(()=>`${i.value.margins.left}px`),a=s.computed(()=>`${i.value.pageWidth-i.value.margins.right}px`);return(o,l)=>(s.openBlock(),s.createElementBlock("div",db,[s.createElementVNode("div",{class:"absolute inset-y-0 mx-auto h-full",style:s.normalizeStyle({width:`${i.value.pageWidth}px`,left:"50%",transform:"translateX(-50%)"})},[s.createElementVNode("div",{class:"absolute top-0 z-10 h-0 w-0 border-l-[4px] border-r-[4px] border-t-[6px] border-l-transparent border-r-transparent border-t-blue-400",style:s.normalizeStyle({left:r.value,transform:"translateX(-4px)"})},null,4),s.createElementVNode("div",{class:"absolute top-0 z-10 h-0 w-0 border-l-[4px] border-r-[4px] border-t-[6px] border-l-transparent border-r-transparent border-t-blue-400",style:s.normalizeStyle({left:a.value,transform:"translateX(-4px)"})},null,4),s.createElementVNode("div",mb,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n.value,c=>(s.openBlock(),s.createElementBlock("div",{key:c,class:s.normalizeClass(["absolute top-0 border-l border-slate-300 dark:border-slate-600",c%96===0?"h-3":"h-1.5"]),style:s.normalizeStyle({left:`${c}px`})},[c%96===0&&c>0?(s.openBlock(),s.createElementBlock("span",hb,s.toDisplayString(c/96),1)):s.createCommentVNode("",!0)],6))),128))])],4)]))}}),gb={class:"relative h-full w-full"},vb={key:0,class:"absolute -top-2 right-3 text-[9px] text-slate-400"},yb=s.defineComponent({__name:"VerticalRuler",props:{layoutOptions:{}},setup(e){const t=e,i=s.computed(()=>{var r,a;return{pageHeight:((r=t.layoutOptions)==null?void 0:r.pageHeight)??1123,margins:((a=t.layoutOptions)==null?void 0:a.margins)??{top:96,bottom:96,left:96,right:96}}}),n=s.computed(()=>{const r=Math.floor(i.value.pageHeight/48);return Array.from({length:r+1},(a,o)=>o*48)});return(r,a)=>(s.openBlock(),s.createElementBlock("div",{class:"docs-editor-vertical-ruler sticky top-0 hidden w-6 flex-shrink-0 border-r border-slate-200 bg-slate-50 dark:border-slate-800 dark:bg-[#0a0f1e] lg:block",style:s.normalizeStyle({minHeight:`${i.value.pageHeight}px`})},[s.createElementVNode("div",gb,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n.value,o=>(s.openBlock(),s.createElementBlock("div",{key:o,class:s.normalizeClass(["absolute right-0 border-t border-slate-300 dark:border-slate-600",o%96===0?"w-3":"w-1.5"]),style:s.normalizeStyle({top:`${o}px`})},[o%96===0&&o>0?(s.openBlock(),s.createElementBlock("span",vb,s.toDisplayString(o/96),1)):s.createCommentVNode("",!0)],6))),128))])],4))}}),xb={class:"toc-sidebar flex h-full w-80 flex-shrink-0 flex-col border-r border-slate-200 bg-white/80 text-slate-800 backdrop-blur-xl transition-all animate-fadeIn dark:border-white/5 dark:bg-[#0a0f1e]/85 dark:text-slate-100"},kb={class:"flex items-center justify-between border-b border-slate-200 p-4 dark:border-white/5"},wb={class:"flex items-center gap-1.5 font-mono text-xs font-bold uppercase tracking-widest text-slate-500 dark:text-slate-400"},_b={class:"mt-1 text-[10px] leading-relaxed text-slate-400 dark:text-slate-500"},Sb=["title"],Cb={key:0,class:"px-4 pb-2 pt-3"},Eb={class:"relative flex items-center"},Nb=["placeholder"],Ab={class:"custom-scrollbar flex-1 overflow-y-auto p-4"},Ob={key:0,class:"flex flex-col items-center justify-center py-12 text-center"},Tb={class:"mb-3 rounded-full bg-cyan-500/10 p-3 text-cyan-500 dark:bg-cyan-400/5"},Mb={class:"text-xs font-bold text-slate-700 dark:text-slate-300"},zb={class:"mt-1.5 max-w-[200px] text-[10px] leading-relaxed text-slate-400 dark:text-slate-500"},Ib={class:"mt-5 w-full space-y-2 px-4 font-sans"},Db={class:"mb-1.5 block text-left text-[9px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500"},Rb=["onClick"],Lb={class:"flex items-center gap-1.5"},Bb={key:1,class:"flex flex-col items-center justify-center py-12 text-center text-slate-400"},Pb={class:"text-xs font-semibold"},Vb={class:"mt-1 text-[10px] text-slate-400"},Fb={key:2,class:"space-y-1 font-sans"},Ub={class:"mb-2.5 block text-[9px] font-bold uppercase tracking-widest text-slate-400 dark:text-slate-500"},Hb={class:"relative ml-1.5 space-y-1.5 border-l border-slate-100 pl-1.5 dark:border-white/5"},jb=["onClick"],qb={class:"flex min-w-0 flex-1 items-center gap-2"},$b={class:"border-t border-slate-200 bg-slate-50/50 p-3.5 text-[10px] leading-relaxed text-slate-400 dark:border-white/5 dark:bg-slate-900/30 dark:text-slate-500"},Wb={class:"flex items-start gap-1.5"},Gb=60,ou=s.defineComponent({__name:"TOCSidebar",props:{editor:{}},emits:["close"],setup(e,{emit:t}){const i=e,n=t,{t:r}=rt(),a=s.ref([]),o=s.ref(""),l=s.ref(null);let c=null;function f(){c!==null&&clearTimeout(c),c=setTimeout(()=>{c=null,p()},Gb)}function p(){if(!i.editor)return;const g=[];i.editor.state.doc.descendants((x,k)=>{if(x.type.name==="heading"){const w=x.attrs.level;if(w===1||w===2||w===3){const C=x.textContent.trim();g.push({id:`heading-${k}`,text:C||r("sidebars.toc.untitledHeading").replace("{level}",String(w)),level:w,pos:k})}}return!0}),a.value=g}function m(){const g=i.editor;if(!g)return;const{from:x}=g.state.selection,k=g.state.doc.resolve(Math.max(0,x-1));for(let w=k.depth;w>0;w--){const C=k.node(w);if(C&&C.type.name==="heading"){l.value=`heading-${k.before(w+1)-1}`;return}}l.value=null}s.onMounted(()=>{var g,x;p(),m(),(g=i.editor)==null||g.on("update",f),(x=i.editor)==null||x.on("selectionUpdate",m)}),s.onUnmounted(()=>{var g,x;(g=i.editor)==null||g.off("update",f),(x=i.editor)==null||x.off("selectionUpdate",m),c!==null&&(clearTimeout(c),c=null)}),s.watch(()=>i.editor,(g,x)=>{x==null||x.off("update",f),x==null||x.off("selectionUpdate",m),c!==null&&(clearTimeout(c),c=null),p(),m(),g==null||g.on("update",f),g==null||g.on("selectionUpdate",m)});const d=s.computed(()=>a.value.filter(g=>g.text.toLowerCase().includes(o.value.toLowerCase())));function h(g){i.editor&&(i.editor.chain().focus().setTextSelection(g.pos).run(),l.value=g.id,setTimeout(()=>{var w;const x=document.querySelector(".docs-editor-scroll");if(!x)return;const k=x.querySelectorAll(".ProseMirror h1, .ProseMirror h2, .ProseMirror h3");for(const C of Array.from(k))if(((w=C.textContent)==null?void 0:w.trim())===g.text){C.scrollIntoView({behavior:"smooth",block:"center"});return}},50))}function v(g){if(!i.editor)return;const x=r(g===1?"header.heading1":g===2?"header.heading2":"header.heading3"),k=r("sidebars.toc.newSection"),w=r("sidebars.toc.startWriting");i.editor.chain().focus().insertContent(`<h${g}>${k.replace("{tag}",x)}</h${g}><p>${w}</p>`).run()}function b(g,x){const k="group w-full flex items-center justify-between rounded-lg p-1.5 text-left transition-all relative",w="bg-cyan-500/10 text-cyan-600 dark:text-cyan-400",C="text-slate-600 hover:bg-slate-50 dark:text-slate-300 dark:hover:bg-white/5";return g===1?[k,x?w:C,"pl-0 font-bold text-xs text-slate-800 dark:text-slate-200"]:g===2?[k,x?w:C,"pl-3.5 font-semibold text-[11px] text-slate-600 dark:text-slate-300"]:[k,x?w:C,"pl-6 text-[10px] text-slate-400 dark:text-slate-400"]}function y(g){return g===1?"bg-cyan-500":g===2?"bg-emerald-500":"bg-amber-500"}return(g,x)=>(s.openBlock(),s.createElementBlock("div",xb,[s.createElementVNode("div",kb,[s.createElementVNode("div",null,[s.createElementVNode("h3",wb,[s.createVNode(s.unref(Gr),{class:"h-4 w-4 text-cyan-500"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.toc.title")),1)]),s.createElementVNode("p",_b,s.toDisplayString(s.unref(r)("sidebars.toc.empty")),1)]),s.createElementVNode("button",{type:"button",class:"rounded-lg p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/5 dark:hover:text-white",title:s.unref(r)("sidebars.toc.closeOutline"),onClick:x[0]||(x[0]=k=>n("close"))},[s.createVNode(s.unref(Dt),{class:"h-4 w-4"})],8,Sb)]),a.value.length>0?(s.openBlock(),s.createElementBlock("div",Cb,[s.createElementVNode("div",Eb,[s.createVNode(s.unref(Xr),{class:"absolute left-3 h-3.5 w-3.5 text-slate-400 dark:text-slate-500"}),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":x[1]||(x[1]=k=>o.value=k),type:"text",placeholder:s.unref(r)("sidebars.toc.searchHeadings"),class:"w-full rounded-xl border border-slate-200/80 bg-slate-50 py-2 pl-9 pr-8 text-xs text-slate-700 transition-all focus:outline-none focus:ring-1 focus:ring-cyan-500/50 dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200 dark:focus:ring-cyan-400/30"},null,8,Nb),[[s.vModelText,o.value]]),o.value?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"absolute right-2.5 rounded-md p-0.5 text-slate-400 hover:bg-slate-200 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-white",onClick:x[2]||(x[2]=k=>o.value="")},[s.createVNode(s.unref(Dt),{class:"h-3 w-3"})])):s.createCommentVNode("",!0)])])):s.createCommentVNode("",!0),s.createElementVNode("div",Ab,[a.value.length===0?(s.openBlock(),s.createElementBlock("div",Ob,[s.createElementVNode("div",Tb,[s.createVNode(s.unref(Gr),{class:"h-6 w-6"})]),s.createElementVNode("h4",Mb,s.toDisplayString(s.unref(r)("sidebars.toc.noHeadings")),1),s.createElementVNode("p",zb,s.toDisplayString(s.unref(r)("sidebars.toc.noHeadingsDescription")),1),s.createElementVNode("div",Ib,[s.createElementVNode("span",Db,s.toDisplayString(s.unref(r)("sidebars.toc.quickInsert")),1),(s.openBlock(),s.createElementBlock(s.Fragment,null,s.renderList([1,2,3],k=>s.createElementVNode("button",{key:k,type:"button",class:"flex w-full items-center justify-between rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-[11px] font-semibold text-slate-700 transition-all hover:bg-slate-100 dark:border-white/10 dark:bg-white/[0.02] dark:text-slate-300 dark:hover:bg-white/5",onClick:w=>v(k)},[s.createElementVNode("span",Lb,[s.createVNode(s.unref(Kc),{class:s.normalizeClass(["h-3 w-3",k===1?"text-cyan-500":k===2?"text-emerald-500":"text-amber-500"])},null,8,["class"]),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.toc.headingLevel").replace("{level}",String(k))),1)]),s.createVNode(s.unref(gi),{class:"h-3.5 w-3.5 text-slate-400"})],8,Rb)),64))])])):d.value.length===0?(s.openBlock(),s.createElementBlock("div",Bb,[s.createVNode(s.unref(Xr),{class:"mb-2 h-5 w-5 text-slate-300"}),s.createElementVNode("p",Pb,s.toDisplayString(s.unref(r)("sidebars.toc.noMatchingHeaders")),1),s.createElementVNode("p",Vb,s.toDisplayString(s.unref(r)("sidebars.toc.tryDifferentTerm")),1)])):(s.openBlock(),s.createElementBlock("div",Fb,[s.createElementVNode("span",Ub,s.toDisplayString(s.unref(r)("sidebars.toc.outlineLayout")),1),s.createElementVNode("div",Hb,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(d.value,k=>(s.openBlock(),s.createElementBlock("button",{key:k.id,type:"button",class:s.normalizeClass(b(k.level,l.value===k.id)),onClick:w=>h(k)},[s.createElementVNode("div",qb,[s.createElementVNode("span",{class:s.normalizeClass(["h-1.5 w-1.5 shrink-0 rounded-full transition-all",[y(k.level),l.value===k.id?"scale-125 opacity-100":"opacity-40 group-hover:scale-110 group-hover:opacity-100"]])},null,2),s.createElementVNode("span",{class:s.normalizeClass(["flex-1 truncate leading-tight",l.value===k.id?"text-cyan-600 dark:text-cyan-400":""])},s.toDisplayString(k.text),3)]),s.createVNode(s.unref(ed),{class:s.normalizeClass(["h-3 w-3 shrink-0 text-cyan-500 opacity-0 transition-opacity group-hover:opacity-100",l.value===k.id?"opacity-100 text-cyan-600 dark:text-cyan-400":""])},null,8,["class"])],10,jb))),128))])]))]),s.createElementVNode("div",$b,[s.createElementVNode("div",Wb,[s.createVNode(s.unref(Cd),{class:"mt-0.5 h-3.5 w-3.5 shrink-0 text-cyan-500"}),s.createElementVNode("p",null,s.toDisplayString(s.unref(r)("sidebars.toc.outlineSync")),1)])])]))}}),Kb={class:"references-sidebar flex h-full w-80 flex-shrink-0 flex-col border-l border-slate-200 bg-white/80 text-slate-800 backdrop-blur-xl transition-all animate-fadeIn dark:border-white/5 dark:bg-[#0a0f1e]/85 dark:text-slate-100"},Xb={class:"flex items-center justify-between border-b border-slate-200 p-4 dark:border-white/5"},Jb={class:"flex items-center gap-1.5 font-mono text-xs font-bold uppercase tracking-widest text-slate-500 dark:text-slate-400"},Zb={class:"mt-1 text-[10px] leading-relaxed text-slate-400 dark:text-slate-500"},Qb=["title"],Yb={class:"border-b border-slate-100 px-4 pb-3 pt-3 dark:border-white/5"},eg={class:"mb-1.5 block text-[9px] font-bold uppercase tracking-widest text-slate-400 dark:text-slate-500"},tg=["value"],ig=["value"],ng={class:"flex items-center gap-2 px-4 pb-2 pt-3"},rg={class:"relative flex flex-1 items-center"},ag=["placeholder"],og=["title"],sg={class:"custom-scrollbar flex-1 overflow-y-auto p-4"},lg={key:0,class:"flex flex-col items-center justify-center py-12 text-center"},cg={class:"mb-3 rounded-full bg-cyan-500/10 p-3 text-cyan-500 dark:bg-cyan-400/5"},ug={class:"text-xs font-bold text-slate-700 dark:text-slate-300"},fg={class:"mt-1.5 max-w-[220px] text-[10px] leading-relaxed text-slate-400 dark:text-slate-500"},pg={key:1,class:"flex flex-col items-center justify-center py-12 text-center text-slate-400"},dg={class:"text-xs font-semibold"},mg={key:2,class:"space-y-2 font-sans"},hg={class:"min-w-0 flex-1"},bg=["title"],gg={class:"mt-0.5 truncate text-[10px] text-slate-500 dark:text-slate-400"},vg={key:0},yg={key:1},xg={key:2},kg={class:"mt-1.5 inline-block rounded bg-slate-200/70 px-1.5 py-0.5 text-[9px] font-mono uppercase tracking-wide text-slate-500 dark:bg-white/10 dark:text-slate-400"},wg={class:"mt-2.5 flex items-center gap-1.5"},_g=["onClick"],Sg=["title","onClick"],Cg=["title","onClick"],Eg={key:0,class:"border-t border-slate-200 dark:border-white/5"},Ng={key:0,class:"space-y-3 px-4 pb-4"},Ag={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},Og={class:"flex items-center gap-1.5"},Tg=["placeholder"],Mg=["disabled","title"],zg={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},Ig=["disabled"],Dg={key:0,class:"text-[10px] leading-relaxed text-slate-500 dark:text-slate-400"},Rg={class:"flex items-center gap-2 border-b border-slate-100 px-4 py-3 dark:border-white/5"},Lg=["title"],Bg={class:"text-xs font-bold text-slate-700 dark:text-slate-300"},Pg={class:"custom-scrollbar flex-1 overflow-y-auto p-4"},Vg={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},Fg=["value"],Ug={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},Hg={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},jg={class:"space-y-2"},qg=["onUpdate:modelValue","placeholder"],$g=["onUpdate:modelValue","placeholder"],Wg=["onClick"],Gg={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},Kg={key:0},Xg={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},Jg={key:1,class:"grid grid-cols-2 gap-2"},Zg={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},Qg={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},Yg={key:2,class:"grid grid-cols-3 gap-2"},ev={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},tv={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},iv={class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},nv={key:3},rv={key:4},av={class:"flex items-center gap-2 pt-1.5"},ov=["disabled"],sv=s.defineComponent({__name:"ReferencesSidebar",props:{sources:{},activeStyle:{},pickerMode:{type:Boolean,default:!1},availableStyles:{default:()=>[{id:"chicago-notes-bibliography",name:"Chicago (notes & bibliography)"},{id:"chicago-author-date",name:"Chicago (author-date)"},{id:"apa",name:"APA"},{id:"modern-language-association",name:"MLA"}]},canImport:{type:Boolean,default:!1},importing:{type:Boolean,default:!1},importMessage:{default:""}},emits:["close","insert","create","update","remove","update:style","import-doi","import-bibliography"],setup(e,{emit:t}){const i=e,n=t,{t:r}=rt(),a=s.ref(""),o=["book","article-journal","chapter","webpage","report","thesis","document"];function l(X){const F=X.author??[];if(F.length===0)return r("sidebars.references.anonymous");const q=F[0],ne=q.family??q.literal??"";return F.length>1?`${ne} ${r("sidebars.references.etAl")}`:ne}function c(X){var q,ne;const F=(ne=(q=X.issued)==null?void 0:q["date-parts"])==null?void 0:ne[0];return F!=null&&F[0]?String(F[0]):""}function f(X){const F=`sidebars.references.types.${X}`,q=r(F);return q===F?X:q}const p=s.computed(()=>{const X=a.value.trim().toLowerCase();return X?i.sources.filter(F=>[F.title,F["container-title"],F.publisher,F.DOI,F.URL,...(F.author??[]).map(ne=>`${ne.family??""} ${ne.given??""} ${ne.literal??""}`)].filter(Boolean).join(" ").toLowerCase().includes(X)):i.sources}),m=s.ref("list"),d=s.ref(null),h=s.ref("book"),v=s.ref(""),b=s.ref([{family:"",given:""}]),y=s.ref(""),g=s.ref(""),x=s.ref(""),k=s.ref(""),w=s.ref(""),C=s.ref(""),E=s.ref(""),B=s.ref(""),_=s.ref("");function S(){h.value="book",v.value="",b.value=[{family:"",given:""}],y.value="",g.value="",x.value="",k.value="",w.value="",C.value="",E.value="",B.value="",_.value=""}function T(){d.value=null,S(),m.value="form"}function D(X){d.value=X.id,h.value=X.type||"book",v.value=X.title??"",b.value=(X.author??[]).filter(q=>!q.literal).map(q=>({family:q.family??"",given:q.given??""}));const F=(X.author??[]).find(q=>q.literal);b.value.length===0&&(b.value=[{family:(F==null?void 0:F.literal)??"",given:""}]),y.value=c(X),g.value=X.publisher??"",x.value=X["publisher-place"]??"",k.value=X["container-title"]??"",w.value=X.volume??"",C.value=X.issue??"",E.value=X.page??"",B.value=X.DOI??"",_.value=X.URL??"",m.value="form"}function H(){b.value.push({family:"",given:""})}function V(X){b.value.splice(X,1),b.value.length===0&&b.value.push({family:"",given:""})}const M=s.computed(()=>["book","chapter","report","thesis","document"].includes(h.value)),$=s.computed(()=>["article-journal","chapter"].includes(h.value)),P=s.computed(()=>["article-journal","chapter"].includes(h.value)),W=s.computed(()=>["webpage","report"].includes(h.value)),L=s.computed(()=>v.value.trim().length>0);function Q(){const X=b.value.filter(ne=>ne.family.trim()||ne.given.trim()).map(ne=>({family:ne.family.trim(),given:ne.given.trim()})),F=parseInt(y.value,10),q={id:d.value??crypto.randomUUID(),type:h.value,title:v.value.trim()};return X.length>0&&(q.author=X),Number.isFinite(F)&&(q.issued={"date-parts":[[F]]}),g.value.trim()&&(q.publisher=g.value.trim()),x.value.trim()&&(q["publisher-place"]=x.value.trim()),k.value.trim()&&(q["container-title"]=k.value.trim()),w.value.trim()&&(q.volume=w.value.trim()),C.value.trim()&&(q.issue=C.value.trim()),E.value.trim()&&(q.page=E.value.trim()),B.value.trim()&&(q.DOI=B.value.trim()),_.value.trim()&&(q.URL=_.value.trim()),q}function j(){if(!L.value)return;const X=Q();d.value?n("update",X):n("create",X),m.value="list"}function O(X){window.confirm(r("sidebars.references.confirmDelete").replace("{title}",X.title??X.id))&&n("remove",X.id)}const R=s.ref(!1),U=s.ref(""),oe=s.ref(null);function ie(){const X=U.value.trim();!X||i.importing||(n("import-doi",X),U.value="")}function ee(){var X;i.importing||(X=oe.value)==null||X.click()}async function te(X){var Se;const F=X.target,q=(Se=F.files)==null?void 0:Se[0];if(F.value="",!q)return;const ne=/\.ris$/i.test(q.name)?"ris":"bibtex",se=await q.text();n("import-bibliography",{format:ne,text:se})}return(X,F)=>(s.openBlock(),s.createElementBlock("div",Kb,[s.createElementVNode("div",Xb,[s.createElementVNode("div",null,[s.createElementVNode("h3",Jb,[s.createVNode(s.unref(Co),{class:"h-4 w-4 text-cyan-500"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.references.title")),1)]),s.createElementVNode("p",Zb,s.toDisplayString(s.unref(r)("sidebars.references.subtitle")),1)]),s.createElementVNode("button",{type:"button",class:"rounded-lg p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/5 dark:hover:text-white",title:s.unref(r)("sidebars.references.close"),onClick:F[0]||(F[0]=q=>n("close"))},[s.createVNode(s.unref(Dt),{class:"h-4 w-4"})],8,Qb)]),m.value==="list"?(s.openBlock(),s.createElementBlock(s.Fragment,{key:0},[s.createElementVNode("div",Yb,[s.createElementVNode("label",eg,s.toDisplayString(s.unref(r)("sidebars.references.citationStyle")),1),s.createElementVNode("select",{value:e.activeStyle,class:"w-full rounded-xl border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs text-slate-700 transition-all focus:outline-none focus:ring-1 focus:ring-cyan-500/50 dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200",onChange:F[1]||(F[1]=q=>n("update:style",q.target.value))},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.availableStyles,q=>(s.openBlock(),s.createElementBlock("option",{key:q.id,value:q.id},s.toDisplayString(q.name),9,ig))),128))],40,tg)]),s.createElementVNode("div",ng,[s.createElementVNode("div",rg,[s.createVNode(s.unref(Xr),{class:"absolute left-3 h-3.5 w-3.5 text-slate-400 dark:text-slate-500"}),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[2]||(F[2]=q=>a.value=q),type:"text",placeholder:s.unref(r)("sidebars.references.searchSources"),class:"w-full rounded-xl border border-slate-200/80 bg-slate-50 py-2 pl-9 pr-8 text-xs text-slate-700 transition-all focus:outline-none focus:ring-1 focus:ring-cyan-500/50 dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200 dark:focus:ring-cyan-400/30"},null,8,ag),[[s.vModelText,a.value]]),a.value?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"absolute right-2.5 rounded-md p-0.5 text-slate-400 hover:bg-slate-200 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-white",onClick:F[3]||(F[3]=q=>a.value="")},[s.createVNode(s.unref(Dt),{class:"h-3 w-3"})])):s.createCommentVNode("",!0)]),s.createElementVNode("button",{type:"button",class:"flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-xl bg-blue-600 text-white shadow transition-colors hover:bg-blue-700",title:s.unref(r)("sidebars.references.addSource"),onClick:T},[s.createVNode(s.unref(gi),{class:"h-4 w-4"})],8,og)]),s.createElementVNode("div",sg,[e.sources.length===0?(s.openBlock(),s.createElementBlock("div",lg,[s.createElementVNode("div",cg,[s.createVNode(s.unref(Co),{class:"h-6 w-6"})]),s.createElementVNode("h4",ug,s.toDisplayString(s.unref(r)("sidebars.references.noSources")),1),s.createElementVNode("p",fg,s.toDisplayString(s.unref(r)("sidebars.references.noSourcesDescription")),1),s.createElementVNode("button",{type:"button",class:"mt-5 flex items-center gap-1.5 rounded-lg bg-blue-600 px-4 py-2 text-[11px] font-semibold text-white shadow transition-colors hover:bg-blue-700",onClick:T},[s.createVNode(s.unref(gi),{class:"h-3.5 w-3.5"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.references.addSource")),1)])])):p.value.length===0?(s.openBlock(),s.createElementBlock("div",pg,[s.createVNode(s.unref(Xr),{class:"mb-2 h-5 w-5 text-slate-300"}),s.createElementVNode("p",dg,s.toDisplayString(s.unref(r)("sidebars.references.noMatchingSources")),1)])):(s.openBlock(),s.createElementBlock("div",mg,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(p.value,q=>(s.openBlock(),s.createElementBlock("div",{key:q.id,class:"group rounded-xl border border-slate-200/80 bg-slate-50/60 p-3 transition-all hover:border-slate-300 dark:border-white/10 dark:bg-white/[0.02] dark:hover:border-white/20"},[s.createElementVNode("div",hg,[s.createElementVNode("p",{class:"truncate text-xs font-semibold text-slate-800 dark:text-slate-200",title:q.title},s.toDisplayString(q.title),9,bg),s.createElementVNode("p",gg,[s.createTextVNode(s.toDisplayString(l(q)),1),c(q)?(s.openBlock(),s.createElementBlock("span",vg," ("+s.toDisplayString(c(q))+")",1)):s.createCommentVNode("",!0),q["container-title"]?(s.openBlock(),s.createElementBlock("span",yg," · "+s.toDisplayString(q["container-title"]),1)):q.publisher?(s.openBlock(),s.createElementBlock("span",xg," · "+s.toDisplayString(q.publisher),1)):s.createCommentVNode("",!0)]),s.createElementVNode("span",kg,s.toDisplayString(f(q.type)),1)]),s.createElementVNode("div",wg,[s.createElementVNode("button",{type:"button",class:s.normalizeClass(["flex flex-1 items-center justify-center gap-1 rounded-lg px-2 py-1.5 text-[10px] font-semibold transition-colors",e.pickerMode?"bg-blue-600 text-white hover:bg-blue-700":"bg-slate-200/80 text-slate-700 hover:bg-blue-600 hover:text-white dark:bg-white/10 dark:text-slate-300 dark:hover:bg-blue-600"]),onClick:ne=>n("insert",q.id)},[s.createVNode(s.unref(Kr),{class:"h-3 w-3"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.references.cite")),1)],10,_g),s.createElementVNode("button",{type:"button",class:"flex h-7 w-7 items-center justify-center rounded-lg text-slate-400 transition-colors hover:bg-slate-200 hover:text-slate-600 dark:hover:bg-white/10 dark:hover:text-white",title:s.unref(r)("sidebars.references.edit"),onClick:ne=>D(q)},[s.createVNode(s.unref(eu),{class:"h-3.5 w-3.5"})],8,Sg),s.createElementVNode("button",{type:"button",class:"flex h-7 w-7 items-center justify-center rounded-lg text-slate-400 transition-colors hover:bg-red-50 hover:text-red-500 dark:hover:bg-red-500/10",title:s.unref(r)("sidebars.references.delete"),onClick:ne=>O(q)},[s.createVNode(s.unref(us),{class:"h-3.5 w-3.5"})],8,Cg)])]))),128))]))]),e.canImport?(s.openBlock(),s.createElementBlock("div",Eg,[s.createElementVNode("button",{type:"button",class:"flex w-full items-center justify-between px-4 py-2.5 text-[10px] font-bold uppercase tracking-widest text-slate-400 transition-colors hover:text-slate-600 dark:text-slate-500 dark:hover:text-slate-300",onClick:F[4]||(F[4]=q=>R.value=!R.value)},[s.createElementVNode("span",null,s.toDisplayString(s.unref(r)("sidebars.references.import.title")),1),s.createVNode(s.unref(ei),{class:s.normalizeClass(["h-3.5 w-3.5 transition-transform",R.value?"rotate-180":""])},null,8,["class"])]),R.value?(s.openBlock(),s.createElementBlock("div",Ng,[s.createElementVNode("div",null,[s.createElementVNode("label",Ag,s.toDisplayString(s.unref(r)("sidebars.references.import.fromDoi")),1),s.createElementVNode("div",Og,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[5]||(F[5]=q=>U.value=q),type:"text",placeholder:s.unref(r)("sidebars.references.import.doiPlaceholder"),class:"min-w-0 flex-1 rounded-lg border border-slate-200/80 bg-slate-50 px-2.5 py-1.5 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200",onKeydown:s.withKeys(ie,["enter"])},null,40,Tg),[[s.vModelText,U.value]]),s.createElementVNode("button",{type:"button",disabled:e.importing||!U.value.trim(),class:"flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-lg bg-blue-600 text-white transition-colors hover:bg-blue-700 disabled:opacity-40",title:s.unref(r)("sidebars.references.import.importDoi"),onClick:ie},[s.createVNode(s.unref(Gc),{class:"h-3.5 w-3.5"})],8,Mg)])]),s.createElementVNode("div",null,[s.createElementVNode("label",zg,s.toDisplayString(s.unref(r)("sidebars.references.import.fromFile")),1),s.createElementVNode("button",{type:"button",disabled:e.importing,class:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-dashed border-slate-300 px-3 py-2 text-[11px] font-semibold text-slate-500 transition-colors hover:border-blue-400 hover:text-blue-600 disabled:opacity-40 dark:border-white/15 dark:text-slate-400 dark:hover:border-blue-500 dark:hover:text-blue-400",onClick:ee},[s.createVNode(s.unref(ld),{class:"h-3.5 w-3.5"}),s.createTextVNode(" "+s.toDisplayString(e.importing?s.unref(r)("sidebars.references.import.importing"):s.unref(r)("sidebars.references.import.pickFile")),1)],8,Ig),s.createElementVNode("input",{ref_key:"bibFileInput",ref:oe,type:"file",accept:".bib,.ris,application/x-bibtex,text/plain",class:"hidden",onChange:te},null,544)]),e.importMessage?(s.openBlock(),s.createElementBlock("p",Dg,s.toDisplayString(e.importMessage),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)],64)):(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createElementVNode("div",Rg,[s.createElementVNode("button",{type:"button",class:"rounded-lg p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/5 dark:hover:text-white",title:s.unref(r)("sidebars.references.back"),onClick:F[6]||(F[6]=q=>m.value="list")},[s.createVNode(s.unref(Yp),{class:"h-4 w-4"})],8,Lg),s.createElementVNode("h4",Bg,s.toDisplayString(d.value?s.unref(r)("sidebars.references.editSource"):s.unref(r)("sidebars.references.addSource")),1)]),s.createElementVNode("div",Pg,[s.createElementVNode("form",{class:"space-y-3.5",onSubmit:s.withModifiers(j,["prevent"])},[s.createElementVNode("div",null,[s.createElementVNode("label",Vg,s.toDisplayString(s.unref(r)("sidebars.references.form.type")),1),s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":F[7]||(F[7]=q=>h.value=q),class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},[(s.openBlock(),s.createElementBlock(s.Fragment,null,s.renderList(o,q=>s.createElementVNode("option",{key:q,value:q},s.toDisplayString(f(q)),9,Fg)),64))],512),[[s.vModelSelect,h.value]])]),s.createElementVNode("div",null,[s.createElementVNode("label",Ug,s.toDisplayString(s.unref(r)("sidebars.references.form.title"))+" *",1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[8]||(F[8]=q=>v.value=q),type:"text",required:"",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,v.value]])]),s.createElementVNode("div",null,[s.createElementVNode("label",Hg,s.toDisplayString(s.unref(r)("sidebars.references.form.authors")),1),s.createElementVNode("div",jg,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(b.value,(q,ne)=>(s.openBlock(),s.createElementBlock("div",{key:ne,class:"flex items-center gap-1.5"},[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":se=>q.family=se,type:"text",placeholder:s.unref(r)("sidebars.references.form.familyName"),class:"w-1/2 rounded-lg border border-slate-200/80 bg-slate-50 px-2.5 py-1.5 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,8,qg),[[s.vModelText,q.family]]),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":se=>q.given=se,type:"text",placeholder:s.unref(r)("sidebars.references.form.givenName"),class:"w-1/2 rounded-lg border border-slate-200/80 bg-slate-50 px-2.5 py-1.5 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,8,$g),[[s.vModelText,q.given]]),s.createElementVNode("button",{type:"button",class:"flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-lg text-slate-400 hover:bg-red-50 hover:text-red-500 dark:hover:bg-red-500/10",onClick:se=>V(ne)},[s.createVNode(s.unref(Dt),{class:"h-3.5 w-3.5"})],8,Wg)]))),128))]),s.createElementVNode("button",{type:"button",class:"mt-1.5 flex items-center gap-1 text-[10px] font-semibold text-blue-600 hover:text-blue-700 dark:text-blue-400",onClick:H},[s.createVNode(s.unref(gi),{class:"h-3 w-3"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.references.form.addAuthor")),1)])]),s.createElementVNode("div",null,[s.createElementVNode("label",Gg,s.toDisplayString(s.unref(r)("sidebars.references.form.year")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[9]||(F[9]=q=>y.value=q),type:"number",min:"0",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,y.value]])]),$.value?(s.openBlock(),s.createElementBlock("div",Kg,[s.createElementVNode("label",Xg,s.toDisplayString(h.value==="chapter"?s.unref(r)("sidebars.references.form.bookTitle"):s.unref(r)("sidebars.references.form.journal")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[10]||(F[10]=q=>k.value=q),type:"text",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,k.value]])])):s.createCommentVNode("",!0),M.value?(s.openBlock(),s.createElementBlock("div",Jg,[s.createElementVNode("div",null,[s.createElementVNode("label",Zg,s.toDisplayString(s.unref(r)("sidebars.references.form.publisher")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[11]||(F[11]=q=>g.value=q),type:"text",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,g.value]])]),s.createElementVNode("div",null,[s.createElementVNode("label",Qg,s.toDisplayString(s.unref(r)("sidebars.references.form.publisherPlace")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[12]||(F[12]=q=>x.value=q),type:"text",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,x.value]])])])):s.createCommentVNode("",!0),P.value?(s.openBlock(),s.createElementBlock("div",Yg,[s.createElementVNode("div",null,[s.createElementVNode("label",ev,s.toDisplayString(s.unref(r)("sidebars.references.form.volume")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[13]||(F[13]=q=>w.value=q),type:"text",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,w.value]])]),s.createElementVNode("div",null,[s.createElementVNode("label",tv,s.toDisplayString(s.unref(r)("sidebars.references.form.issue")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[14]||(F[14]=q=>C.value=q),type:"text",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,C.value]])]),s.createElementVNode("div",null,[s.createElementVNode("label",iv,s.toDisplayString(s.unref(r)("sidebars.references.form.pages")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[15]||(F[15]=q=>E.value=q),type:"text",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,E.value]])])])):s.createCommentVNode("",!0),h.value==="article-journal"?(s.openBlock(),s.createElementBlock("div",nv,[F[19]||(F[19]=s.createElementVNode("label",{class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},"DOI",-1)),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[16]||(F[16]=q=>B.value=q),type:"text",placeholder:"10.xxxx/xxxxx",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,B.value]])])):s.createCommentVNode("",!0),W.value?(s.openBlock(),s.createElementBlock("div",rv,[F[20]||(F[20]=s.createElementVNode("label",{class:"mb-1 block text-[10px] font-semibold text-slate-500 dark:text-slate-400"},"URL",-1)),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":F[17]||(F[17]=q=>_.value=q),type:"url",placeholder:"https://…",class:"w-full rounded-lg border border-slate-200/80 bg-slate-50 px-3 py-2 text-xs dark:border-white/10 dark:bg-slate-900/40 dark:text-slate-200"},null,512),[[s.vModelText,_.value]])])):s.createCommentVNode("",!0),s.createElementVNode("div",av,[s.createElementVNode("button",{type:"submit",disabled:!L.value,class:"flex-1 rounded-lg bg-blue-600 px-4 py-2 text-xs font-semibold text-white shadow transition-colors hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-40"},s.toDisplayString(d.value?s.unref(r)("sidebars.references.form.save"):s.unref(r)("sidebars.references.form.create")),9,ov),s.createElementVNode("button",{type:"button",class:"rounded-lg border border-slate-200 px-4 py-2 text-xs font-semibold text-slate-600 transition-colors hover:bg-slate-50 dark:border-white/10 dark:text-slate-300 dark:hover:bg-white/5",onClick:F[18]||(F[18]=q=>m.value="list")},s.toDisplayString(s.unref(r)("sidebars.references.form.cancel")),1)])],32)])],64))]))}});function Qe(e){this.content=e}Qe.prototype={constructor:Qe,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,i){var n=i&&i!=e?this.remove(i):this,r=n.find(e),a=n.content.slice();return r==-1?a.push(i||e,t):(a[r+1]=t,i&&(a[r]=i)),new Qe(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var i=this.content.slice();return i.splice(t,2),new Qe(i)},addToStart:function(e,t){return new Qe([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var i=this.remove(e).content.slice();return i.push(e,t),new Qe(i)},addBefore:function(e,t,i){var n=this.remove(t),r=n.content.slice(),a=n.find(e);return r.splice(a==-1?r.length:a,0,t,i),new Qe(r)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=Qe.from(e),e.size?new Qe(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=Qe.from(e),e.size?new Qe(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=Qe.from(e);for(var i=0;i<e.content.length;i+=2)t=t.remove(e.content[i]);return t},toObject:function(){var e={};return this.forEach(function(t,i){e[t]=i}),e},get size(){return this.content.length>>1}};Qe.from=function(e){if(e instanceof Qe)return e;var t=[];if(e)for(var i in e)t.push(i,e[i]);return new Qe(t)};function su(e,t,i){for(let n=0;;n++){if(n==e.childCount||n==t.childCount)return e.childCount==t.childCount?null:i;let r=e.child(n),a=t.child(n);if(r==a){i+=r.nodeSize;continue}if(!r.sameMarkup(a))return i;if(r.isText&&r.text!=a.text){let o=r.text,l=a.text,c=0;for(;o[c]==l[c];c++)i++;return c&&c<o.length&&c<l.length&&uu(o.charCodeAt(c-1))&&cu(o.charCodeAt(c))&&i--,i}if(r.content.size||a.content.size){let o=su(r.content,a.content,i+1);if(o!=null)return o}i+=r.nodeSize}}function lu(e,t,i,n){for(let r=e.childCount,a=t.childCount;;){if(r==0||a==0)return r==a?null:{a:i,b:n};let o=e.child(--r),l=t.child(--a),c=o.nodeSize;if(o==l){i-=c,n-=c;continue}if(!o.sameMarkup(l))return{a:i,b:n};if(o.isText&&o.text!=l.text){let f=o.text,p=l.text,m=f.length,d=p.length;for(;m>0&&d>0&&f[m-1]==p[d-1];)m--,d--,i--,n--;return m&&d&&m<f.length&&uu(f.charCodeAt(m-1))&&cu(f.charCodeAt(m))&&(i++,n++),{a:i,b:n}}if(o.content.size||l.content.size){let f=lu(o.content,l.content,i-1,n-1);if(f)return f}i-=c,n-=c}}function cu(e){return e>=56320&&e<57344}function uu(e){return e>=55296&&e<56320}class Z{constructor(t,i){if(this.content=t,this.size=i||0,i==null)for(let n=0;n<t.length;n++)this.size+=t[n].nodeSize}nodesBetween(t,i,n,r=0,a){for(let o=0,l=0;l<i;o++){let c=this.content[o],f=l+c.nodeSize;if(f>t&&n(c,r+l,a||null,o)!==!1&&c.content.size){let p=l+1;c.nodesBetween(Math.max(0,t-p),Math.min(c.content.size,i-p),n,r+p)}l=f}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,i,n,r){let a="",o=!0;return this.nodesBetween(t,i,(l,c)=>{let f=l.isText?l.text.slice(Math.max(t,c)-c,i-c):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&f||l.isTextblock)&&n&&(o?o=!1:a+=n),a+=f},0),a}append(t){if(!t.size)return this;if(!this.size)return t;let i=this.lastChild,n=t.firstChild,r=this.content.slice(),a=0;for(i.isText&&i.sameMarkup(n)&&(r[r.length-1]=i.withText(i.text+n.text),a=1);a<t.content.length;a++)r.push(t.content[a]);return new Z(r,this.size+t.size)}cut(t,i=this.size){if(t==0&&i==this.size)return this;let n=[],r=0;if(i>t)for(let a=0,o=0;o<i;a++){let l=this.content[a],c=o+l.nodeSize;c>t&&((o<t||c>i)&&(l.isText?l=l.cut(Math.max(0,t-o),Math.min(l.text.length,i-o)):l=l.cut(Math.max(0,t-o-1),Math.min(l.content.size,i-o-1))),n.push(l),r+=l.nodeSize),o=c}return new Z(n,r)}cutByIndex(t,i){return t==i?Z.empty:t==0&&i==this.content.length?this:new Z(this.content.slice(t,i))}replaceChild(t,i){let n=this.content[t];if(n==i)return this;let r=this.content.slice(),a=this.size+i.nodeSize-n.nodeSize;return r[t]=i,new Z(r,a)}addToStart(t){return new Z([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new Z(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let i=0;i<this.content.length;i++)if(!this.content[i].eq(t.content[i]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let i=this.content[t];if(!i)throw new RangeError("Index "+t+" out of range for "+this);return i}maybeChild(t){return this.content[t]||null}forEach(t){for(let i=0,n=0;i<this.content.length;i++){let r=this.content[i];t(r,n,i),n+=r.nodeSize}}findDiffStart(t,i=0){return su(this,t,i)}findDiffEnd(t,i=this.size,n=t.size){return lu(this,t,i,n)}findIndex(t){if(t==0)return kr(0,t);if(t==this.size)return kr(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let i=0,n=0;;i++){let r=this.child(i),a=n+r.nodeSize;if(a>=t)return a==t?kr(i+1,a):kr(i,n);n=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,i){if(!i)return Z.empty;if(!Array.isArray(i))throw new RangeError("Invalid input for Fragment.fromJSON");return Z.fromArray(i.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return Z.empty;let i,n=0;for(let r=0;r<t.length;r++){let a=t[r];n+=a.nodeSize,r&&a.isText&&t[r-1].sameMarkup(a)?(i||(i=t.slice(0,r)),i[i.length-1]=a.withText(i[i.length-1].text+a.text)):i&&i.push(a)}return new Z(i||t,n)}static from(t){if(!t)return Z.empty;if(t instanceof Z)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new Z([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}Z.empty=new Z([],0);const to={index:0,offset:0};function kr(e,t){return to.index=e,to.offset=t,to}function Jr(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let i=Array.isArray(e);if(Array.isArray(t)!=i)return!1;if(i){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Jr(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Jr(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}let Re=class Oo{constructor(t,i){this.type=t,this.attrs=i}addToSet(t){let i,n=!1;for(let r=0;r<t.length;r++){let a=t[r];if(this.eq(a))return t;if(this.type.excludes(a.type))i||(i=t.slice(0,r));else{if(a.type.excludes(this.type))return t;!n&&a.type.rank>this.type.rank&&(i||(i=t.slice(0,r)),i.push(this),n=!0),i&&i.push(a)}}return i||(i=t.slice()),n||i.push(this),i}removeFromSet(t){for(let i=0;i<t.length;i++)if(this.eq(t[i]))return t.slice(0,i).concat(t.slice(i+1));return t}isInSet(t){for(let i=0;i<t.length;i++)if(this.eq(t[i]))return!0;return!1}eq(t){return this==t||this.type==t.type&&Jr(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let i in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,i){if(!i)throw new RangeError("Invalid input for Mark.fromJSON");let n=t.marks[i.type];if(!n)throw new RangeError(`There is no mark type ${i.type} in this schema`);let r=n.create(i.attrs);return n.checkAttrs(r.attrs),r}static sameSet(t,i){if(t==i)return!0;if(t.length!=i.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].eq(i[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return Oo.none;if(t instanceof Oo)return[t];let i=t.slice();return i.sort((n,r)=>n.type.rank-r.type.rank),i}};Re.none=[];class Pn extends Error{}class ae{constructor(t,i,n){this.content=t,this.openStart=i,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,i){let n=pu(this.content,t+this.openStart,i,this.openStart+1,this.openEnd+1);return n&&new ae(n,this.openStart,this.openEnd)}removeBetween(t,i){return new ae(fu(this.content,t+this.openStart,i+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,i){if(!i)return ae.empty;let n=i.openStart||0,r=i.openEnd||0;if(typeof n!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ae(Z.fromJSON(t,i.content),n,r)}static maxOpen(t,i=!0){let n=0,r=0;for(let a=t.firstChild;a&&!a.isLeaf&&(i||!a.type.spec.isolating);a=a.firstChild)n++;for(let a=t.lastChild;a&&!a.isLeaf&&(i||!a.type.spec.isolating);a=a.lastChild)r++;return new ae(t,n,r)}}ae.empty=new ae(Z.empty,0,0);function fu(e,t,i){let{index:n,offset:r}=e.findIndex(t),a=e.maybeChild(n),{index:o,offset:l}=e.findIndex(i);if(r==t||a.isText){if(l!=i&&!e.child(o).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(i))}if(n!=o)throw new RangeError("Removing non-flat range");return e.replaceChild(n,a.copy(fu(a.content,t-r-1,i-r-1)))}function pu(e,t,i,n,r,a){let{index:o,offset:l}=e.findIndex(t),c=e.maybeChild(o);if(l==t||c.isText)return a&&n<=0&&r<=0&&!a.canReplace(o,o,i)?null:e.cut(0,t).append(i).append(e.cut(t));let f=pu(c.content,t-l-1,i,o==0?n-1:0,o==e.childCount-1?r-1:0,c);return f&&e.replaceChild(o,c.copy(f))}function lv(e,t,i){if(i.openStart>e.depth)throw new Pn("Inserted content deeper than insertion position");if(e.depth-i.openStart!=t.depth-i.openEnd)throw new Pn("Inconsistent open depths");return du(e,t,i,0)}function du(e,t,i,n){let r=e.index(n),a=e.node(n);if(r==t.index(n)&&n<e.depth-i.openStart){let o=du(e,t,i,n+1);return a.copy(a.content.replaceChild(r,o))}else if(i.content.size)if(!i.openStart&&!i.openEnd&&e.depth==n&&t.depth==n){let o=e.parent,l=o.content;return Bi(o,l.cut(0,e.parentOffset).append(i.content).append(l.cut(t.parentOffset)))}else{let{start:o,end:l}=cv(i,e);return Bi(a,hu(e,o,l,t,n))}else return Bi(a,Zr(e,t,n))}function mu(e,t){if(!t.type.compatibleContent(e.type))throw new Pn("Cannot join "+t.type.name+" onto "+e.type.name)}function To(e,t,i){let n=e.node(i);return mu(n,t.node(i)),n}function Li(e,t){let i=t.length-1;i>=0&&e.isText&&e.sameMarkup(t[i])?t[i]=e.withText(t[i].text+e.text):t.push(e)}function On(e,t,i,n){let r=(t||e).node(i),a=0,o=t?t.index(i):r.childCount;e&&(a=e.index(i),e.depth>i?a++:e.textOffset&&(Li(e.nodeAfter,n),a++));for(let l=a;l<o;l++)Li(r.child(l),n);t&&t.depth==i&&t.textOffset&&Li(t.nodeBefore,n)}function Bi(e,t){if(!e.type.validContent(t))throw new Pn("Invalid content for node "+e.type.name);return e.copy(t)}function hu(e,t,i,n,r){let a=e.depth>r&&To(e,t,r+1),o=n.depth>r&&To(i,n,r+1),l=[];return On(null,e,r,l),a&&o&&t.index(r)==i.index(r)?(mu(a,o),Li(Bi(a,hu(e,t,i,n,r+1)),l)):(a&&Li(Bi(a,Zr(e,t,r+1)),l),On(t,i,r,l),o&&Li(Bi(o,Zr(i,n,r+1)),l)),On(n,null,r,l),new Z(l)}function Zr(e,t,i){let n=[];if(On(null,e,i,n),e.depth>i){let r=To(e,t,i+1);Li(Bi(r,Zr(e,t,i+1)),n)}return On(t,null,i,n),new Z(n)}function cv(e,t){let i=t.depth-e.openStart,r=t.node(i).copy(e.content);for(let a=i-1;a>=0;a--)r=t.node(a).copy(Z.from(r));return{start:r.resolveNoCache(e.openStart+i),end:r.resolveNoCache(r.content.size-e.openEnd-i)}}class Vn{constructor(t,i,n){this.pos=t,this.path=i,this.parentOffset=n,this.depth=i.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,i=this.index(this.depth);if(i==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=t.child(i);return n?t.child(i).cut(n):r}get nodeBefore(){let t=this.index(this.depth),i=this.pos-this.path[this.path.length-1];return i?this.parent.child(t).cut(0,i):t==0?null:this.parent.child(t-1)}posAtIndex(t,i){i=this.resolveDepth(i);let n=this.path[i*3],r=i==0?0:this.path[i*3-1]+1;for(let a=0;a<t;a++)r+=n.child(a).nodeSize;return r}marks(){let t=this.parent,i=this.index();if(t.content.size==0)return Re.none;if(this.textOffset)return t.child(i).marks;let n=t.maybeChild(i-1),r=t.maybeChild(i);if(!n){let l=n;n=r,r=l}let a=n.marks;for(var o=0;o<a.length;o++)a[o].type.spec.inclusive===!1&&(!r||!a[o].isInSet(r.marks))&&(a=a[o--].removeFromSet(a));return a}marksAcross(t){let i=this.parent.maybeChild(this.index());if(!i||!i.isInline)return null;let n=i.marks,r=t.parent.maybeChild(t.index());for(var a=0;a<n.length;a++)n[a].type.spec.inclusive===!1&&(!r||!n[a].isInSet(r.marks))&&(n=n[a--].removeFromSet(n));return n}sharedDepth(t){for(let i=this.depth;i>0;i--)if(this.start(i)<=t&&this.end(i)>=t)return i;return 0}blockRange(t=this,i){if(t.pos<this.pos)return t.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);n>=0;n--)if(t.pos<=this.end(n)&&(!i||i(this.node(n))))return new Qr(this,t,n);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let i=1;i<=this.depth;i++)t+=(t?"/":"")+this.node(i).type.name+"_"+this.index(i-1);return t+":"+this.parentOffset}static resolve(t,i){if(!(i>=0&&i<=t.content.size))throw new RangeError("Position "+i+" out of range");let n=[],r=0,a=i;for(let o=t;;){let{index:l,offset:c}=o.content.findIndex(a),f=a-c;if(n.push(o,l,r+c),!f||(o=o.child(l),o.isText))break;a=f-1,r+=c+1}return new Vn(i,n,a)}static resolveCached(t,i){let n=xl.get(t);if(n)for(let a=0;a<n.elts.length;a++){let o=n.elts[a];if(o.pos==i)return o}else xl.set(t,n=new uv);let r=n.elts[n.i]=Vn.resolve(t,i);return n.i=(n.i+1)%fv,r}}class uv{constructor(){this.elts=[],this.i=0}}const fv=12,xl=new WeakMap;class Qr{constructor(t,i,n){this.$from=t,this.$to=i,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const pv=Object.create(null);let Pi=class Mo{constructor(t,i,n,r=Re.none){this.type=t,this.attrs=i,this.marks=r,this.content=n||Z.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,i,n,r=0){this.content.nodesBetween(t,i,n,r,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,i,n,r){return this.content.textBetween(t,i,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,i,n){return this.type==t&&Jr(this.attrs,i||t.defaultAttrs||pv)&&Re.sameSet(this.marks,n||Re.none)}copy(t=null){return t==this.content?this:new Mo(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Mo(this.type,this.attrs,this.content,t)}cut(t,i=this.content.size){return t==0&&i==this.content.size?this:this.copy(this.content.cut(t,i))}slice(t,i=this.content.size,n=!1){if(t==i)return ae.empty;let r=this.resolve(t),a=this.resolve(i),o=n?0:r.sharedDepth(i),l=r.start(o),f=r.node(o).content.cut(r.pos-l,a.pos-l);return new ae(f,r.depth-o,a.depth-o)}replace(t,i,n){return lv(this.resolve(t),this.resolve(i),n)}nodeAt(t){for(let i=this;;){let{index:n,offset:r}=i.content.findIndex(t);if(i=i.maybeChild(n),!i)return null;if(r==t||i.isText)return i;t-=r+1}}childAfter(t){let{index:i,offset:n}=this.content.findIndex(t);return{node:this.content.maybeChild(i),index:i,offset:n}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:i,offset:n}=this.content.findIndex(t);if(n<t)return{node:this.content.child(i),index:i,offset:n};let r=this.content.child(i-1);return{node:r,index:i-1,offset:n-r.nodeSize}}resolve(t){return Vn.resolveCached(this,t)}resolveNoCache(t){return Vn.resolve(this,t)}rangeHasMark(t,i,n){let r=!1;return i>t&&this.nodesBetween(t,i,a=>(n.isInSet(a.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),bu(this.marks,t)}contentMatchAt(t){let i=this.type.contentMatch.matchFragment(this.content,0,t);if(!i)throw new Error("Called contentMatchAt on a node with invalid content");return i}canReplace(t,i,n=Z.empty,r=0,a=n.childCount){let o=this.contentMatchAt(t).matchFragment(n,r,a),l=o&&o.matchFragment(this.content,i);if(!l||!l.validEnd)return!1;for(let c=r;c<a;c++)if(!this.type.allowsMarks(n.child(c).marks))return!1;return!0}canReplaceWith(t,i,n,r){if(r&&!this.type.allowsMarks(r))return!1;let a=this.contentMatchAt(t).matchType(n),o=a&&a.matchFragment(this.content,i);return o?o.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=Re.none;for(let i=0;i<this.marks.length;i++){let n=this.marks[i];n.type.checkAttrs(n.attrs),t=n.addToSet(t)}if(!Re.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(i=>i.type.name)}`);this.content.forEach(i=>i.check())}toJSON(){let t={type:this.type.name};for(let i in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(i=>i.toJSON())),t}static fromJSON(t,i){if(!i)throw new RangeError("Invalid input for Node.fromJSON");let n;if(i.marks){if(!Array.isArray(i.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=i.marks.map(t.markFromJSON)}if(i.type=="text"){if(typeof i.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(i.text,n)}let r=Z.fromJSON(t,i.content),a=t.nodeType(i.type).create(i.attrs,r,n);return a.type.checkAttrs(a.attrs),a}};Pi.prototype.text=void 0;class Yr extends Pi{constructor(t,i,n,r){if(super(t,i,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):bu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,i){return this.text.slice(t,i)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Yr(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Yr(this.type,this.attrs,t,this.marks)}cut(t=0,i=this.text.length){return t==0&&i==this.text.length?this:this.withText(this.text.slice(t,i))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function bu(e,t){for(let i=e.length-1;i>=0;i--)t=e[i].type.name+"("+t+")";return t}class Ui{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,i){let n=new dv(t,i);if(n.next==null)return Ui.empty;let r=gu(n);n.next&&n.err("Unexpected trailing text");let a=xv(yv(r));return kv(a,n),a}matchType(t){for(let i=0;i<this.next.length;i++)if(this.next[i].type==t)return this.next[i].next;return null}matchFragment(t,i=0,n=t.childCount){let r=this;for(let a=i;r&&a<n;a++)r=r.matchType(t.child(a).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:i}=this.next[t];if(!(i.isText||i.hasRequiredAttrs()))return i}return null}compatible(t){for(let i=0;i<this.next.length;i++)for(let n=0;n<t.next.length;n++)if(this.next[i].type==t.next[n].type)return!0;return!1}fillBefore(t,i=!1,n=0){let r=[this];function a(o,l){let c=o.matchFragment(t,n);if(c&&(!i||c.validEnd))return Z.from(l.map(f=>f.createAndFill()));for(let f=0;f<o.next.length;f++){let{type:p,next:m}=o.next[f];if(!(p.isText||p.hasRequiredAttrs())&&r.indexOf(m)==-1){r.push(m);let d=a(m,l.concat(p));if(d)return d}}return null}return a(this,[])}findWrapping(t){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==t)return this.wrapCache[n+1];let i=this.computeWrapping(t);return this.wrapCache.push(t,i),i}computeWrapping(t){let i=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),a=r.match;if(a.matchType(t)){let o=[];for(let l=r;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<a.next.length;o++){let{type:l,next:c}=a.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in i)&&(!r.type||c.validEnd)&&(n.push({match:l.contentMatch,type:l,via:r}),i[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function i(n){t.push(n);for(let r=0;r<n.next.length;r++)t.indexOf(n.next[r].next)==-1&&i(n.next[r].next)}return i(this),t.map((n,r)=>{let a=r+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)a+=(o?", ":"")+n.next[o].type.name+"->"+t.indexOf(n.next[o].next);return a}).join(`
443
443
  `)}}Ui.empty=new Ui(!0);class dv{constructor(t,i){this.string=t,this.nodeTypes=i,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function gu(e){let t=[];do t.push(mv(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function mv(e){let t=[];do t.push(hv(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function hv(e){let t=vv(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=bv(e,t);else break;return t}function kl(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function bv(e,t){let i=kl(e),n=i;return e.eat(",")&&(e.next!="}"?n=kl(e):n=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:i,max:n,expr:t}}function gv(e,t){let i=e.nodeTypes,n=i[t];if(n)return[n];let r=[];for(let a in i){let o=i[a];o.isInGroup(t)&&r.push(o)}return r.length==0&&e.err("No node type or group '"+t+"' found"),r}function vv(e){if(e.eat("(")){let t=gu(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=gv(e,e.next).map(i=>(e.inline==null?e.inline=i.isInline:e.inline!=i.isInline&&e.err("Mixing inline and block content"),{type:"name",value:i}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function yv(e){let t=[[]];return r(a(e,0),i()),t;function i(){return t.push([])-1}function n(o,l,c){let f={term:c,to:l};return t[o].push(f),f}function r(o,l){o.forEach(c=>c.to=l)}function a(o,l){if(o.type=="choice")return o.exprs.reduce((c,f)=>c.concat(a(f,l)),[]);if(o.type=="seq")for(let c=0;;c++){let f=a(o.exprs[c],l);if(c==o.exprs.length-1)return f;r(f,l=i())}else if(o.type=="star"){let c=i();return n(l,c),r(a(o.expr,c),c),[n(c)]}else if(o.type=="plus"){let c=i();return r(a(o.expr,l),c),r(a(o.expr,c),c),[n(c)]}else{if(o.type=="opt")return[n(l)].concat(a(o.expr,l));if(o.type=="range"){let c=l;for(let f=0;f<o.min;f++){let p=i();r(a(o.expr,c),p),c=p}if(o.max==-1)r(a(o.expr,c),c);else for(let f=o.min;f<o.max;f++){let p=i();n(c,p),r(a(o.expr,c),p),c=p}return[n(c)]}else{if(o.type=="name")return[n(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function vu(e,t){return t-e}function wl(e,t){let i=[];return n(t),i.sort(vu);function n(r){let a=e[r];if(a.length==1&&!a[0].term)return n(a[0].to);i.push(r);for(let o=0;o<a.length;o++){let{term:l,to:c}=a[o];!l&&i.indexOf(c)==-1&&n(c)}}}function xv(e){let t=Object.create(null);return i(wl(e,0));function i(n){let r=[];n.forEach(o=>{e[o].forEach(({term:l,to:c})=>{if(!l)return;let f;for(let p=0;p<r.length;p++)r[p][0]==l&&(f=r[p][1]);wl(e,c).forEach(p=>{f||r.push([l,f=[]]),f.indexOf(p)==-1&&f.push(p)})})});let a=t[n.join(",")]=new Ui(n.indexOf(e.length-1)>-1);for(let o=0;o<r.length;o++){let l=r[o][1].sort(vu);a.next.push({type:r[o][0],next:t[l.join(",")]||i(l)})}return a}}function kv(e,t){for(let i=0,n=[e];i<n.length;i++){let r=n[i],a=!r.validEnd,o=[];for(let l=0;l<r.next.length;l++){let{type:c,next:f}=r.next[l];o.push(c.name),a&&!(c.isText||c.hasRequiredAttrs())&&(a=!1),n.indexOf(f)==-1&&n.push(f)}a&&t.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function yu(e){let t=Object.create(null);for(let i in e){let n=e[i];if(!n.hasDefault)return null;t[i]=n.default}return t}function xu(e,t){let i=Object.create(null);for(let n in e){let r=t&&t[n];if(r===void 0){let a=e[n];if(a.hasDefault)r=a.default;else throw new RangeError("No value supplied for attribute "+n)}i[n]=r}return i}function ku(e,t,i,n){for(let r in t)if(!(r in e))throw new RangeError(`Unsupported attribute ${r} for ${i} of type ${n}`);for(let r in e)e[r].validate&&e[r].validate(t[r])}function wu(e,t){let i=Object.create(null);if(t)for(let n in t)i[n]=new _v(e,n,t[n]);return i}let _l=class _u{constructor(t,i,n){this.name=t,this.schema=i,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=wu(t,n.attrs),this.defaultAttrs=yu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ui.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:xu(this.attrs,t)}create(t=null,i,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Pi(this,this.computeAttrs(t),Z.from(i),Re.setFrom(n))}createChecked(t=null,i,n){return i=Z.from(i),this.checkContent(i),new Pi(this,this.computeAttrs(t),i,Re.setFrom(n))}createAndFill(t=null,i,n){if(t=this.computeAttrs(t),i=Z.from(i),i.size){let o=this.contentMatch.fillBefore(i);if(!o)return null;i=o.append(i)}let r=this.contentMatch.matchFragment(i),a=r&&r.fillBefore(Z.empty,!0);return a?new Pi(this,t,i.append(a),Re.setFrom(n)):null}validContent(t){let i=this.contentMatch.matchFragment(t);if(!i||!i.validEnd)return!1;for(let n=0;n<t.childCount;n++)if(!this.allowsMarks(t.child(n).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){ku(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let i=0;i<t.length;i++)if(!this.allowsMarkType(t[i].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let i;for(let n=0;n<t.length;n++)this.allowsMarkType(t[n].type)?i&&i.push(t[n]):i||(i=t.slice(0,n));return i?i.length?i:Re.none:t}static compile(t,i){let n=Object.create(null);t.forEach((a,o)=>n[a]=new _u(a,i,o));let r=i.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let a in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};function wv(e,t,i){let n=i.split("|");return r=>{let a=r===null?"null":typeof r;if(n.indexOf(a)<0)throw new RangeError(`Expected value of type ${n} for attribute ${t} on type ${e}, got ${a}`)}}class _v{constructor(t,i,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?wv(t,i,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Pa{constructor(t,i,n,r){this.name=t,this.rank=i,this.schema=n,this.spec=r,this.attrs=wu(t,r.attrs),this.excluded=null;let a=yu(this.attrs);this.instance=a?new Re(this,a):null}create(t=null){return!t&&this.instance?this.instance:new Re(this,xu(this.attrs,t))}static compile(t,i){let n=Object.create(null),r=0;return t.forEach((a,o)=>n[a]=new Pa(a,r++,i,o)),n}removeFromSet(t){for(var i=0;i<t.length;i++)t[i].type==this&&(t=t.slice(0,i).concat(t.slice(i+1)),i--);return t}isInSet(t){for(let i=0;i<t.length;i++)if(t[i].type==this)return t[i]}checkAttrs(t){ku(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}class Sv{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let i=this.spec={};for(let r in t)i[r]=t[r];i.nodes=Qe.from(t.nodes),i.marks=Qe.from(t.marks||{}),this.nodes=_l.compile(this.spec.nodes,this),this.marks=Pa.compile(this.spec.marks,this);let n=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let a=this.nodes[r],o=a.spec.content||"",l=a.spec.marks;if(a.contentMatch=n[o]||(n[o]=Ui.parse(o,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=l=="_"?null:l?Sl(this,l.split(" ")):l==""||!a.inlineContent?[]:null}for(let r in this.marks){let a=this.marks[r],o=a.spec.excludes;a.excluded=o==null?[a]:o==""?[]:Sl(this,o.split(" "))}this.nodeFromJSON=r=>Pi.fromJSON(this,r),this.markFromJSON=r=>Re.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,i=null,n,r){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof _l){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(i,n,r)}text(t,i){let n=this.nodes.text;return new Yr(n,n.defaultAttrs,t,Re.setFrom(i))}mark(t,i){return typeof t=="string"&&(t=this.marks[t]),t.create(i)}nodeType(t){let i=this.nodes[t];if(!i)throw new RangeError("Unknown node type: "+t);return i}}function Sl(e,t){let i=[];for(let n=0;n<t.length;n++){let r=t[n],a=e.marks[r],o=a;if(a)i.push(a);else for(let l in e.marks){let c=e.marks[l];(r=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(r)>-1)&&i.push(o=c)}if(!o)throw new SyntaxError("Unknown mark type: '"+t[n]+"'")}return i}function Cv(e){return e.tag!=null}function Ev(e){return e.style!=null}let Br=class zo{constructor(t,i){this.schema=t,this.rules=i,this.tags=[],this.styles=[];let n=this.matchedStyles=[];i.forEach(r=>{if(Cv(r))this.tags.push(r);else if(Ev(r)){let a=/[^=]*/.exec(r.style)[0];n.indexOf(a)<0&&n.push(a),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let a=t.nodes[r.node];return a.contentMatch.matchType(a)})}parse(t,i={}){let n=new El(this,i,!1);return n.addAll(t,Re.none,i.from,i.to),n.finish()}parseSlice(t,i={}){let n=new El(this,i,!0);return n.addAll(t,Re.none,i.from,i.to),ae.maxOpen(n.finish())}matchTag(t,i,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let a=this.tags[r];if(Ov(t,a.tag)&&(a.namespace===void 0||t.namespaceURI==a.namespace)&&(!a.context||i.matchesContext(a.context))){if(a.getAttrs){let o=a.getAttrs(t);if(o===!1)continue;a.attrs=o||void 0}return a}}}matchStyle(t,i,n,r){for(let a=r?this.styles.indexOf(r)+1:0;a<this.styles.length;a++){let o=this.styles[a],l=o.style;if(!(l.indexOf(t)!=0||o.context&&!n.matchesContext(o.context)||l.length>t.length&&(l.charCodeAt(t.length)!=61||l.slice(t.length+1)!=i))){if(o.getAttrs){let c=o.getAttrs(i);if(c===!1)continue;o.attrs=c||void 0}return o}}}static schemaRules(t){let i=[];function n(r){let a=r.priority==null?50:r.priority,o=0;for(;o<i.length;o++){let l=i[o];if((l.priority==null?50:l.priority)<a)break}i.splice(o,0,r)}for(let r in t.marks){let a=t.marks[r].spec.parseDOM;a&&a.forEach(o=>{n(o=Nl(o)),o.mark||o.ignore||o.clearMark||(o.mark=r)})}for(let r in t.nodes){let a=t.nodes[r].spec.parseDOM;a&&a.forEach(o=>{n(o=Nl(o)),o.node||o.ignore||o.mark||(o.node=r)})}return i}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new zo(t,zo.schemaRules(t)))}};const Su={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},Nv={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Cu={ol:!0,ul:!0},Fn=1,Io=2,Tn=4;function Cl(e,t,i){return t!=null?(t?Fn:0)|(t==="full"?Io:0):e&&e.whitespace=="pre"?Fn|Io:i&~Tn}class wr{constructor(t,i,n,r,a,o){this.type=t,this.attrs=i,this.marks=n,this.solid=r,this.options=o,this.content=[],this.activeMarks=Re.none,this.match=a||(o&Tn?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let i=this.type.contentMatch.fillBefore(Z.from(t));if(i)this.match=this.type.contentMatch.matchFragment(i);else{let n=this.type.contentMatch,r;return(r=n.findWrapping(t.type))?(this.match=n,r):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Fn)){let n=this.content[this.content.length-1],r;if(n&&n.isText&&(r=/[ \t\r\n\u000c]+$/.exec(n.text))){let a=n;n.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-r[0].length))}}let i=Z.from(this.content);return!t&&this.match&&(i=i.append(this.match.fillBefore(Z.empty,!0))),this.type?this.type.create(this.attrs,i,this.marks):i}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!Su.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class El{constructor(t,i,n){this.parser=t,this.options=i,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=i.topNode,a,o=Cl(null,i.preserveWhitespace,0)|(n?Tn:0);r?a=new wr(r.type,r.attrs,Re.none,!0,i.topMatch||r.type.contentMatch,o):n?a=new wr(null,null,Re.none,!0,null,o):a=new wr(t.schema.topNodeType,null,Re.none,!0,null,o),this.nodes=[a],this.find=i.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,i){t.nodeType==3?this.addTextNode(t,i):t.nodeType==1&&this.addElement(t,i)}addTextNode(t,i){let n=t.nodeValue,r=this.top,a=r.options&Io?"full":this.localPreserveWS||(r.options&Fn)>0,{schema:o}=this.parser;if(a==="full"||r.inlineContext(t)||/[^ \t\r\n\u000c]/.test(n)){if(a)if(a==="full")n=n.replace(/\r\n?/g,`
444
444
  `);else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=n.split(/\r?\n|\r/);for(let c=0;c<l.length;c++)c&&this.insertNode(o.linebreakReplacement.create(),i,!0),l[c]&&this.insertNode(o.text(l[c]),i,!/\S/.test(l[c]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let l=r.content[r.content.length-1],c=t.previousSibling;(!l||c&&c.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),i,!/\S/.test(n)),this.findInText(t)}else this.findInside(t)}addElement(t,i,n){let r=this.localPreserveWS,a=this.top;(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let o=t.nodeName.toLowerCase(),l;Cu.hasOwnProperty(o)&&this.parser.normalizeLists&&Av(t);let c=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(l=this.parser.matchTag(t,this,n));e:if(c?c.ignore:Nv.hasOwnProperty(o))this.findInside(t),this.ignoreFallback(t,i);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(t=c.skip);let f,p=this.needsBlock;if(Su.hasOwnProperty(o))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),f=!0,a.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,i);break e}let m=c&&c.skip?i:this.readStyles(t,i);m&&this.addAll(t,m),f&&this.sync(a),this.needsBlock=p}else{let f=this.readStyles(t,i);f&&this.addElementByRule(t,c,f,c.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(t,i){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
445
445
  `),i)}ignoreFallback(t,i){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),i,!0)}readStyles(t,i){let n=t.style;if(n&&n.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let a=this.parser.matchedStyles[r],o=n.getPropertyValue(a);if(o)for(let l=void 0;;){let c=this.parser.matchStyle(a,o,this,l);if(!c)break;if(c.ignore)return null;if(c.clearMark?i=i.filter(f=>!c.clearMark(f)):i=i.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)l=c;else break}}return i}addElementByRule(t,i,n,r){let a,o;if(i.node)if(o=this.parser.schema.nodes[i.node],o.isLeaf)this.insertNode(o.create(i.attrs),n,t.nodeName=="BR")||this.leafFallback(t,n);else{let c=this.enter(o,i.attrs||null,n,i.preserveWhitespace);c&&(a=!0,n=c)}else{let c=this.parser.schema.marks[i.mark];n=n.concat(c.create(i.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(t);else if(r)this.addElement(t,n,r);else if(i.getContent)this.findInside(t),i.getContent(t,this.parser.schema).forEach(c=>this.insertNode(c,n,!1));else{let c=t;typeof i.contentElement=="string"?c=t.querySelector(i.contentElement):typeof i.contentElement=="function"?c=i.contentElement(t):i.contentElement&&(c=i.contentElement),this.findAround(t,c,!0),this.addAll(c,n),this.findAround(t,c,!1)}a&&this.sync(l)&&this.open--}addAll(t,i,n,r){let a=n||0;for(let o=n?t.childNodes[n]:t.firstChild,l=r==null?null:t.childNodes[r];o!=l;o=o.nextSibling,++a)this.findAtPoint(t,a),this.addDOM(o,i);this.findAtPoint(t,a)}findPlace(t,i,n){let r,a;for(let o=this.open,l=0;o>=0;o--){let c=this.nodes[o],f=c.findWrapping(t);if(f&&(!r||r.length>f.length+l)&&(r=f,a=c,!f.length))break;if(c.solid){if(n)break;l+=2}}if(!r)return null;this.sync(a);for(let o=0;o<r.length;o++)i=this.enterInner(r[o],null,i,!1);return i}insertNode(t,i,n){if(t.isInline&&this.needsBlock&&!this.top.type){let a=this.textblockFromContext();a&&(i=this.enterInner(a,null,i))}let r=this.findPlace(t,i,n);if(r){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(t.type));let o=Re.none;for(let l of r.concat(t.marks))(a.type?a.type.allowsMarkType(l.type):Al(l.type,t.type))&&(o=l.addToSet(o));return a.content.push(t.mark(o)),!0}return!1}enter(t,i,n,r){let a=this.findPlace(t.create(i),n,!1);return a&&(a=this.enterInner(t,i,n,!0,r)),a}enterInner(t,i,n,r=!1,a){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(t);let l=Cl(t,a,o.options);o.options&Tn&&o.content.length==0&&(l|=Tn);let c=Re.none;return n=n.filter(f=>(o.type?o.type.allowsMarkType(f.type):Al(f.type,t))?(c=f.addToSet(c),!1):!0),this.nodes.push(new wr(t,i,c,r,null,l)),this.open++,n}closeExtra(t=!1){let i=this.nodes.length-1;if(i>this.open){for(;i>this.open;i--)this.nodes[i-1].content.push(this.nodes[i].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(t){for(let i=this.open;i>=0;i--){if(this.nodes[i]==t)return this.open=i,!0;this.localPreserveWS&&(this.nodes[i].options|=Fn)}return!1}get currentPos(){this.closeExtra();let t=0;for(let i=this.open;i>=0;i--){let n=this.nodes[i].content;for(let r=n.length-1;r>=0;r--)t+=n[r].nodeSize;i&&t++}return t}findAtPoint(t,i){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&this.find[n].offset==i&&(this.find[n].pos=this.currentPos)}findInside(t){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&t.nodeType==1&&t.contains(this.find[i].node)&&(this.find[i].pos=this.currentPos)}findAround(t,i,n){if(t!=i&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&t.nodeType==1&&t.contains(this.find[r].node)&&i.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(t){if(this.find)for(let i=0;i<this.find.length;i++)this.find[i].node==t&&(this.find[i].pos=this.currentPos-(t.nodeValue.length-this.find[i].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let i=t.split("/"),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),a=-(n?n.depth+1:0)+(r?0:1),o=(l,c)=>{for(;l>=0;l--){let f=i[l];if(f==""){if(l==i.length-1||l==0)continue;for(;c>=a;c--)if(o(l-1,c))return!0;return!1}else{let p=c>0||c==0&&r?this.nodes[c].type:n&&c>=a?n.node(c-a).type:null;if(!p||p.name!=f&&!p.isInGroup(f))return!1;c--}}return!0};return o(i.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let i=t.depth;i>=0;i--){let n=t.node(i).contentMatchAt(t.indexAfter(i)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let i in this.parser.schema.nodes){let n=this.parser.schema.nodes[i];if(n.isTextblock&&n.defaultAttrs)return n}}}function Av(e){for(let t=e.firstChild,i=null;t;t=t.nextSibling){let n=t.nodeType==1?t.nodeName.toLowerCase():null;n&&Cu.hasOwnProperty(n)&&i?(i.appendChild(t),t=i):n=="li"?i=t:n&&(i=null)}}function Ov(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function Nl(e){let t={};for(let i in e)t[i]=e[i];return t}function Al(e,t){let i=t.schema.nodes;for(let n in i){let r=i[n];if(!r.allowsMarkType(e))continue;let a=[],o=l=>{a.push(l);for(let c=0;c<l.edgeCount;c++){let{type:f,next:p}=l.edge(c);if(f==t||a.indexOf(p)<0&&o(p))return!0}};if(o(r.contentMatch))return!0}}class Kn{constructor(t,i){this.nodes=t,this.marks=i}serializeFragment(t,i={},n){n||(n=_r(i).createDocumentFragment());let r=n,a=[];return t.forEach(o=>{if(a.length||o.marks.length){let l=0,c=0;for(;l<a.length&&c<o.marks.length;){let f=o.marks[c];if(!this.marks[f.type.name]){c++;continue}if(!f.eq(a[l][0])||f.type.spec.spanning===!1)break;l++,c++}for(;l<a.length;)r=a.pop()[1];for(;c<o.marks.length;){let f=o.marks[c++],p=this.serializeMark(f,o.isInline,i);p&&(a.push([f,r]),r.appendChild(p.dom),r=p.contentDOM||p.dom)}}r.appendChild(this.serializeNodeInner(o,i))}),n}serializeNodeInner(t,i){if(t.isText)return _r(i).createTextNode(t.text);let{dom:n,contentDOM:r}=Pr(_r(i),this.nodes[t.type.name](t),null,t.attrs);if(r){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,i,r)}return n}serializeNode(t,i={}){let n=this.serializeNodeInner(t,i);for(let r=t.marks.length-1;r>=0;r--){let a=this.serializeMark(t.marks[r],t.isInline,i);a&&((a.contentDOM||a.dom).appendChild(n),n=a.dom)}return n}serializeMark(t,i,n={}){let r=this.marks[t.type.name];return r&&Pr(_r(n),r(t,i),null,t.attrs)}static renderSpec(t,i,n=null,r){return typeof i=="string"?{dom:t.createTextNode(i)}:Pr(t,i,n,r)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new Kn(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let i=Ol(t.nodes);return i.text||(i.text=n=>n.text),i}static marksFromSchema(t){return Ol(t.marks)}}function Ol(e){let t={};for(let i in e){let n=e[i].spec.toDOM;n&&(t[i]=n)}return t}function _r(e){return e.document||window.document}const Tl=new WeakMap;function Tv(e){let t=Tl.get(e);return t===void 0&&Tl.set(e,t=Mv(e)),t}function Mv(e){let t=null;function i(n){if(n&&typeof n=="object")if(Array.isArray(n))if(typeof n[0]=="string")t||(t=[]),t.push(n);else for(let r=0;r<n.length;r++)i(n[r]);else for(let r in n)i(n[r])}return i(e),t}function Pr(e,t,i,n){if(t.nodeType==1)return{dom:t};if(t.dom&&t.dom.nodeType==1)return t;let r=t[0],a;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(n&&(a=Tv(n))&&a.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=r.indexOf(" ");o>0&&(i=r.slice(0,o),r=r.slice(o+1));let l,c=i?e.createElementNS(i,r):e.createElement(r),f=t[1],p=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){p=2;for(let m in f)if(f[m]!=null){let d=m.indexOf(" ");d>0?c.setAttributeNS(m.slice(0,d),m.slice(d+1),f[m]):m=="style"&&c.style?c.style.cssText=f[m]:c.setAttribute(m,f[m])}}for(let m=p;m<t.length;m++){let d=t[m];if(d===0){if(m<t.length-1||m>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else if(typeof d=="string")c.appendChild(e.createTextNode(d));else{let{dom:h,contentDOM:v}=Pr(e,d,i,n);if(c.appendChild(h),v){if(l)throw new RangeError("Multiple content holes");l=v}}}return{dom:c,contentDOM:l}}function zv(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var u={PROCESSOR_VERSION:"1.4.61",error:function(e){throw typeof Error>"u"?new Error("citeproc-js error: "+e):"citeproc-js error: "+e},debug:function(e){typeof console>"u"?dump("CSL: "+e+`
@@ -450,7 +450,7 @@
450
450
  `).split(`
451
451
  `);for(var d=0,h={},a=0,o=r.length;a<o;a++){var l=r[a],v=l.match(u.NOTE_FIELD_REGEXP);if(l.trim()){if(!v){if(a===0)continue;d=a;break}}else continue;var b=v[1],y=v[2].replace(/^\s+/,"").replace(/\s+$/,"");if(b==="type")e.type=y,r[a]="";else if(u.DATE_VARIABLES.indexOf(b.replace(/^alt-/,""))>-1)(!e[b]||i)&&(e[b]=u.DateParser.parseDateToArray(y),(!t||t[b]&&this.isDateString(y))&&(r[a]=""));else if(!e[b]){if(u.NAME_VARIABLES.indexOf(b.replace(/^alt-/,""))>-1){h[b]||(h[b]=[]);var g=y.split(/\s*\|\|\s*/);if(g.length===1)h[b].push({literal:g[0]});else if(g.length===2){var x={family:g[0],given:g[1]};u.parseParticles(x),h[b].push(x)}}else e[b]=y;(!t||t[b])&&(r[a]="")}}for(var b in h)e[b]=h[b];if(t){r[d].trim()&&(r[d]=`
452
452
  `+r[d]);for(var a=d-1;a>-1;a--)r[a].trim()||(r=r.slice(0,a).concat(r.slice(a+1)))}e.note=r.join(`
453
- `).trim()}},checkPrefixSpaceAppend:function(e,a){a||(a="");var i="",n=a.replace(/<[^>]+>/g,"").replace(/["'\u201d\u2019\u00bb\u202f\u00a0 ]+$/g,""),r=n.slice(-1);(n.match(u.ENDSWITH_ROMANESQUE_REGEXP)||u.TERMINAL_PUNCTUATION.slice(0,-1).indexOf(r)>-1||r.match(/[\)\],0-9]/))&&(i=" ");var a=(a+i).replace(/\s+/g," ");return a},checkIgnorePredecessor:function(e,t){var i=t.replace(/<[^>]+>/g,"").replace(/["'\u201d\u2019\u00bb\u202f\u00a0 ]+$/g,""),n=i.slice(-1);return u.TERMINAL_PUNCTUATION.slice(0,-1).indexOf(n)>-1&&t.trim().indexOf(" ")>-1?(e.tmp.term_predecessor=!1,!0):!1},checkSuffixSpacePrepend:function(e,t){return t?((t.match(u.STARTSWITH_ROMANESQUE_REGEXP)||["[","("].indexOf(t.slice(0,1))>-1)&&(t=" "+t),t):""},GENDERS:["masculine","feminine"],ERROR_NO_RENDERED_FORM:1,PREVIEW:"Just for laughs.",ASSUME_ALL_ITEMS_REGISTERED:2,START:0,END:1,SINGLETON:2,SEEN:6,SUCCESSOR:3,SUCCESSOR_OF_SUCCESSOR:4,SUPPRESS:5,SINGULAR:0,PLURAL:1,LITERAL:!0,BEFORE:1,AFTER:2,DESCENDING:1,ASCENDING:2,PRIMARY:1,SECONDARY:2,POSITION_FIRST:0,POSITION_SUBSEQUENT:1,POSITION_IBID:2,POSITION_IBID_WITH_LOCATOR:3,POSITION_CONTAINER_SUBSEQUENT:4,POSITION_MAP:{0:0,4:1,1:2,2:3,3:4},POSITION_TEST_VARS:["position","first-reference-note-number","near-note"],AREAS:["citation","citation_sort","bibliography","bibliography_sort","intext"],CITE_FIELDS:["first-reference-note-number","first-container-reference-note-number","locator","locator-extra"],SWAPPING_PUNCTUATION:[".","!","?",":",","],TERMINAL_PUNCTUATION:[":",".",";","!","?"," "],NONE:0,NUMERIC:1,POSITION:2,TRIGRAPH:3,DATE_PARTS:["year","month","day"],DATE_PARTS_ALL:["year","month","day","season"],DATE_PARTS_INTERNAL:["year","month","day","year_end","month_end","day_end"],NAME_PARTS:["non-dropping-particle","family","given","dropping-particle","suffix","literal"],DISAMBIGUATE_OPTIONS:["disambiguate-add-names","disambiguate-add-givenname","disambiguate-add-year-suffix"],GIVENNAME_DISAMBIGUATION_RULES:["all-names","all-names-with-initials","primary-name","primary-name-with-initials","by-cite"],NAME_ATTRIBUTES:["and","delimiter-precedes-last","delimiter-precedes-et-al","initialize-with","initialize","name-as-sort-order","sort-separator","et-al-min","et-al-use-first","et-al-subsequent-min","et-al-subsequent-use-first","form","prefix","suffix","delimiter"],LOOSE:0,STRICT:1,TOLERANT:2,PREFIX_PUNCTUATION:/[.;:]\s*$/,SUFFIX_PUNCTUATION:/^\s*[.;:,\(\)]/,NUMBER_REGEXP:/(?:^\d+|\d+$)/,NAME_INITIAL_REGEXP:/^([A-Z\u0e01-\u0e5b\u00c0-\u017f\u0400-\u042f\u0590-\u05d4\u05d6-\u05ff\u0600-\u06ff\u0370\u0372\u0376\u0386\u0388-\u03ab\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7\u03fd-\u03ff])([a-zA-Z\u0e01-\u0e5b\u00c0-\u017f\u0400-\u052f\u0600-\u06ff\u0370-\u03ff\u1f00-\u1fff]*|)(\.)*/,ROMANESQUE_REGEXP:/[-0-9a-zA-Z\u0e01-\u0e5b\u00c0-\u017f\u0370-\u03ff\u0400-\u052f\u0590-\u05d4\u05d6-\u05ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]/,ROMANESQUE_NOT_REGEXP:/[^a-zA-Z\u0e01-\u0e5b\u00c0-\u017f\u0370-\u03ff\u0400-\u052f\u0590-\u05d4\u05d6-\u05ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]/g,STARTSWITH_ROMANESQUE_REGEXP:/^[&a-zA-Z\u0e01-\u0e5b\u00c0-\u017f\u0370-\u03ff\u0400-\u052f\u0590-\u05d4\u05d6-\u05ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]/,ENDSWITH_ROMANESQUE_REGEXP:/[.;:&a-zA-Z\u0e01-\u0e5b\u00c0-\u017f\u0370-\u03ff\u0400-\u052f\u0590-\u05d4\u05d6-\u05ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]$/,ALL_ROMANESQUE_REGEXP:/^[a-zA-Z\u0e01-\u0e5b\u00c0-\u017f\u0370-\u03ff\u0400-\u052f\u0590-\u05d4\u05d6-\u05ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]+$/,VIETNAMESE_SPECIALS:/[\u00c0-\u00c3\u00c8-\u00ca\u00cc\u00cd\u00d2-\u00d5\u00d9\u00da\u00dd\u00e0-\u00e3\u00e8-\u00ea\u00ec\u00ed\u00f2-\u00f5\u00f9\u00fa\u00fd\u0101\u0103\u0110\u0111\u0128\u0129\u0168\u0169\u01a0\u01a1\u01af\u01b0\u1ea0-\u1ef9]/,VIETNAMESE_NAMES:/^(?:(?:[.AaBbCcDdEeGgHhIiKkLlMmNnOoPpQqRrSsTtUuVvXxYy \u00c0-\u00c3\u00c8-\u00ca\u00cc\u00cd\u00d2-\u00d5\u00d9\u00da\u00dd\u00e0-\u00e3\u00e8-\u00ea\u00ec\u00ed\u00f2-\u00f5\u00f9\u00fa\u00fd\u0101\u0103\u0110\u0111\u0128\u0129\u0168\u0169\u01a0\u01a1\u01af\u01b0\u1ea0-\u1ef9]{2,6})(\s+|$))+$/,NOTE_FIELDS_REGEXP:/\{:(?:[\-_a-z]+|[A-Z]+):[^\}]+\}/g,NOTE_FIELD_REGEXP:/^([\-_a-z]+|[A-Z]+):\s*([^\}]+)$/,PARTICLE_GIVEN_REGEXP:/^([^ ]+(?:\u02bb |\u2019 | |\' ) *)(.+)$/,PARTICLE_FAMILY_REGEXP:/^([^ ]+(?:\-|\u02bb|\u2019| |\') *)(.+)$/,DISPLAY_CLASSES:["block","left-margin","right-inline","indent"],NAME_VARIABLES:["author","chair","collection-editor","compiler","composer","container-author","contributor","curator","director","editor","editor-translator","editorial-director","executive-producer","guest","host","illustrator","interviewer","narrator","organizer","original-author","performer","producer","recipient","reviewed-author","script-writer","series-creator","translator","commenter"],CREATORS:["author","chair","collection-editor","compiler","composer","container-author","contributor","curator","director","editor","editor-translator","editorial-director","executive-producer","guest","host","illustrator","interviewer","narrator","organizer","original-author","performer","producer","recipient","reviewed-author","script-writer","series-creator","translator","commenter"],NUMERIC_VARIABLES:["call-number","chapter-number","collection-number","division","edition","page","issue","locator","locator-extra","number","number-of-pages","number-of-volumes","part-number","printing-number","section","supplement-number","version","volume","supplement","citation-number"],DATE_VARIABLES:["locator-date","issued","event-date","accessed","original-date","publication-date","available-date","submitted","alt-issued","alt-event"],VARIABLES_WITH_SHORT_FORM:["title","container-title"],TITLE_FIELD_SPLITS:function(e){for(var t=["title","short","main","sub","subjoin"],i={},n=0,r=t.length;n<r;n++)i[t[n]]=e+"title"+(t[n]==="title"?"":"-"+t[n]);return i},demoteNoiseWords:function(e,t,i){var n=e.locale[e.opt.lang].opts["leading-noise-words"];if(t&&i){t=t.split(/\s+/),t.reverse();for(var r=[],a=t.length-1;a>-1&&n.indexOf(t[a].toLowerCase())>-1;a+=-1)r.push(t.pop());t.reverse();var o=t.join(" "),l=r.join(" ");i==="drop"||!l?t=o:i==="demote"&&(t=[o,l].join(", "))}return t},extractTitleAndSubtitle:function(e,t){var i=t?" ":"",n=[""];this.opt.development_extensions.split_container_title&&n.push("container-");for(var r=0,a=n.length;r<a;r++){var o=n[r],l=u.TITLE_FIELD_SPLITS(o),c=[!1];if(e.multi)for(var f in e.multi._keys[l.short])c.push(f);for(var p=0,m=c.length;p<m;p++){var f=c[p],d={};f?(e.multi._keys[l.title]&&(d[l.title]=e.multi._keys[l.title][f]),e.multi._keys[l.short]&&(d[l.short]=e.multi._keys[l.short][f])):(d[l.title]=e[l.title],d[l.short]=e[l.short]),d[l.main]=d[l.title],d[l.sub]=!1;var h=d[l.short];if(d[l.title]){if(h&&h.toLowerCase()===d[l.title].toLowerCase())d[l.main]=d[l.title],d[l.subjoin]="",d[l.sub]="";else if(h){var v=d[l.title].slice(h.replace(/[\?\!]+$/,"").length),b=d[l.title].replace(v.replace(/^[\?\!]+/,""),"").trim(),y=u.TITLE_SPLIT_REGEXP.matchfirst.exec(v);if(y&&b.toLowerCase()===h.toLowerCase())d[l.main]=b,d[l.subjoin]=y[1].replace(/[\?\!]+(\s*)$/,"$1"),d[l.sub]=v.replace(u.TITLE_SPLIT_REGEXP.matchfirst,""),this.opt.development_extensions.force_short_title_casing_alignment&&(d[l.short]=d[l.main]);else{var g=u.TITLE_SPLIT(d[l.title]);g.length==3?(d[l.main]=g[0],d[l.subjoin]=g[1],d[l.sub]=g[2]):(d[l.main]=d[l.title],d[l.subjoin]="",d[l.sub]="")}}else{var g=u.TITLE_SPLIT(d[l.title]);if(g.length==3){if(d[l.main]=g[0],d[l.subjoin]=g[1],d[l.sub]=g[2],this.opt.development_extensions.implicit_short_title&&e.type!=="legal_case"&&!e[l.short]&&!d[l.main].match(/^[\-\.[0-9]+$/)){var x=d[l.subjoin].trim();["?","!"].indexOf(x)===-1&&(x=""),d[l.short]=d[l.main]+x}}else d[l.main]=d[l.title],d[l.subjoin]="",d[l.sub]=""}if(d[l.subjoin]&&d[l.subjoin].match(/([\?\!])/)){var y=d[l.subjoin].match(/(\s*)$/);d[l.main]=d[l.main]+i+d[l.subjoin].trim(),d[l.subjoin]=y[1]}}if(d[l.subjoin]&&(d[l.subjoin].indexOf(":")>-1&&(d[l.subjoin]=i+": "),(d[l.subjoin].indexOf("-")>-1||d[l.subjoin].indexOf("—")>-1)&&(d[l.subjoin]="—")),f)for(var k in d)e.multi._keys[k]||(e.multi._keys[k]={}),e.multi._keys[k][f]=d[k];else for(var k in d)e[k]=d[k]}}},titlecaseSentenceOrNormal:function(e,t,i,n,r){var a=u.TITLE_FIELD_SPLITS(i),o={};if(n&&t.multi?(t.multi._keys[a.title]&&(o[a.title]=t.multi._keys[a.title][n]),t.multi._keys[a.main]&&(o[a.main]=t.multi._keys[a.main][n]),t.multi._keys[a.sub]&&(o[a.sub]=t.multi._keys[a.sub][n]),t.multi._keys[a.subjoin]&&(o[a.subjoin]=t.multi._keys[a.subjoin][n])):(o[a.title]=t[a.title],o[a.main]=t[a.main],o[a.sub]=t[a.sub],o[a.subjoin]=t[a.subjoin]),o[a.main]&&o[a.sub]){var l=o[a.main],c=o[a.subjoin],f=o[a.sub];return r?(l=u.Output.Formatters.sentence(e,l),f=u.Output.Formatters.sentence(e,f)):e.opt.development_extensions.uppercase_subtitles&&(f=u.Output.Formatters["capitalize-first"](e,f)),[l,c,f].join("")}else if(o[a.title]){if(r)return u.Output.Formatters.sentence(e,o[a.title]);if(e.opt.development_extensions.uppercase_subtitles){for(var p=u.TITLE_SPLIT(o[a.title]),m=0,d=p.length;m<d;m+=2)p[m]=u.Output.Formatters["capitalize-first"](e,p[m]);for(var m=1,d=p.length-1;m<d;m+=2){var h=p[m].match(/([:\?\!] )/);if(h){var v=e.opt["default-locale"][0].slice(0,2).toLowerCase()==="fr"?" ":"";p[m]=v+h[1]}(p[m].indexOf("-")>-1||p[m].indexOf("—")>-1)&&(p[m]="—")}return o[a.title]=p.join(""),o[a.title]}else return o[a.title]}else return""},getSafeEscape:function(e){if(["bibliography","citation"].indexOf(e.tmp.area)>-1){var t=[];return e.opt.development_extensions.thin_non_breaking_space_html_hack&&e.opt.mode==="html"&&t.push(function(i){return i.replace(/\u202f/g,'<span style="white-space:nowrap">&thinsp;</span>')}),t.length?function(i){for(var n=0,r=t.length;n<r;n+=1)i=t[n](i);return u.Output.Formats[e.opt.mode].text_escape(i)}:u.Output.Formats[e.opt.mode].text_escape}else return function(i){return i}},SKIP_WORDS:["about","above","across","afore","after","against","al","along","alongside","amid","amidst","among","amongst","anenst","apropos","apud","around","as","aside","astride","at","athwart","atop","barring","before","behind","below","beneath","beside","besides","between","beyond","but","by","circa","despite","down","during","et","except","for","forenenst","from","given","in","inside","into","lest","like","modulo","near","next","notwithstanding","of","off","on","onto","out","over","per","plus","pro","qua","sans","since","than","through"," thru","throughout","thruout","till","to","toward","towards","under","underneath","until","unto","up","upon","versus","vs.","v.","vs","v","via","vis-à-vis","with","within","without","according to","ahead of","apart from","as for","as of","as per","as regards","aside from","back to","because of","close to","due to","except for","far from","inside of","instead of","near to","next to","on to","out from","out of","outside of","prior to","pursuant to","rather than","regardless of","such as","that of","up to","where as","or","yet","so","for","and","nor","a","an","the","de","d'","von","van","c","ca"],FORMAT_KEY_SEQUENCE:["@strip-periods","@font-style","@font-variant","@font-weight","@text-decoration","@vertical-align","@quotes"],INSTITUTION_KEYS:["font-style","font-variant","font-weight","text-decoration","text-case"],SUFFIX_CHARS:"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z",ROMAN_NUMERALS:[["","i","ii","iii","iv","v","vi","vii","viii","ix"],["","x","xx","xxx","xl","l","lx","lxx","lxxx","xc"],["","c","cc","ccc","cd","d","dc","dcc","dccc","cm"],["","m","mm","mmm","mmmm","mmmmm"]],LANGS:{"af-ZA":"Afrikaans",ar:"Arabic","bg-BG":"Bulgarian","ca-AD":"Catalan","cs-CZ":"Czech","da-DK":"Danish","de-AT":"Austrian","de-CH":"German (CH)","de-DE":"German (DE)","el-GR":"Greek","en-GB":"English (GB)","en-US":"English (US)","es-ES":"Spanish","et-EE":"Estonian",eu:"European","fa-IR":"Persian","fi-FI":"Finnish","fr-CA":"French (CA)","fr-FR":"French (FR)","he-IL":"Hebrew","hr-HR":"Croatian","hu-HU":"Hungarian","is-IS":"Icelandic","it-IT":"Italian","ja-JP":"Japanese","km-KH":"Khmer","ko-KR":"Korean","lt-LT":"Lithuanian","lv-LV":"Latvian","mn-MN":"Mongolian","nb-NO":"Norwegian (Bokmål)","nl-NL":"Dutch","nn-NO":"Norwegian (Nynorsk)","pl-PL":"Polish","pt-BR":"Portuguese (BR)","pt-PT":"Portuguese (PT)","ro-RO":"Romanian","ru-RU":"Russian","sk-SK":"Slovak","sl-SI":"Slovenian","sr-RS":"Serbian","sv-SE":"Swedish","th-TH":"Thai","tr-TR":"Turkish","uk-UA":"Ukrainian","vi-VN":"Vietnamese","zh-CN":"Chinese (CN)","zh-TW":"Chinese (TW)"},LANG_BASES:{af:"af_ZA",ar:"ar",bg:"bg_BG",ca:"ca_AD",cs:"cs_CZ",da:"da_DK",de:"de_DE",el:"el_GR",en:"en_US",es:"es_ES",et:"et_EE",eu:"eu",fa:"fa_IR",fi:"fi_FI",fr:"fr_FR",he:"he_IL",hr:"hr-HR",hu:"hu_HU",is:"is_IS",it:"it_IT",ja:"ja_JP",km:"km_KH",ko:"ko_KR",lt:"lt_LT",lv:"lv-LV",mn:"mn_MN",nb:"nb_NO",nl:"nl_NL",nn:"nn-NO",pl:"pl_PL",pt:"pt_PT",ro:"ro_RO",ru:"ru_RU",sk:"sk_SK",sl:"sl_SI",sr:"sr_RS",sv:"sv_SE",th:"th_TH",tr:"tr_TR",uk:"uk_UA",vi:"vi_VN",zh:"zh_CN"},SUPERSCRIPTS:{ª:"a","²":"2","³":"3","¹":"1",º:"o",ʰ:"h",ʱ:"ɦ",ʲ:"j",ʳ:"r",ʴ:"ɹ",ʵ:"ɻ",ʶ:"ʁ",ʷ:"w",ʸ:"y",ˠ:"ɣ",ˡ:"l",ˢ:"s",ˣ:"x",ˤ:"ʕ","ᴬ":"A","ᴭ":"Æ","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴲ":"Ǝ","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴽ":"Ȣ","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ᵂ":"W","ᵃ":"a","ᵄ":"ɐ","ᵅ":"ɑ","ᵆ":"ᴂ","ᵇ":"b","ᵈ":"d","ᵉ":"e","ᵊ":"ə","ᵋ":"ɛ","ᵌ":"ɜ","ᵍ":"g","ᵏ":"k","ᵐ":"m","ᵑ":"ŋ","ᵒ":"o","ᵓ":"ɔ","ᵔ":"ᴖ","ᵕ":"ᴗ","ᵖ":"p","ᵗ":"t","ᵘ":"u","ᵙ":"ᴝ","ᵚ":"ɯ","ᵛ":"v","ᵜ":"ᴥ","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"φ","ᵡ":"χ","⁰":"0","ⁱ":"i","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","⁺":"+","⁻":"−","⁼":"=","⁽":"(","⁾":")",ⁿ:"n","℠":"SM","™":"TM","㆒":"一","㆓":"二","㆔":"三","㆕":"四","㆖":"上","㆗":"中","㆘":"下","㆙":"甲","㆚":"乙","㆛":"丙","㆜":"丁","㆝":"天","㆞":"地","㆟":"人",ˀ:"ʔ",ˁ:"ʕ",ۥ:"و",ۦ:"ي"},SUPERSCRIPTS_REGEXP:new RegExp("[ª²³¹ºʰʱʲʳʴʵʶʷʸˠˡˢˣˤᴬᴭᴮᴰᴱᴲᴳᴴᴵᴶᴷᴸᴹᴺᴼᴽᴾᴿᵀᵁᵂᵃᵄᵅᵆᵇᵈᵉᵊᵋᵌᵍᵏᵐᵑᵒᵓᵔᵕᵖᵗᵘᵙᵚᵛᵜᵝᵞᵟᵠᵡ⁰ⁱ⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿ℠™㆒㆓㆔㆕㆖㆗㆘㆙㆚㆛㆜㆝㆞㆟ˀˁۥۦ]","g"),UPDATE_GROUP_CONTEXT_CONDITION:function(e,t,i,n,r){if(e.opt.use_context_condition){var a=e.tmp.group_context.tip;a.condition?(a.condition.termtxt||(a.condition.termtxt=t,a.condition.valueTerm=i),!a.value_seen&&a.condition.test==="comma-safe-numbers-only"&&r&&(a.value_seen=!0,r.match(/^[0-9]/)||(e.tmp.just_did_number=!1))):n&&n.decorations.filter(o=>o[0]==="@vertical-align").length>0||n&&n.strings.suffix?e.tmp.just_did_number=!1:t&&(t.match(/[0-9]$/)?e.tmp.just_did_number=!0:e.tmp.just_did_number=!1)}},EVALUATE_GROUP_CONDITION:function(e,t){if(e.opt.use_context_condition){var i,n=t.condition.test==="comma-safe-numbers-only";if(t.condition.test==="empty-label")i=!t.condition.termtxt;else if(t.condition.test==="empty-label-no-decor")i=!t.condition.termtxt||t.condition.termtxt.indexOf("%s")>-1;else if(["comma-safe","comma-safe-numbers-only"].indexOf(t.condition.test)>-1){var r=t.condition.termtxt,a=!1;t.condition.termtxt&&(a=t.condition.termtxt.slice(0,1).match(u.ALL_ROMANESQUE_REGEXP));var o=e.tmp.just_did_number;o?t.condition.valueTerm?i=!n:r?a?i=!n:["always","after-number"].indexOf(e.opt.require_comma_on_symbol)>-1?i=!0:i=!1:i=!0:t.condition.valueTerm?i=!1:r?a?i=!n:e.opt.require_comma_on_symbol==="always"?i=!0:i=!1:i=!1}if(i)var l=!1;else var l=!0;return t.condition.not&&(l=!l),l}},SYS_OPTIONS:["prioritize_disambiguate_condition","csl_reverse_lookup_support","main_title_from_short_title","uppercase_subtitles","force_short_title_casing_alignment","implicit_short_title","split_container_title"],TITLE_SPLIT_REGEXP:function(){var e=["\\.\\s+","\\!\\s+","\\?\\s+","\\s*::*\\s+","\\s*—\\s*","\\s+\\-\\s+","\\s*\\-\\-\\-*\\s*"];return{match:new RegExp("("+e.join("|")+")","g"),matchfirst:new RegExp("^("+e.join("|")+")"),split:new RegExp("(?:"+e.join("|")+")")}}(),TITLE_SPLIT:function(e){if(!e)return e;for(var t=e.match(u.TITLE_SPLIT_REGEXP.match),i=e.split(u.TITLE_SPLIT_REGEXP.split),n=i.length-2;n>-1;n--)i[n]=i[n].trim(),i[n]&&i[n].slice(-1).toLowerCase()!==i[n].slice(-1)?(i[n]=i[n]+t[n]+i[n+1],i=i.slice(0,n+1).concat(i.slice(n+2))):i=i.slice(0,n+1).concat([t[n]]).concat(i.slice(n+1));return i},GET_COURT_CLASS:function(e,t,i){var n="",r=null,a=t.jurisdiction?t.jurisdiction.split(":")[0]:null,o="court_condition_classes";return i&&(o="court_key_classes"),a&&t.authority&&(typeof t.authority=="string"?r=t.authority:t.authority[0]&&t.authority[0].literal&&(r=t.authority[0].literal)),r&&(this.lang&&e.locale[this.lang].opts[o]&&e.locale[this.lang].opts[o][a]&&e.locale[this.lang].opts[o][a][r]?n=e.locale[this.lang].opts[o][a][r]:e.locale[e.opt["default-locale"][0]].opts[o]&&e.locale[e.opt["default-locale"][0]].opts[o][a]&&e.locale[e.opt["default-locale"][0]].opts[o][a][r]&&(n=e.locale[e.opt["default-locale"][0]].opts[o][a][r])),n},SET_COURT_CLASSES:function(e,t,i,n){for(var r=i.getNodesByName(n,"court-class"),a=0,o=i.numberofnodes(r);a<o;a+=1){var l=r[a],c=i.attributes(l),f=c["@name"],p=c["@country"],m=c["@courts"],d="court_key_classes";if(e.registry&&(d="court_condition_classes"),f&&p&&m){m=m.trim().split(/\s+/),e.locale[t].opts[d]||(e.locale[t].opts[d]={}),e.locale[t].opts[d][p]||(e.locale[t].opts[d][p]={});for(var h=0,v=m.length;h<v;h++)e.locale[t].opts[d][p][m[h]]=f}}},INIT_JURISDICTION_MACROS:function(e,t,i,n){if(t["best-jurisdiction"])return!0;if(!e.sys.retrieveStyleModule||!u.MODULE_MACROS[n]||!t.jurisdiction)return!1;var l=e.getJurisdictionList(t.jurisdiction);if(!e.opt.jurisdictions_seen[l[0]]){var r=e.retrieveAllStyleModules(l);for(var a in r){var o=e.loadStyleModule(a,r[a]);o&&(r[o]||(Object.assign(r,e.retrieveAllStyleModules([o])),e.loadStyleModule(o,r[o],!0)))}}var l=e.getJurisdictionList(t.jurisdiction);e.opt.parallel.enable&&(e.parallel||(e.parallel=new u.Parallel(e)));for(var c=0,f=l.length;c<f;c++){var a=l[c];if(i&&e.juris[a]&&!i["best-jurisdiction"]&&e.juris[a].types.locator&&(t["best-jurisdiction"]=a),e.juris[a]&&e.juris[a].types[t.type])return t["best-jurisdiction"]=a,!0}return!1}};u.XmlJSON=function(e){this.dataObj=e,this.institution={name:"institution",attrs:{"institution-parts":"long",delimiter:", "},children:[{name:"institution-part",attrs:{name:"long"},children:[]}]}};u.XmlJSON.prototype.clean=function(e){return e};u.XmlJSON.prototype.getStyleId=function(e,t){var i="id";t&&(i="title");for(var n="",r=e.children,a=0,o=r.length;a<o;a++)if(r[a].name==="info")for(var l=r[a].children,c=0,f=l.length;c<f;c++)l[c].name===i&&(n=l[c].children[0]);return n};u.XmlJSON.prototype.children=function(e){return e&&e.children.length?e.children.slice():!1};u.XmlJSON.prototype.nodename=function(e){return e?e.name:null};u.XmlJSON.prototype.attributes=function(e){var t={};for(var i in e.attrs)t["@"+i]=e.attrs[i];return t};u.XmlJSON.prototype.content=function(e){var t="";if(!e||!e.children)return t;for(var i=0,n=e.children.length;i<n;i+=1)typeof e.children[i]=="string"&&(t+=e.children[i]);return t};u.XmlJSON.prototype.namespace={};u.XmlJSON.prototype.numberofnodes=function(e){return e&&typeof e.length=="number"?e.length:0};u.XmlJSON.prototype.getAttributeValue=function(e,t,i){var n="";return i&&(t=i+":"+t),e&&e.attrs&&(e.attrs[t]?n=e.attrs[t]:n=""),n};u.XmlJSON.prototype.getNodeValue=function(e,t){var i="";if(t)for(var n=0,r=e.children.length;n<r;n+=1)e.children[n].name===t&&(e.children[n].children.length?i=e.children[n]:i="");else e&&(i=e);return i&&i.children&&i.children.length==1&&typeof i.children[0]=="string"&&(i=i.children[0]),i};u.XmlJSON.prototype.setAttributeOnNodeIdentifiedByNameAttribute=function(e,t,i,n,r){n.slice(0,1)==="@"&&(n=n.slice(1));for(var a=0,o=e.children.length;a<o;a+=1)e.children[a].name===t&&e.children[a].attrs.name===i&&(e.children[a].attrs[n]=r)};u.XmlJSON.prototype.deleteNodeByNameAttribute=function(e,t){var i,n;for(i=0,n=e.children.length;i<n;i+=1)!e.children[i]||typeof e.children[i]=="string"||e.children[i].attrs.name==t&&(e.children=e.children.slice(0,i).concat(e.children.slice(i+1)))};u.XmlJSON.prototype.deleteAttribute=function(e,t){typeof e.attrs[t]<"u"&&e.attrs.pop(t)};u.XmlJSON.prototype.setAttribute=function(e,t,i){return e.attrs[t]=i,!1};u.XmlJSON.prototype.nodeCopy=function(e,t){if(!t)var t={};if(typeof t=="object"&&typeof t.length>"u")for(var i in e)typeof e[i]=="string"?t[i]=e[i]:typeof e[i]=="object"&&(typeof e[i].length>"u"?t[i]=this.nodeCopy(e[i],{}):t[i]=this.nodeCopy(e[i],[]));else for(var n=0,r=e.length;n<r;n+=1)typeof e[n]=="string"?t[n]=e[n]:t[n]=this.nodeCopy(e[n],{});return t};u.XmlJSON.prototype.getNodesByName=function(e,t,i,n){if(!n)var n=[];if(!e||!e.children)return n;t===e.name&&(i?i===e.attrs.name&&n.push(e):n.push(e));for(var r=0,a=e.children.length;r<a;r+=1)typeof e.children[r]=="object"&&this.getNodesByName(e.children[r],t,i,n);return n};u.XmlJSON.prototype.nodeNameIs=function(e,t){return typeof e>"u"?!1:t==e.name};u.XmlJSON.prototype.makeXml=function(e){return typeof e=="string"&&(e.slice(0,1)==="<"?e=this.jsonStringWalker.walkToObject(e):e=JSON.parse(e)),e};u.XmlJSON.prototype.insertChildNodeAfter=function(e,t,i,n){for(var r=0,a=e.children.length;r<a;r+=1)if(t===e.children[r]){e.children=e.children.slice(0,r).concat([n]).concat(e.children.slice(r+1));break}return e};u.XmlJSON.prototype.insertPublisherAndPlace=function(e){if(e.name==="group"){for(var t=!0,i=["publisher","publisher-place"],n=0,r=e.children.length;n<r;n+=1){var a=i.indexOf(e.children[n].attrs.variable),o=e.children[n].name==="text";if(o&&a>-1&&!e.children[n].attrs.prefix&&!e.children[n].attrs.suffix)i=i.slice(0,a).concat(i.slice(a+1));else{t=!1;break}}t&&!i.length&&(e.attrs["has-publisher-and-publisher-place"]=!0)}for(var n=0,r=e.children.length;n<r;n+=1)typeof e.children[n]=="object"&&this.insertPublisherAndPlace(e.children[n])};u.XmlJSON.prototype.isChildOfSubstitute=function(e){if(e.length>0){var t=e.slice(),i=t.pop();return i==="substitute"?!0:this.isChildOfSubstitute(t)}return!1};u.XmlJSON.prototype.addMissingNameNodes=function(e,t){if(t||(t=[]),e.name==="names"&&!this.isChildOfSubstitute(t)){for(var i=!0,n=0,r=e.children.length;n<r;n++)if(e.children[n].name==="name"){i=!1;break}i&&(e.children=[{name:"name",attrs:{},children:[]}].concat(e.children))}t.push(e.name);for(var n=0,r=e.children.length;n<r;n+=1)typeof e.children[n]=="object"&&this.addMissingNameNodes(e.children[n],t);t.pop()};u.XmlJSON.prototype.addInstitutionNodes=function(e){var t;if(e.name==="names"){for(var i={},n=-1,r=0,a=e.children.length;r<a;r+=1){if(e.children[r].name=="name"){for(var o in e.children[r].attrs)i[o]=e.children[r].attrs[o];i.delimiter=e.children[r].attrs.delimiter,i.and=e.children[r].attrs.and,n=r;for(var l=0,c=e.children[r].children.length;l<c;l+=1)if(e.children[r].children[l].attrs.name==="family")for(var o in e.children[r].children[l].attrs)i[o]=e.children[r].children[l].attrs[o]}if(e.children[r].name=="institution"){n=-1;break}}if(n>-1){for(var t=this.nodeCopy(this.institution),r=0,a=u.INSTITUTION_KEYS.length;r<a;r+=1){var f=u.INSTITUTION_KEYS[r];typeof i[f]<"u"&&(t.children[0].attrs[f]=i[f]),i.delimiter&&(t.attrs.delimiter=i.delimiter),i.and&&(t.attrs.and=i.and)}e.children=e.children.slice(0,n+1).concat([t]).concat(e.children.slice(n+1))}}for(var r=0,a=e.children.length;r<a;r+=1)typeof e.children[r]!="string"&&this.addInstitutionNodes(e.children[r])};u.XmlJSON.prototype.flagDateMacros=function(e){for(var t=0,i=e.children.length;t<i;t+=1)e.children[t].name==="macro"&&this.inspectDateMacros(e.children[t])&&(e.children[t].attrs["macro-has-date"]="true")};u.XmlJSON.prototype.inspectDateMacros=function(e){if(!e||!e.children)return!1;if(e.name==="date")return!0;for(var t=0,i=e.children.length;t<i;t+=1)if(this.inspectDateMacros(e.children[t]))return!0;return!1};u.stripXmlProcessingInstruction=function(e){return e&&(e=e.replace(/^<\?[^?]+\?>/,""),e=e.replace(/<!--[^>]+-->/g,""),e=e.replace(/^\s+/g,""),e=e.replace(/\s+$/g,""),e)};u.parseXml=function(e){var t={children:[]},i=[t.children];function n(g){g=g.split(/(?:\r\n|\n|\r)/).join(" ").replace(/>[ ]+</g,"><").replace(/<\!--.*?-->/g,"");for(var x=g.split("><"),k=null,w=0,C=x.length;w<C;w++)w>0&&(x[w]="<"+x[w]),w<x.length-1&&(x[w]=x[w]+">"),typeof k!="number"&&(x[w].slice(0,7)==="<style "||x[w].slice(0,8)=="<locale ")&&(k=w);x=x.slice(k);for(var w=x.length-2;w>-1;w--)if(x[w].slice(1).indexOf("<")===-1){var E=x[w].slice(0,5);x[w].slice(-2)!=="/>"&&(E==="<term"?x[w+1].slice(0,6)==="</term"&&(x[w]=x[w]+x[w+1],x=x.slice(0,w+1).concat(x.slice(w+2))):["<sing","<mult"].indexOf(E)>-1&&x[w].slice(-2)!=="/>"&&x[w+1].slice(0,1)==="<"&&(x[w]=x[w]+x[w+1],x=x.slice(0,w+1).concat(x.slice(w+2))))}return x}function r(g){return g.split("&amp;").join("&").split("&quot;").join('"').split("&gt;").join(">").split("&lt;").join("<").replace(/&#([0-9]{1,6});/gi,function(x,k){var w=parseInt(k,10);return String.fromCharCode(w)}).replace(/&#x([a-f0-9]{1,6});/gi,function(x,k){var w=parseInt(k,16);return String.fromCharCode(w)})}function a(g){var x=g.match(/([^\'\"= ]+)=(?:\"[^\"]*\"|\'[^\']*\')/g);if(x)for(var k=0,w=x.length;k<w;k++)x[k]=x[k].replace(/=.*/,"");return x}function o(g,x){var k=RegExp("^.*[ ]+"+x+`=("(?:[^"]*)"|'(?:[^']*)').*$`),w=g.match(k);return w?w[1].slice(1,-1):null}function l(g){var x=RegExp("^<([^ />]+)"),k=g.match(x);return k?k[1]:null}function c(g){var x={};x.name=l(g),x.attrs={};var k=a(g);if(k)for(var w=0,C=k.length;w<C;w++){var E={name:k[w],value:o(g,k[w])};x.attrs[E.name]=r(E.value)}return x.children=[],x}function f(g){var x=g.match(/^.*>([^<]*)<.*$/);return r(x[1])}function p(g){i.slice(-1)[0].push(g)}function m(g){i.push(g.children)}function d(g){var x;if(g.slice(1).indexOf("<")>-1){var k=g.slice(0,g.indexOf(">")+1);x=c(k),x.children=[f(g)],p(x)}else g.slice(-2)==="/>"?(x=c(g),l(g)==="term"&&x.children.push(""),p(x)):g.slice(0,2)==="</"?i.pop():(x=c(g),p(x),m(x))}for(var h=n(e),v=0,b=h.length;v<b;v++){var y=h[v];d(y)}return t.children[0]};u.XmlDOM=function(e){this.dataObj=e,typeof DOMParser>"u"?(DOMParser=function(){},DOMParser.prototype.parseFromString=function(a,o){if(typeof ActiveXObject<"u"){var l=new ActiveXObject("MSXML.DomDocument");return l.async=!1,l.loadXML(a),l}else if(typeof XMLHttpRequest<"u"){var l=new XMLHttpRequest;return o||(o="text/xml"),l.open("GET","data:"+o+";charset=utf-8,"+encodeURIComponent(a),!1),l.overrideMimeType&&l.overrideMimeType(o),l.send(null),l.responseXML}else if(typeof marknote<"u"){var c=new marknote.Parser;return c.parse(a)}},this.hasAttributes=function(a){var o;return a.attributes&&a.attributes.length?o=!0:o=!1,o}):this.hasAttributes=function(a){var o;return a.attributes&&a.attributes.length?o=!0:o=!1,o},this.importNode=function(a,o){var l;return typeof a.importNode>"u"?l=this._importNode(a,o,!0):l=a.importNode(o,!0),l},this._importNode=function(a,o,l){switch(o.nodeType){case 1:var c=a.createElement(o.nodeName);if(o.attributes&&o.attributes.length>0)for(var f=0,p=o.attributes.length;f<p;)c.setAttribute(o.attributes[f].nodeName,o.getAttribute(o.attributes[f++].nodeName));if(l&&o.childNodes&&o.childNodes.length>0)for(var f=0,p=o.childNodes.length;f<p;)c.appendChild(this._importNode(a,o.childNodes[f++],l));return c}},this.parser=new DOMParser;var t='<docco><institution institution-parts="long" delimiter=", " substitute-use-first="1" use-last="1"><institution-part name="long"/></institution></docco>',i=this.parser.parseFromString(t,"text/xml"),n=i.getElementsByTagName("institution");this.institution=n.item(0);var r=i.getElementsByTagName("institution-part");this.institutionpart=r.item(0),this.ns="http://purl.org/net/xbiblio/csl"};u.XmlDOM.prototype.clean=function(e){return e=e.replace(/<\?[^?]+\?>/g,""),e=e.replace(/<![^>]+>/g,""),e=e.replace(/^\s+/,""),e=e.replace(/\s+$/,""),e=e.replace(/^\n*/,""),e};u.XmlDOM.prototype.getStyleId=function(e,t){var i="",n="id";t&&(n="title");var r=e.getElementsByTagName(n);return r&&r.length&&(r=r.item(0)),r&&(i=r.textContent),i||(i=r.innerText),i||(i=r.innerHTML),i};u.XmlDOM.prototype.children=function(e){var t,i,n,r;if(e){for(r=[],t=e.childNodes,i=0,n=t.length;i<n;i+=1)t[i].nodeName!="#text"&&r.push(t[i]);return r}else return[]};u.XmlDOM.prototype.nodename=function(e){var t=e.nodeName;return t};u.XmlDOM.prototype.attributes=function(e){var t,i,n,r,a;if(t=new Object,e&&this.hasAttributes(e))for(i=e.attributes,r=0,a=i.length;r<a;r+=1)n=i[r],t["@"+n.name]=n.value;return t};u.XmlDOM.prototype.content=function(e){var t;return typeof e.textContent<"u"?t=e.textContent:typeof e.innerText<"u"?t=e.innerText:t=e.txt,t};u.XmlDOM.prototype.namespace={xml:"http://www.w3.org/XML/1998/namespace"};u.XmlDOM.prototype.numberofnodes=function(e){return e?e.length:0};u.XmlDOM.prototype.getAttributeName=function(e){var t=e.name;return t};u.XmlDOM.prototype.getAttributeValue=function(e,t,i){var n="";return i&&(t=i+":"+t),e&&this.hasAttributes(e)&&e.getAttribute(t)&&(n=e.getAttribute(t)),n};u.XmlDOM.prototype.getNodeValue=function(e,t){var i=null;if(t){var n=e.getElementsByTagName(t);n.length>0&&(typeof n[0].textContent<"u"?i=n[0].textContent:typeof n[0].innerText<"u"?i=n[0].innerText:i=n[0].text)}return i===null&&e&&e.childNodes&&(e.childNodes.length==0||e.childNodes.length==1&&e.firstChild.nodeName=="#text")&&(typeof e.textContent<"u"?i=e.textContent:typeof e.innerText<"u"?i=e.innerText:i=e.text),i===null&&(i=e),i};u.XmlDOM.prototype.setAttributeOnNodeIdentifiedByNameAttribute=function(e,t,i,n,r){var a,o,l,c;for(n.slice(0,1)==="@"&&(n=n.slice(1)),l=e.getElementsByTagName(t),a=0,o=l.length;a<o;a+=1)c=l[a],c.getAttribute("name")==i&&c.setAttribute(n,r)};u.XmlDOM.prototype.deleteNodeByNameAttribute=function(e,t){var i,n,r,a;for(a=e.childNodes,i=0,n=a.length;i<n;i+=1)r=a[i],!(!r||r.nodeType==r.TEXT_NODE)&&this.hasAttributes(r)&&r.getAttribute("name")==t&&e.removeChild(a[i])};u.XmlDOM.prototype.deleteAttribute=function(e,t){e.removeAttribute(t)};u.XmlDOM.prototype.setAttribute=function(e,t,i){return e.ownerDocument||(e=e.firstChild),["function","unknown"].indexOf(typeof e.setAttribute)>-1&&e.setAttribute(t,i),!1};u.XmlDOM.prototype.nodeCopy=function(e){var t=e.cloneNode(!0);return t};u.XmlDOM.prototype.getNodesByName=function(e,t,i){var n,r,a,o,l;for(n=[],r=e.getElementsByTagName(t),o=0,l=r.length;o<l;o+=1)a=r.item(o),!(i&&!(this.hasAttributes(a)&&a.getAttribute("name")==i))&&n.push(a);return n};u.XmlDOM.prototype.nodeNameIs=function(e,t){return t==e.nodeName};u.XmlDOM.prototype.makeXml=function(e){e||(e="<docco><bogus/></docco>"),e=e.replace(/\s*<\?[^>]*\?>\s*\n*/g,"");var t=this.parser.parseFromString(e,"application/xml");return t.firstChild};u.XmlDOM.prototype.insertChildNodeAfter=function(e,t,i,n){var r;return r=this.importNode(t.ownerDocument,n),e.replaceChild(r,t),e};u.XmlDOM.prototype.insertPublisherAndPlace=function(e){for(var t=e.getElementsByTagName("group"),i=0,n=t.length;i<n;i+=1){for(var r=t.item(i),a=[],o=0,l=r.childNodes.length;o<l;o+=1)r.childNodes.item(o).nodeType!==1&&a.push(o);if(r.childNodes.length-a.length===2){for(var c=[],o=0,l=2;o<l;o+=1)if(!(a.indexOf(o)>-1)){for(var f=r.childNodes.item(o),p=[],m=0,d=f.childNodes.length;m<d;m+=1)f.childNodes.item(m).nodeType!==1&&p.push(m);if(f.childNodes.length-p.length===0&&(c.push(f.getAttribute("variable")),f.getAttribute("suffix")||f.getAttribute("prefix"))){c=[];break}}c.indexOf("publisher")>-1&&c.indexOf("publisher-place")>-1&&r.setAttribute("has-publisher-and-publisher-place",!0)}}};u.XmlDOM.prototype.isChildOfSubstitute=function(e){return e.parentNode?e.parentNode.tagName.toLowerCase()==="substitute"?!0:this.isChildOfSubstitute(e.parentNode):!1};u.XmlDOM.prototype.addMissingNameNodes=function(e){for(var t=e.getElementsByTagName("names"),i=0,n=t.length;i<n;i+=1){var r=t.item(i),a=r.getElementsByTagName("name");if((!a||a.length===0)&&!this.isChildOfSubstitute(r)){var o=r.ownerDocument,l=o.createElement("name");r.appendChild(l)}}};u.XmlDOM.prototype.addInstitutionNodes=function(e){var t,i,n,r,a,o,l,c,f;for(t=e.getElementsByTagName("names"),c=0,f=t.length;c<f;c+=1)if(i=t.item(c),o=i.getElementsByTagName("name"),o.length!=0&&(n=i.getElementsByTagName("institution"),n.length==0)){r=this.importNode(e.ownerDocument,this.institution),a=r.getElementsByTagName("institution-part").item(0),l=o.item(0),i.insertBefore(r,l.nextSibling);for(var p=0,m=u.INSTITUTION_KEYS.length;p<m;p+=1){var d=u.INSTITUTION_KEYS[p],h=l.getAttribute(d);h&&a.setAttribute(d,h)}for(var v=l.getElementsByTagName("name-part"),p=0,m=v.length;p<m;p+=1)if(v[p].getAttribute("name")==="family")for(var b=0,y=u.INSTITUTION_KEYS.length;b<y;b+=1){var d=u.INSTITUTION_KEYS[b],h=v[p].getAttribute(d);h&&a.setAttribute(d,h)}}};u.XmlDOM.prototype.flagDateMacros=function(e){var t,i,n,r,a=e.getElementsByTagName("macro");for(t=0,i=a.length;t<i;t+=1)n=a.item(t),r=n.getElementsByTagName("date"),r.length&&n.setAttribute("macro-has-date","true")};u.setupXml=function(e){var t={},i=null;return typeof e<"u"?typeof e=="string"?(e=e.replace("^\uFEFF","").replace(/^\s+/,""),e.slice(0,1)==="<"?t=u.parseXml(e):t=JSON.parse(e),i=new u.XmlJSON(t)):typeof e.getAttribute<"u"?i=new u.XmlDOM(e):typeof e.toXMLString<"u"?i=new u.XmlE4X(e):i=new u.XmlJSON(e):u.error("unable to parse XML input"),i||u.error("citeproc-js error: unable to parse CSL style or locale object"),i};u.getSortCompare=function(e){if(u.stringCompare)return u.stringCompare;var t=this,i,n={sensitivity:"base",ignorePunctuation:!0,numeric:!0};e||(e="en-US"),i=function(c,f){return u.toLocaleLowerCase.call(t,c).localeCompare(u.toLocaleLowerCase.call(t,f),e,n)};var r=function(c){return c.replace(/^[\[\]\'\"]*/g,"")},a=function(){return i("[x","x")?function(c,f){return i(r(c),r(f))}:!1},o=a(),l=function(c,f){return o?o(c,f):i(c,f)};return l};u.ambigConfigDiff=function(e,t){var i,n,r,a;if(e.names.length!==t.names.length)return 1;for(i=0,n=e.names.length;i<n;i+=1){if(e.names[i]!==t.names[i])return 1;for(r=0,a=e.givens[i];r<a;r+=1)if(e.givens[i][r]!==t.givens[i][r])return 1}return e.disambiguate!=t.disambiguate||e.year_suffix!==t.year_suffix?1:0};u.cloneAmbigConfig=function(e,t){var i,n,r,a,o,l={};for(l.names=[],l.givens=[],l.year_suffix=!1,l.disambiguate=!1,i=0,n=e.names.length;i<n;i+=1)o=e.names[i],l.names[i]=o;for(i=0,n=e.givens.length;i<n;i+=1){for(o=[],r=0,a=e.givens[i].length;r<a;r+=1)o.push(e.givens[i][r]);l.givens.push(o)}return t?(l.year_suffix=t.year_suffix,l.disambiguate=t.disambiguate):(l.year_suffix=e.year_suffix,l.disambiguate=e.disambiguate),l};u.getAmbigConfig=function(){var e,t;e=this.tmp.disambig_request,e||(e=this.tmp.disambig_settings);var t=u.cloneAmbigConfig(e);return t};u.getMaxVals=function(){return this.tmp.names_max.mystack.slice()};u.getMinVal=function(){return this.tmp["et-al-min"]};u.tokenExec=function(e,t,i){var n,r,a,o;o=!1,n=e.next,r=!1;var l=function(p){return p?(this.tmp.jump.replace("succeed"),e.succeed):(this.tmp.jump.replace("fail"),e.fail)};e.test&&(n=l.call(this,e.test(t,i)));for(var c=0,f=e.execs.length;c<f;c++)a=e.execs[c],r=a.call(e,this,t,i),r&&(n=r);return o&&u.debug(e.name+" ("+e.tokentype+") ---> done"),n};u.expandMacro=function(e,t){var i,n,r,a;i=e.postponed_macro;var o=e.strings.sort_direction;e=new u.Token("group",u.START);var l=!1,c=!1;n=this.cslXml.getNodesByName(this.cslXml.dataObj,"macro",i),n.length&&(c=this.cslXml.getAttributeValue(n[0],"cslid"),l=this.cslXml.getAttributeValue(n[0],"macro-has-date")),l&&(i=i+"@"+this.build.current_default_locale,a=function(m){m.tmp.extension&&(m.tmp["doing-macro-with-date"]=!0)},e.execs.push(a)),this.build.macro_stack.indexOf(i)>-1?u.error('CSL processor error: call to macro "'+i+'" would cause an infinite loop'):this.build.macro_stack.push(i),e.cslid=c,u.MODULE_MACROS[i]&&(e.juris=i,this.opt.update_mode=u.POSITION),u.Node.group.build.call(e,this,t,!0),this.cslXml.getNodeValue(n)||u.error('CSL style error: undefined macro "'+i+'"');var f=u.getMacroTarget.call(this,i);if(f&&(u.buildMacro.call(this,f,n),u.configureMacro.call(this,f)),!this.build.extension){var a=function(d){return function(h,v,b){for(var y=0;y<h.macros[d].length;)y=u.tokenExec.call(h,h.macros[d][y],v,b)}}(i),p=new u.Token("text",u.SINGLETON);p.execs.push(a),t.push(p)}r=new u.Token("group",u.END),r.strings.sort_direction=o,l&&(a=function(m){m.tmp.extension&&(m.tmp["doing-macro-with-date"]=!1)},r.execs.push(a)),e.juris&&(r.juris=i),u.Node.group.build.call(r,this,t,!0),this.build.macro_stack.pop()};u.getMacroTarget=function(e){var t=!1;return this.build.extension?t=this[this.build.root+this.build.extension].tokens:this.macros[e]||(t=[],this.macros[e]=t),t};u.buildMacro=function(e,t){var i=u.makeBuilder(this,e),n;typeof t.length>"u"?n=t:n=t[0],i(n)};u.configureMacro=function(e){this.build.extension||this.configureTokenList(e)};u.XmlToToken=function(e,t,i,n){var r,a,o,l,c,f,p;if(r=e.cslXml.nodename(this),!(e.build.skip&&e.build.skip!==r)){if(!r){a=e.cslXml.content(this),a&&(e.build.text=a);return}if(u.Node[e.cslXml.nodename(this)]||u.error('Undefined node name "'+r+'".'),o=e.cslXml.attributes(this),l=u.setDecorations.call(this,e,o),c=new u.Token(r,t),t!==u.END||r==="if"||r==="else-if"||r==="layout"){for(var f in o)if(o.hasOwnProperty(f)){if(t===u.END&&f!=="@language"&&f!=="@locale")continue;if(o.hasOwnProperty(f))if(u.Attributes[f])try{u.Attributes[f].call(c,e,""+o[f])}catch(d){u.error(f+" attribute: "+d)}else u.debug('warning: undefined attribute "'+f+'" in style')}c.decorations=l,u.DATE_VARIABLES.indexOf(o["@variable"])>-1&&n.push(c.variables)}else t===u.END&&o["@variable"]&&(c.hasVariable=!0,u.DATE_VARIABLES.indexOf(o["@variable"])>-1&&(c.variables=n.pop()));i?p=i:p=e[e.build.area].tokens,u.Node[r].build.call(c,e,p,!0)}};u.DateParser=function(){for(var e=[["明治",1867],["大正",1911],["昭和",1925],["平成",1988]],t=0,i=e.length;t<i;t++){e[t][0];var n=e[t][1]}for(var r=[],a={},t=0,i=e.length;t<i;t++){var o=e[t],n=o[0];r.push(n),a[o[0]]=o[1]}var l=r.join("|"),c=new RegExp("(?:"+l+")(?:[0-9]+)"),f=new RegExp("(?:"+l+")(?:[0-9]+)","g"),p=/(\u6708|\u5E74)/g,m=/\u65E5/g,d=/\u301c/g,h="(?:[?0-9]{1,2}%%NUMD%%){0,2}[?0-9]{4}(?![0-9])",v="[?0-9]{4}(?:%%NUMD%%[?0-9]{1,2}){0,2}(?![0-9])",b="[?0-9]{1,3}",y="[%%DATED%%]",g="[?~]",x="[^-/~?0-9]+",k="("+v+"|"+h+"|"+b+"|"+y+"|"+g+"|"+x+")",w=new RegExp(k.replace(/%%NUMD%%/g,"-").replace(/%%DATED%%/g,"-")),C=new RegExp(k.replace(/%%NUMD%%/g,"-").replace(/%%DATED%%/g,"/")),E=new RegExp(k.replace(/%%NUMD%%/g,"/").replace(/%%DATED%%/g,"-")),B="january february march april may june july august september october november december spring summer fall winter spring summer";this.monthStrings=B.split(" "),this.setOrderDayMonth=function(){this.monthGuess=1,this.dayGuess=0},this.setOrderMonthDay=function(){this.monthGuess=0,this.dayGuess=1},this.resetDateParserMonths=function(){this.monthSets=[];for(var _=0,S=this.monthStrings.length;_<S;_++)this.monthSets.push([this.monthStrings[_]]);this.monthAbbrevs=[];for(var _=0,S=this.monthSets.length;_<S;_++){this.monthAbbrevs.push([]);for(var T=0,D=this.monthSets[_].length;T<D;T++)this.monthAbbrevs[_].push(this.monthSets[_][0].slice(0,3))}this.monthRexes=[];for(var _=0,S=this.monthAbbrevs.length;_<S;_++)this.monthRexes.push(new RegExp("(?:"+this.monthAbbrevs[_].join("|")+")"))},this.addDateParserMonths=function(_){if(typeof _=="string"&&(_=_.split(/\s+/)),_.length!==12&&_.length!==16){u.debug("month [+season] list of "+_.length+", expected 12 or 16. Ignoring.");return}for(var S=0,T=_.length;S<T;S++){for(var D=null,H=!1,V=3,M={},$=0,P=this.monthAbbrevs.length;$<P;$++){if(M[$]={},$===S){for(var W=0,L=this.monthAbbrevs[S].length;W<L;W++)if(this.monthAbbrevs[S][W]===_[S].slice(0,this.monthAbbrevs[S][W].length)){H=!0;break}}else for(var W=0,L=this.monthAbbrevs[$].length;W<L;W++)if(D=this.monthAbbrevs[$][W].length,this.monthAbbrevs[$][W]===_[S].slice(0,D)){for(;this.monthSets[$][W].slice(0,D)===_[S].slice(0,D);)if(D>_[S].length||D>this.monthSets[$][W].length){u.debug("unable to disambiguate month string in date parser: "+_[S]);break}else D+=1;V=D,M[$][W]=D}for(var Q in M)for(var j in M[Q])D=M[Q][j],Q=parseInt(Q,10),j=parseInt(j,10),this.monthAbbrevs[Q][j]=this.monthSets[Q][j].slice(0,D)}H||(this.monthSets[S].push(_[S]),this.monthAbbrevs[S].push(_[S].slice(0,V)))}this.monthRexes=[],this.monthRexStrs=[];for(var S=0,T=this.monthAbbrevs.length;S<T;S++)this.monthRexes.push(new RegExp("^(?:"+this.monthAbbrevs[S].join("|")+")")),this.monthRexStrs.push("^(?:"+this.monthAbbrevs[S].join("|")+")");if(this.monthAbbrevs.length===18)for(var S=12,T=14;S<T;S++)this.monthRexes[S+4]=new RegExp("^(?:"+this.monthAbbrevs[S].join("|")+")"),this.monthRexStrs[S+4]="^(?:"+this.monthAbbrevs[S].join("|")+")"},this.convertDateObjectToArray=function(_){_["date-parts"]=[],_["date-parts"].push([]);for(var S=0,T,D=0,H=3;D<H&&(T=["year","month","day"][D],!!_[T]);D++)S+=1,_["date-parts"][0].push(_[T]),delete _[T];_["date-parts"].push([]);for(var D=0,H=S;D<H&&(T=["year_end","month_end","day_end"][D],!!_[T]);D++)_["date-parts"][1].push(_[T]),delete _[T];return _["date-parts"][0].length!==_["date-parts"][1].length&&_["date-parts"].pop(),_},this.convertDateObjectToString=function(_){for(var S=[],T=0,D=3;T<D&&_[u.DATE_PARTS_ALL[T]];T+=1)S.push(_[u.DATE_PARTS_ALL[T]]);return S.join("-")},this._parseNumericDate=function(_,S,T,D){T||(T="");for(var H=D.split(S),V=0,M=H.length;V<M;V++)if(H[V].length===4){_["year"+T]=H[V].replace(/^0*/,""),V?H=H.slice(0,V):H=H.slice(1);break}for(var V=0,M=H.length;V<M;V++)H[V]=parseInt(H[V],10);if(H.length===1||H.length===2&&!H[1]){var $=H[0];$&&(_["month"+T]=""+H[0])}else if(H.length===2)if(H[this.monthGuess]>12){var $=H[this.dayGuess],P=H[this.monthGuess];$&&(_["month"+T]=""+$,P&&(_["day"+T]=""+P))}else{var $=H[this.monthGuess],P=H[this.dayGuess];$&&(_["month"+T]=""+$,P&&(_["day"+T]=""+P))}},this.parseDateToObject=function(_){var S=_,T=-1,D=-1,H=!1,V;if(_){if(_=_.replace(/^(.*[0-9])T[0-9].*/,"$1"),_.slice(0,1)==="-"&&(H=!0,_=_.slice(1)),_.match(/^[0-9]{1,3}$/))for(;_.length<4;)_="0"+_;_=""+_,_=_.replace(/\s*[0-9]{2}:[0-9]{2}(?::[0-9]+)/,"");var M=_.match(p);if(M){_=_.replace(/\s+/g,""),_=_.replace(m,""),_=_.replace(p,"-"),_=_.replace(d,"/"),_=_.replace(/\-\//g,"/"),_=_.replace(/-$/g,"");var $=_.split(c);V=[];var P=_.match(f);if(P){for(var W=[],L=0,Q=P.length;L<Q;L++)W=W.concat(P[L].match(/([^0-9]+)([0-9]+)/).slice(1));for(var L=0,Q=$.length;L<Q;L++)if(V.push($[L]),L!==Q-1){var j=L*2;V.push(W[j]),V.push(W[j+1])}}else V=$;for(var L=1,Q=V.length;L<Q;L+=3)V[L+1]=a[V[L]]+parseInt(V[L+1],10),V[L]="";_=V.join(""),_=_.replace(/\s*-\s*$/,"").replace(/\s*-\s*\//,"/"),_=_.replace(/\.\s*$/,""),_=_.replace(/\.(?! )/,""),T=_.indexOf("/"),D=_.indexOf("-")}}_=_.replace(/([A-Za-z])\./g,"$1");var O="",R="",U={},oe,ie;if(_.slice(0,1)==='"'&&_.slice(-1)==='"')return U.literal=_.slice(1,-1),U;if(T>-1&&D>-1){var ee=_.split("/");ee.length>3?(oe="-",_=_.replace(/\_/g,"-"),ie="/",V=_.split(E)):(oe="/",_=_.replace(/\_/g,"/"),ie="-",V=_.split(C))}else _=_.replace(/\//g,"-"),_=_.replace(/\_/g,"-"),oe="-",ie="-",V=_.split(w);for(var te=[],L=0,Q=V.length;L<Q;L++){var M=V[L].match(/^\s*([\-\/]|[^\-\/\~\?0-9]+|[\-~?0-9]+)\s*$/);M&&te.push(M[1])}var X=te.indexOf(oe),F=[],q=!1;X>-1?(F.push([0,X]),F.push([X+1,te.length]),q=!0):F.push([0,te.length]);for(var ne="",L=0,Q=F.length;L<Q;L++){var se=F[L],Se=te.slice(se[0],se[1]);e:for(var Ae=0,fe=Se.length;Ae<fe;Ae++){var ke=Se[Ae];if(ke.indexOf(ie)>-1){this._parseNumericDate(U,ie,ne,ke);continue}if(ke.match(/[0-9]{4}/)){U["year"+ne]=ke.replace(/^0*/,"");continue}(ke==="~"||ke==="?"||ke==="c"||ke.match(/^cir/))&&(U.circa=!0);for(var G=0,yt=this.monthRexes.length;G<yt;G++)if(ke.toLocaleLowerCase().match(this.monthRexes[G])){U["month"+ne]=""+(parseInt(G,10)+1);continue e}if(ke.match(/^[0-9]+$/)&&(O=ke),ke.toLocaleLowerCase().match(/^bc/)&&O){U["year"+ne]=""+O*-1,O="";continue}if(ke.toLocaleLowerCase().match(/^ad/)&&O){U["year"+ne]=""+O,O="";continue}if(ke.toLocaleLowerCase().match(/(?:mic|tri|hil|eas)/)&&!U["season"+ne]){R=ke;continue}}O&&(U["day"+ne]=O,O=""),R&&!U["season"+ne]&&(U["season"+ne]=R.trim(),R=""),ne="_end"}if(q)for(var Ae=0,fe=u.DATE_PARTS_ALL.length;Ae<fe;Ae++){var we=u.DATE_PARTS_ALL[Ae];U[we]&&!U[we+"_end"]?U[we+"_end"]=U[we]:!U[we]&&U[we+"_end"]&&(U[we]=U[we+"_end"])}(!U.year||U.year&&U.day&&!U.month)&&(U={literal:S});for(var At=["year","month","day","year_end","month_end","day_end"],L=0,Q=At.length;L<Q;L++){var K=At[L];typeof U[K]=="string"&&U[K].match(/^[0-9]+$/)&&(U[K]=parseInt(U[K],10))}return H&&Object.keys(U).indexOf("year")>-1&&(U.year=U.year*-1),U},this.parseDateToArray=function(_){return this.convertDateObjectToArray(this.parseDateToObject(_))},this.parseDateToString=function(_){return this.convertDateObjectToString(this.parseDateToObject(_))},this.parse=function(_){return this.parseDateToObject(_)},this.setOrderMonthDay(),this.resetDateParserMonths()};u.DateParser=new u.DateParser;u.Engine=function(e,t,i,n){var r,a;this.processor_version=u.PROCESSOR_VERSION,this.csl_version="1.0",this.sys=e,typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value:function(m){if(m==null)throw new TypeError("Cannot convert undefined or null to object");for(var d=Object(m),h=1;h<arguments.length;h++){var v=arguments[h];if(v!=null)for(var b in v)Object.prototype.hasOwnProperty.call(v,b)&&(d[b]=v[b])}return d},writable:!0,configurable:!0}),e.variableWrapper&&(u.VARIABLE_WRAPPER_PREPUNCT_REX=new RegExp("^(["+[" "].concat(u.SWAPPING_PUNCTUATION).join("")+"]*)(.*)")),u.retrieveStyleModule&&(this.sys.retrieveStyleModule=u.retrieveStyleModule),u.getAbbreviation&&(this.sys.getAbbreviation=u.getAbbreviation),this.sys.stringCompare&&(u.stringCompare=this.sys.stringCompare),this.sys.AbbreviationSegments=u.AbbreviationSegments,this.transform=new u.Transform(this),this.setParseNames=function(p){this.opt["parse-names"]=p},this.opt=new u.Engine.Opt,this.tmp=new u.Engine.Tmp,this.build=new u.Engine.Build,this.fun=new u.Engine.Fun(this),this.configure=new u.Engine.Configure,this.citation_sort=new u.Engine.CitationSort,this.bibliography_sort=new u.Engine.BibliographySort,this.citation=new u.Engine.Citation(this),this.bibliography=new u.Engine.Bibliography,this.intext=new u.Engine.InText,this.output=new u.Output.Queue(this),this.dateput=new u.Output.Queue(this),this.cslXml=u.setupXml(t);for(var o in u.SYS_OPTIONS){var l=u.SYS_OPTIONS[o];typeof this.sys[l]=="boolean"&&(this.opt.development_extensions[l]=this.sys[l])}(this.opt.development_extensions.uppercase_subtitles||this.opt.development_extensions.implicit_short_title)&&(this.opt.development_extensions.main_title_from_short_title=!0),this.opt.development_extensions.csl_reverse_lookup_support&&(this.build.cslNodeId=0,this.setCslNodeIds=function(p,m){var d=this.cslXml.children(p);this.cslXml.setAttribute(p,"cslid",this.build.cslNodeId),this.opt.nodenames.push(m),this.build.cslNodeId+=1;for(var h=0,v=this.cslXml.numberofnodes(d);h<v;h+=1)m=this.cslXml.nodename(d[h]),m&&this.setCslNodeIds(d[h],m)},this.setCslNodeIds(this.cslXml.dataObj,"style")),this.cslXml.addMissingNameNodes(this.cslXml.dataObj),this.cslXml.addInstitutionNodes(this.cslXml.dataObj),this.cslXml.insertPublisherAndPlace(this.cslXml.dataObj),this.cslXml.flagDateMacros(this.cslXml.dataObj),r=this.cslXml.attributes(this.cslXml.dataObj),typeof r["@sort-separator"]>"u"&&this.cslXml.setAttribute(this.cslXml.dataObj,"sort-separator",", "),this.opt["initialize-with-hyphen"]=!0,this.setStyleAttributes(),this.opt.xclass=this.cslXml.getAttributeValue(this.cslXml.dataObj,"class"),this.opt.class=this.opt.xclass,this.opt.styleID=this.cslXml.getStyleId(this.cslXml.dataObj),this.opt.styleName=this.cslXml.getStyleId(this.cslXml.dataObj,!0),this.opt.version.slice(0,4)==="1.1m"&&(this.opt.development_extensions.consolidate_legal_items=!0,this.opt.development_extensions.consolidate_container_items=!0,this.opt.development_extensions.main_title_from_short_title=!0,this.opt.development_extensions.expect_and_symbol_form=!0,this.opt.development_extensions.require_explicit_legal_case_title_short=!0,this.opt.development_extensions.force_jurisdiction=!0,this.opt.development_extensions.force_title_abbrev_fallback=!0),i&&(i=i.replace("_","-"),i=u.normalizeLocaleStr(i)),this.opt["default-locale"][0]&&(this.opt["default-locale"][0]=this.opt["default-locale"][0].replace("_","-"),this.opt["default-locale"][0]=u.normalizeLocaleStr(this.opt["default-locale"][0])),i&&n&&(this.opt["default-locale"]=[i]),i&&!n&&this.opt["default-locale"][0]&&(i=this.opt["default-locale"][0]),this.opt["default-locale"].length===0&&(i||(i="en-US"),this.opt["default-locale"].push("en-US")),i||(i=this.opt["default-locale"][0]),a=u.localeResolve(i),this.opt.lang=a.best,this.opt["default-locale"][0]=a.best,this.locale={},this.opt["default-locale-sort"]||(this.opt["default-locale-sort"]=this.opt["default-locale"][0]),"dale|".localeCompare("daleb",this.opt["default-locale-sort"])>-1?this.opt.sort_sep="@":this.opt.sort_sep="|",this.localeConfigure(a);function c(m){var m=m.slice(),d=new RegExp("(?:(?:[?!:]*\\s+|-|^)(?:"+m.join("|")+")(?=[!?:]*\\s+|-|$))","g");return d}this.locale[this.opt.lang].opts["skip-words-regexp"]=c(this.locale[this.opt.lang].opts["skip-words"]),this.output.adjust=new u.Output.Queue.adjust(this.getOpt("punctuation-in-quote")),this.registry=new u.Registry(this),this.macros={},this.build.area="citation";var f=this.cslXml.getNodesByName(this.cslXml.dataObj,this.build.area);this.buildTokenLists(f,this[this.build.area].tokens),this.build.area="bibliography";var f=this.cslXml.getNodesByName(this.cslXml.dataObj,this.build.area);this.buildTokenLists(f,this[this.build.area].tokens),this.build.area="intext";var f=this.cslXml.getNodesByName(this.cslXml.dataObj,this.build.area);this.buildTokenLists(f,this[this.build.area].tokens),this.opt.parallel.enable&&(this.parallel=new u.Parallel(this)),this.juris={},this.configureTokenLists(),this.disambiguate=new u.Disambiguation(this),this.splice_delimiter=!1,this.fun.dateparser=u.DateParser,this.fun.flipflopper=new u.Util.FlipFlopper(this),this.setCloseQuotesArray(),this.fun.ordinalizer.init(this),this.fun.long_ordinalizer.init(this),this.fun.page_mangler=u.Util.PageRangeMangler.getFunction(this,"page"),this.fun.year_mangler=u.Util.PageRangeMangler.getFunction(this,"year"),this.setOutputFormat("html")};u.Engine.prototype.setCloseQuotesArray=function(){var e;e=[],e.push(this.getTerm("close-quote")),e.push(this.getTerm("close-inner-quote")),e.push('"'),e.push("'"),this.opt.close_quotes_array=e};u.makeBuilder=function(e,t){var i=[],n=[];function r(c){n.push(c),u.XmlToToken.call(c,e,u.START,t,i)}function a(){var c=n.pop();u.XmlToToken.call(c,e,u.END,t,i)}function o(c){u.XmlToToken.call(c,e,u.SINGLETON,t,i)}function l(c,f,p){c||(c=[]),typeof c.length>"u"&&(c=[c]);for(var m=0;m<c.length;m++){var d=c[m];e.cslXml.nodename(d)!==null&&(f&&e.cslXml.nodename(d)==="date"&&(u.Util.fixDateNode.call(e,f,m,d),d=e.cslXml.children(f)[m]),e.cslXml.numberofnodes(e.cslXml.children(d))?(r(d),l(e.cslXml.children(d),d),a()):o(d))}}return l};u.Engine.prototype.buildTokenLists=function(e,t){if(this.cslXml.getNodeValue(e)){var i=u.makeBuilder(this,t),n;typeof e.length>"u"?n=e:n=e[0],i(n)}};u.Engine.prototype.setStyleAttributes=function(){var i,e,t,i={};i.name=this.cslXml.nodename(this.cslXml.dataObj),e=this.cslXml.attributes(this.cslXml.dataObj);for(t in e)e.hasOwnProperty(t)&&u.Attributes[t].call(i,this,e[t])};u.Engine.prototype.getTerm=function(e,t,i,n,r,a){e&&e.match(/[A-Z]/)&&e===e.toUpperCase()&&(u.debug("Warning: term key is in uppercase form: "+e),e=e.toLowerCase());var o;a?o=this.opt["default-locale"][0]:o=this.opt.lang;var l=u.Engine.getField(u.LOOSE,this.locale[o].terms,e,t,i,n);return!l&&e==="range-delimiter"&&(l="–"),typeof l>"u"&&(r===u.STRICT?u.error('Error in getTerm: term "'+e+'" does not exist.'):r===u.TOLERANT&&(l="")),l&&(this.tmp.cite_renders_content=!0),l};u.Engine.prototype.getDate=function(e,t){var i;return t?i=this.opt["default-locale"]:i=this.opt.lang,this.locale[i].dates[e]?this.locale[i].dates[e]:!1};u.Engine.prototype.getOpt=function(e){return typeof this.locale[this.opt.lang].opts[e]<"u"?this.locale[this.opt.lang].opts[e]:!1};u.Engine.prototype.getVariable=function(e,t,i,n){return u.Engine.getField(u.LOOSE,e,t,i,n)};u.Engine.prototype.getDateNum=function(e,t){return typeof e>"u"?0:e[t]};u.Engine.getField=function(e,t,i,n,r,a){var o,l,c,f,p,m;if(o="",typeof t[i]>"u")if(e===u.STRICT)u.error('Error in getField: term "'+i+'" does not exist.');else return;for(a&&t[i][a]?m=t[i][a]:m=t[i],l=[],n==="symbol"?l=["symbol","short"]:n==="verb-short"?l=["verb-short","verb"]:n!=="long"&&(l=[n]),l=l.concat(["long"]),p=l.length,f=0;f<p;f+=1)if(c=l[f],typeof m=="string"||typeof m=="number")o=m;else if(typeof m[c]<"u"){typeof m[c]=="string"||typeof m[c]=="number"?o=m[c]:typeof r=="number"?o=m[c][r]:o=m[c][0];break}return o};u.Engine.prototype.configureTokenLists=function(){var e,t,i;for(i=u.AREAS.length,t=0;t<i;t+=1){e=u.AREAS[t];var n=this[e].tokens;this.configureTokenList(n)}return this.version=u.version,this.state};u.Engine.prototype.configureTokenList=function(e){var t,i,n,r,a,o,l,c;for(t=["year","month","day"],l=e.length-1,a=l;a>-1;a+=-1){if(i=e[a],i.name==="date"&&u.END===i.tokentype&&(n=[]),i.name==="date-part"&&i.strings.name)for(c=t.length,o=0;o<c;o+=1)r=t[o],r===i.strings.name&&n.push(i.strings.name);i.name==="date"&&u.START===i.tokentype&&(n.reverse(),i.dateparts=n),i.next=a+1,i.name&&u.Node[i.name].configure&&u.Node[i.name].configure.call(i,this,a)}};u.Engine.prototype.refetchItems=function(e){for(var t=[],i=0,n=e.length;i<n;i+=1)t.push(this.refetchItem(""+e[i]));return t};u.ITERATION=0;u.Engine.prototype.retrieveItem=function(e){var t,i,n;if(!this.tmp.loadedItemIDs[e])this.tmp.loadedItemIDs[e]=!0;else return this.registry.refhash[e];if(this.opt.development_extensions.normalize_lang_keys_to_lowercase&&typeof this.opt.development_extensions.normalize_lang_keys_to_lowercase=="boolean"){for(var n=0,r=this.opt["default-locale"].length;n<r;n+=1)this.opt["default-locale"][n]=this.opt["default-locale"][n].toLowerCase();for(var n=0,r=this.opt["locale-translit"].length;n<r;n+=1)this.opt["locale-translit"][n]=this.opt["locale-translit"][n].toLowerCase();for(var n=0,r=this.opt["locale-translat"].length;n<r;n+=1)this.opt["locale-translat"][n]=this.opt["locale-translat"][n].toLowerCase();this.opt.development_extensions.normalize_lang_keys_to_lowercase=100}if(u.ITERATION+=1,t=JSON.parse(JSON.stringify(this.sys.retrieveItem(""+e))),this.opt.development_extensions.normalize_lang_keys_to_lowercase){if(t.multi){if(t.multi._keys)for(var a in t.multi._keys)for(var o in t.multi._keys[a])o!==o.toLowerCase()&&(t.multi._keys[a][o.toLowerCase()]=t.multi._keys[a][o],delete t.multi._keys[a][o]);if(t.multi.main)for(var a in t.multi.main)t.multi.main[a]=t.multi.main[a].toLowerCase()}for(var n=0,r=u.NAME_VARIABLES.length;n>r;n+=1){var l=u.NAME_VARIABLES[n];if(t[l]&&t[l].multi)for(var c=0,f=t[l].length;c<f;c+=1){var p=t[l][c];if(p.multi){if(p.multi._key)for(var o in p.multi._key)o!==o.toLowerCase()&&(p.multi._key[o.toLowerCase()]=p.multi._key[o],delete p.multi._key[o]);p.multi.main&&(p.multi.main=p.multi.main.toLowerCase())}}}}if(t.language&&t.language.match(/[><]/)){var i=t.language.match(/(.*?)([<>])(.*)/);i[2]==="<"?(t["language-name"]=i[1],t["language-name-original"]=i[3]):(t["language-name"]=i[3],t["language-name-original"]=i[1]),this.opt.multi_layout?t["language-name-original"]&&(t.language=t["language-name-original"]):t["language-name"]&&(t.language=t["language-name"])}if(t.page){t["page-first"]=t.page;var m=""+t.page,i=m.split(/\s*(?:&|, |-|\u2013)\s*/);i[0].slice(-1)!=="\\"&&(t["page-first"]=i[0])}this.opt.development_extensions.field_hack&&t.note&&u.parseNoteFieldHacks(t,!1,this.opt.development_extensions.allow_field_hack_date_override);for(var o in t)if(u.DATE_VARIABLES.indexOf(o.replace(/^alt-/,""))>-1){var d=t[o];d&&(this.opt.development_extensions.raw_date_parsing&&d.raw&&(!d["date-parts"]||d["date-parts"].length===0)&&(d=this.fun.dateparser.parseDateToObject(d.raw)),t[o]=this.dateParseArray(d))}if(this.opt.development_extensions.consolidate_legal_items&&t.type&&["bill","gazette","legislation","regulation","treaty"].indexOf(t.type)>-1){for(var h,v=["type","title","jurisdiction","genre","volume","container-title"],b=[],n=0,r=v.length;n<r;n+=1)h=v[n],t[h]&&b.push(t[h]);v=["original-date","issued"];for(var n=0,r=v.length;n<r;n+=1)if(h=v[n],t[h]&&t[h].year){var y=t[h].year;b.push(y);break}t.legislation_id=b.join("::")}if(this.bibliography.opt.track_container_items&&this.bibliography.opt.track_container_items.indexOf(t.type)>-1){for(var h,v=["type","container-title","publisher","edition"],g=[],n=0,r=v.length;n<r;n+=1)h=v[n],t[h]&&g.push(t[h]);t.container_id=g.join("::")}if(this.opt.development_extensions.force_jurisdiction&&typeof t.authority=="string"&&(t.authority=[{literal:t.authority,multi:{_key:{}}}],t.multi&&t.multi._keys&&t.multi._keys.authority)){t.authority[0].multi._key={};for(var o in t.multi._keys.authority)t.authority[0].multi._key[o]={literal:t.multi._keys.authority[o]}}if(t["title-short"]||(t["title-short"]=t.shortTitle),this.opt.development_extensions.main_title_from_short_title){var x=this.opt["default-locale"][0].slice(0,2).toLowerCase()==="fr";u.extractTitleAndSubtitle.call(this,t,x)}var k=["bill","legal_case","legislation","gazette","regulation"].indexOf(t.type)>-1;this.opt.development_extensions.force_jurisdiction&&k&&(t.jurisdiction||(t.jurisdiction="us"));var w;if(!k&&t.title&&this.sys.getAbbreviation){t.jurisdiction,this.sys.normalizeAbbrevsKey?w=this.sys.normalizeAbbrevsKey("title",t.title):w=t.title;var C=this.transform.loadAbbreviation(t.jurisdiction,"title",w,t.language);this.transform.abbrevs[C].title&&this.transform.abbrevs[C].title[w]&&(t["title-short"]=this.transform.abbrevs[C].title[w])}if(t["container-title-short"]||(t["container-title-short"]=t.journalAbbreviation),t["container-title"]&&this.sys.getAbbreviation){this.sys.normalizeAbbrevsKey?w=this.sys.normalizeAbbrevsKey(t["container-title"]):w=t["container-title"];var C=this.transform.loadAbbreviation(t.jurisdiction,"container-title",w,t.language);this.transform.abbrevs[C]["container-title"]&&this.transform.abbrevs[C]["container-title"][w]&&(t["container-title-short"]=this.transform.abbrevs[C]["container-title"][w])}if(t.jurisdiction&&(t.country=t.jurisdiction.split(":")[0]),this.registry.refhash[e]){if(JSON.stringify(this.registry.refhash[e])!=JSON.stringify(t)){for(var o in this.registry.refhash[e])delete this.registry.refhash[e][o];this.tmp.taintedItemIDs[t.id]=!0,Object.assign(this.registry.refhash[e],t)}}else this.registry.refhash[e]=t;return this.registry.refhash[e]};u.Engine.prototype.refetchItem=function(e){return this.registry.refhash[e]};u.Engine.prototype.setOpt=function(e,t,i){e.name==="style"||e.name==="cslstyle"?(this.opt.inheritedAttributes[t]=i,this.citation.opt.inheritedAttributes[t]=i,this.bibliography.opt.inheritedAttributes[t]=i):["citation","bibliography"].indexOf(e.name)>-1?this[e.name].opt.inheritedAttributes[t]=i:e.strings[t]=i};u.Engine.prototype.inheritOpt=function(e,t,i,n){if(typeof e.strings[t]<"u")return e.strings[t];var r=this[this.tmp.root].opt.inheritedAttributes[i||t];return typeof r<"u"?r:n};u.Engine.prototype.remapSectionVariable=function(e){for(var t=0,i=e.length;t<i;t+=1){var n=e[t][0],r=e[t][1];if(["bill","gazette","legislation","regulation","treaty"].indexOf(n.type)>-1){if(r.locator){r.locator=r.locator.trim();var a=r.locator.match(u.STATUTE_SUBDIV_PLAIN_REGEX_FRONT);a||(r.label?r.locator=u.STATUTE_SUBDIV_STRINGS_REVERSE[r.label]+" "+r.locator:r.locator="p. "+r.locator)}var o=null;if(n.section){n.section=n.section.trim();var a=n.section.match(u.STATUTE_SUBDIV_PLAIN_REGEX_FRONT);a?o=a[0].trim():(n.section="sec. "+n.section,o="sec.")}if(n.section)if(!r.locator)r.locator=n.section;else{var a=r.locator.match(/^([^ ]*)\s*(.*)/),l=" ";a?(a[1]==="p."&&o!=="p."&&(r.locator=a[2]),["[","(",".",",",";",":","?"].indexOf(r.locator.slice(0,1))>-1&&(l="")):l="",r.locator=n.section+l+r.locator}r.label=""}}};u.Engine.prototype.setNumberLabels=function(e){if(e.number&&["bill","gazette","legislation","regulation","treaty"].indexOf(e.type)>-1&&this.opt.development_extensions.consolidate_legal_items&&!this.tmp.shadow_numbers.number){this.tmp.shadow_numbers.number={},this.tmp.shadow_numbers.number.values=[],this.tmp.shadow_numbers.number.plural=0,this.tmp.shadow_numbers.number.numeric=!1,this.tmp.shadow_numbers.number.label=!1;var t=""+e.number;t=t.split("\\").join("");var i=t.split(/\s+/)[0],n=u.STATUTE_SUBDIV_STRINGS[i];if(n){var r=t.split(u.STATUTE_SUBDIV_PLAIN_REGEX);if(r.length>1){for(var a=[],o=1,l=r.length;o<l;o+=1)a.push(r[o].replace(/\s*$/,"").replace(/^\s*/,""));t=a.join(" ")}else t=r[0];this.tmp.shadow_numbers.number.label=n,this.tmp.shadow_numbers.number.values.push(["Blob",t,!1]),this.tmp.shadow_numbers.number.numeric=!1}else this.tmp.shadow_numbers.number.values.push(["Blob",t,!1]),this.tmp.shadow_numbers.number.numeric=!0}};u.substituteOne=function(e){return function(t,i){return i?e.replace("%%STRING%%",i):""}};u.substituteTwo=function(e){return function(t){var i=e.replace("%%PARAM%%",t);return function(n,r){return r?i.replace("%%STRING%%",r):""}}};u.Mode=function(e){var t,i,n,r,a,o;t={},i=u.Output.Formats[e];for(n in i){if(n.slice(0,1)!=="@"){t[n]=i[n];continue}r=!1,a=i[n],o=n.split("/"),typeof a=="string"&&a.indexOf("%%STRING%%")>-1?a.indexOf("%%PARAM%%")>-1?r=u.substituteTwo(a):r=u.substituteOne(a):typeof a=="boolean"&&!a?r=u.Output.Formatters.passthrough:typeof a=="function"?r=a:u.error("Bad "+e+" config entry for "+n+": "+a),o.length===1?t[o[0]]=r:o.length===2&&(t[o[0]]||(t[o[0]]={}),t[o[0]][o[1]]=r)}return t};u.setDecorations=function(e,t){var i,n,r;i=[];for(r in u.FORMAT_KEY_SEQUENCE){var n=u.FORMAT_KEY_SEQUENCE[r];t[n]&&(i.push([n,t[n]]),delete t[n])}return i};u.Doppeler=function(e,t){var i=new RegExp("("+e+")","g"),n=new RegExp(e,"g");this.split=function(r){t&&(r=t(r));var a=r.match(i);if(!a)return{tags:[],strings:[r]};for(var o=r.split(n),l=a.length-1;l>-1;l--){typeof a[l]=="number"&&(a[l]="");var c=a[l];c==="'"&&o[l+1].length>0&&(o[l+1]=a[l]+o[l+1],a[l]="")}return{tags:a,strings:o,origStrings:o.slice()}},this.join=function(r){for(var a=r.strings.slice(-1),o=r.tags.length-1;o>-1;o--)a.push(r.tags[o]),a.push(r.strings[o]);return a.reverse(),a.join("")}};u.Engine.prototype.normalDecorIsOrphan=function(e,t){if(t[1]==="normal"){var i=!1,n;this.tmp.area==="citation"?n=[this.citation.opt.layout_decorations].concat(e.alldecor):n=e.alldecor;for(var r=n.length-1;r>-1;r+=-1)for(var a=n[r].length-1;a>-1;a+=-1)n[r][a][0]===t[0]&&n[r][a][1]!=="normal"&&(i=!0);if(!i)return!0}return!1};u.Engine.prototype.getCitationLabel=function(e){var t="",i=this.getTrigraphParams(),n=i[0],r=this.getTerm("reference","short",0);typeof r>"u"&&(r="reference"),r=r.replace(".",""),r=r.slice(0,1).toUpperCase()+r.slice(1);for(var a=0,o=u.NAME_VARIABLES.length;a<o;a+=1){var l=u.NAME_VARIABLES[a];if(e[l]){var c=e[l];c.length>i.length?n=i[i.length-1]:n=i[c.length-1];for(var f=0,p=c.length;f<p&&f!==n.authors.length;f+=1){var m=this.nameOutput.getName(c[f],"locale-translit",!0),d=m.name;d&&d.family?(r=d.family,r=r.replace(/^([ \'\u2019a-z]+\s+)/,"")):d&&d.literal&&(r=d.literal);var h=r.toLowerCase().match(/^(a\s+|the\s+|an\s+)/);if(h&&(r=r.slice(h[1].length)),r=r.replace(u.ROMANESQUE_NOT_REGEXP,""),!r)break;r=r.slice(0,n.authors[f]),r.length>1?r=r.slice(0,1).toUpperCase()+r.slice(1).toLowerCase():r.length===1&&(r=r.toUpperCase()),t+=r}break}}if(!t&&e.title){for(var v=this.locale[this.opt.lang].opts["skip-words"],b=e.title.split(/\s+/),a=b.length-1;a>-1;a--)v.indexOf(b[a])>-1&&(b=b.slice(0,a).concat(b.slice(a+1)));var y=b.join("");y=y.slice(0,i[0].authors[0]),y.length>1?y=y.slice(0,1).toUpperCase()+y.slice(1).toLowerCase():y.length===1&&(y=y.toUpperCase()),t=y}var g="0000";return e.issued&&e.issued.year&&(g=""+e.issued.year),g=g.slice(n.year*-1),t=t+g,t};u.Engine.prototype.getTrigraphParams=function(){var e=[],t=this.opt.trigraph.split(":");(!this.opt.trigraph||this.opt.trigraph.slice(0,1)!=="A")&&u.error("Bad trigraph definition: "+this.opt.trigraph);for(var i=0,n=t.length;i<n;i+=1){for(var r=t[i],a={authors:[],year:0},o=0,l=r.length;o<l;o+=1)switch(r.slice(o,o+1)){case"A":a.authors.push(1);break;case"a":a.authors[a.authors.length-1]+=1;break;case"0":a.year+=1;break;default:u.error("Invalid character in trigraph definition: "+this.opt.trigraph)}e.push(a)}return e};u.Engine.prototype.setOutputFormat=function(e){this.opt.mode=e,this.fun.decorate=u.Mode(e),this.output[e]||(this.output[e]={},this.output[e].tmp={})};u.Engine.prototype.getSortFunc=function(){return function(e,t){return e=e.split("-"),t=t.split("-"),e.length<t.length?1:e.length>t.length?-1:(e=e.slice(-1)[0],t=t.slice(-1)[0],e.length<t.length?1:e.length>t.length?-1:0)}};u.Engine.prototype.setLangTagsForCslSort=function(e){var t,i;if(e)for(this.opt["locale-sort"]=[],t=0,i=e.length;t<i;t+=1)this.opt["locale-sort"].push(e[t]);this.opt["locale-sort"].sort(this.getSortFunc())};u.Engine.prototype.setLangTagsForCslTransliteration=function(e){var t,i;if(this.opt["locale-translit"]=[],e)for(t=0,i=e.length;t<i;t+=1)this.opt["locale-translit"].push(e[t]);this.opt["locale-translit"].sort(this.getSortFunc())};u.Engine.prototype.setLangTagsForCslTranslation=function(e){var t,i;if(this.opt["locale-translat"]=[],e)for(t=0,i=e.length;t<i;t+=1)this.opt["locale-translat"].push(e[t]);this.opt["locale-translat"].sort(this.getSortFunc())};u.Engine.prototype.setLangPrefsForCites=function(e,t){var i=this.opt["cite-lang-prefs"];t||(t=function(h){return h.toLowerCase()});for(var n=["Persons","Institutions","Titles","Journals","Publishers","Places"],r=0,a=n.length;r<a;r+=1){var o=t(n[r]),l=n[r].toLowerCase();if(e[o]){for(var c=[];e[o].length>1;)c.push(e[o].pop());var f={orig:1,translit:2,translat:3};for(c.length===2&&f[c[0]]<f[c[1]]&&c.reverse();c.length;)e[o].push(c.pop());for(var p=i[l];p.length;)p.pop();for(var m=0,d=e[o].length;m<d;m+=1)p.push(e[o][m])}}};u.Engine.prototype.setLangPrefsForCiteAffixes=function(e){if(e&&e.length===48){for(var t=this.opt.citeAffixes,i=0,n=["persons","institutions","titles","journals","publishers","places"],r=["translit","orig","translit","translat"],a,o=0,l=n.length;o<l;o+=1)for(var c=0,f=r.length;c<f;c+=1)a="",i%8===4?!t[n[o]]["locale-"+r[c]].prefix&&!t[n[o]]["locale-"+r[c]].suffix&&(a=e[i]?e[i]:"",t[n[o]]["locale-"+r[c]].prefix=a,a=e[i]?e[i+1]:"",t[n[o]]["locale-"+r[c]].suffix=a):(a=e[i]?e[i]:"",t[n[o]]["locale-"+r[c]].prefix=a,a=e[i]?e[i+1]:"",t[n[o]]["locale-"+r[c]].suffix=a),i+=2;this.opt.citeAffixes=t}};u.Engine.prototype.setAutoVietnameseNamesOption=function(e){e?this.opt["auto-vietnamese-names"]=!0:this.opt["auto-vietnamese-names"]=!1};u.Engine.prototype.setAbbreviations=function(e){this.sys.setAbbreviations&&this.sys.setAbbreviations(e)};u.Engine.prototype.setSuppressTrailingPunctuation=function(e){this.citation.opt.suppressTrailingPunctuation=!!e};u.Output={};u.Output.Queue=function(e){this.levelname=["top"],this.state=e,this.queue=[],this.empty=new u.Token("empty");var t={};t.empty=this.empty,this.formats=new u.Stack(t),this.current=new u.Stack(this.queue)};u.Output.Queue.prototype.pop=function(){var e=this.current.value();return e.length?e.pop():e.blobs.pop()};u.Output.Queue.prototype.getToken=function(e){var t=this.formats.value()[e];return t};u.Output.Queue.prototype.mergeTokenStrings=function(e,t){var i,n,r,a;if(i=this.formats.value()[e],n=this.formats.value()[t],r=i,n){i||(i=new u.Token(e,u.SINGLETON),i.decorations=[]),r=new u.Token(e,u.SINGLETON);var a="";for(var a in i.strings)i.strings.hasOwnProperty(a)&&(r.strings[a]=i.strings[a]);for(var a in n.strings)n.strings.hasOwnProperty(a)&&(r.strings[a]=n.strings[a]);r.decorations=i.decorations.concat(n.decorations)}return r};u.Output.Queue.prototype.addToken=function(e,t,i){var n,r;if(n=new u.Token("output"),typeof i=="string"&&(i=this.formats.value()[i]),i&&i.strings){for(r in i.strings)i.strings.hasOwnProperty(r)&&(n.strings[r]=i.strings[r]);n.decorations=i.decorations}typeof t=="string"&&(n.strings.delimiter=t),this.formats.value()[e]=n};u.Output.Queue.prototype.pushFormats=function(e){e||(e={}),e.empty=this.empty,this.formats.push(e)};u.Output.Queue.prototype.popFormats=function(){this.formats.pop()};u.Output.Queue.prototype.startTag=function(e,t){var i={};this.state.tmp["doing-macro-with-date"]&&this.state.tmp.extension&&(t=this.empty,e="empty"),i[e]=t,this.pushFormats(i),this.openLevel(e)};u.Output.Queue.prototype.endTag=function(e){this.closeLevel(e),this.popFormats()};u.Output.Queue.prototype.openLevel=function(e){var t,i;typeof e=="object"?t=new u.Blob(void 0,e):typeof e>"u"?t=new u.Blob(void 0,this.formats.value().empty,"empty"):((!this.formats.value()||!this.formats.value()[e])&&u.error('CSL processor error: call to nonexistent format token "'+e+'"'),t=new u.Blob(void 0,this.formats.value()[e],e)),i=this.current.value(),!this.state.tmp.just_looking&&this.checkNestedBrace&&(t.strings.prefix=this.checkNestedBrace.update(t.strings.prefix)),i.push(t),this.current.push(t)};u.Output.Queue.prototype.closeLevel=function(e){e&&e!==this.current.value().levelname&&u.error("Level mismatch error: wanted "+e+" but found "+this.current.value().levelname);var t=this.current.pop();!this.state.tmp.just_looking&&this.checkNestedBrace&&(t.strings.suffix=this.checkNestedBrace.update(t.strings.suffix))};u.Output.Queue.prototype.append=function(e,t,i,n,r){var a,o,l,c=!0;if(i&&(n=!0),this.state.tmp["doing-macro-with-date"]&&!i){if(t!=="macro-with-date")return!1;t==="macro-with-date"&&(t="empty")}if(typeof e>"u"||(typeof e=="number"&&(e=""+e),!i&&this.state.tmp.element_trace&&this.state.tmp.element_trace.value()==="suppress-me"))return!1;if(o=!1,t?t==="literal"?(a=!0,c=!1):typeof t=="string"?a=this.formats.value()[t]:a=t:a=this.formats.value().empty,a||u.error("CSL processor error: unknown format token name: "+t),a.strings&&typeof a.strings.delimiter>"u"&&(a.strings.delimiter=""),typeof e=="string"&&e.length&&(e=e.replace(/ ([:;?!\u00bb])/g," $1").replace(/\u00ab /g,"« "),this.last_char_rendered=e.slice(-1),e=e.replace(/\s+'/g," '"),i||(e=e.replace(/^'/g," '")),n?i&&(this.state.tmp.term_predecessor_name=!0):(this.state.tmp.term_predecessor=!0,this.state.tmp.in_cite_predecessor=!0)),o=new u.Blob(e,a),l=this.current.value(),typeof l>"u"&&this.current.mystack.length===0&&(this.current.mystack.push([]),l=this.current.value()),typeof o.blobs=="string"&&(n?i&&(this.state.tmp.term_predecessor_name=!0):(this.state.tmp.term_predecessor=!0,this.state.tmp.in_cite_predecessor=!0)),typeof e=="string"){if(typeof o.blobs=="string"&&o.blobs.slice(0,1)!==" "){for(var f="",p=o.blobs;u.TERMINAL_PUNCTUATION.indexOf(p.slice(0,1))>-1;)f=f+p.slice(0,1),p=p.slice(1);p&&f&&(o.strings.prefix=o.strings.prefix+f,o.blobs=p)}o.strings["text-case"]&&(o.blobs=u.Output.Formatters[o.strings["text-case"]](this.state,e)),this.state.tmp.strip_periods&&!r&&(o.blobs=o.blobs.replace(/\.([^a-z]|$)/g,"$1"));for(var m=o.decorations.length-1;m>-1;m+=-1)o.decorations[m][0]==="@quotes"&&o.decorations[m][1]!=="false"&&(o.punctuation_in_quote=this.state.getOpt("punctuation-in-quote")),o.blobs.match(u.ROMANESQUE_REGEXP)||o.decorations[m][0]==="@font-style"&&(o.decorations=o.decorations.slice(0,m).concat(o.decorations.slice(m+1)));l.push(o),this.state.fun.flipflopper.processTags(o)}else c?l.push(o):l.push(e);return!0};u.Output.Queue.prototype.string=function(e,t,i){var n,r,a,o,l,c=u.getSafeEscape(this.state),f=t.slice(),p=[];if(f.length===0)return p;var m="";i?m=i.strings.delimiter:(e.tmp.count_offset_characters=!1,e.tmp.offset_characters=0),i&&i.new_locale&&(i.old_locale=e.opt.lang,e.opt.lang=i.new_locale);for(var d,h,v,b,n=0,r=f.length;n<r;n+=1){if(d=f[n],d.strings.first_blob&&(e.tmp.count_offset_characters=d.strings.first_blob),typeof d.blobs=="string"){if(typeof d.num=="number")p.push(d);else if(d.blobs){d.particle&&(d.blobs=d.particle+d.blobs,d.particle=""),l=c(d.blobs);var y=l.length;if(!e.tmp.suppress_decorations)for(a=0,o=d.decorations.length;a<o;a+=1)b=d.decorations[a],b[0]!=="@showid"&&(e.normalDecorIsOrphan(d,b)||(l=e.fun.decorate[b[0]][b[1]].call(d,e,l,b[2])));if(l&&l.length){if(l=c(d.strings.prefix)+l+c(d.strings.suffix),e.opt.development_extensions.csl_reverse_lookup_support&&!e.tmp.suppress_decorations)for(a=0,o=d.decorations.length;a<o;a+=1)b=d.decorations[a],b[0]==="@showid"&&(l=e.fun.decorate[b[0]][b[1]].call(d,e,l,b[2]));p.push(l),e.tmp.count_offset_characters&&(e.tmp.offset_characters+=y+d.strings.suffix.length+d.strings.prefix.length)}}}else if(d.blobs.length){var g=e.output.string(e,d.blobs,d);if(i&&g!=="string"&&g.length>1&&d.strings.delimiter)for(var x=!1,a=0,o=g.length;a<o;a++)typeof g[a]!="string"?x=!0:x&&(g[a]=d.strings.delimiter+g[a]);p=p.concat(g)}d.strings.first_blob&&e.registry.registry[d.strings.first_blob]&&(e.registry.registry[d.strings.first_blob].offset=e.tmp.offset_characters,e.tmp.count_offset_characters=!1)}for(n=0,r=p.length-1;n<r;n+=1)typeof p[n].num=="number"&&typeof p[n+1].num=="number"&&!p[n+1].UGLY_DELIMITER_SUPPRESS_HACK&&(p[n].strings.suffix=p[n].strings.suffix+(m||""),p[n+1].successor_prefix="",p[n+1].UGLY_DELIMITER_SUPPRESS_HACK=!0);for(var k=0,n=0,r=p.length;n<r;n+=1)typeof p[n]=="string"&&(k=parseInt(n,10)+1,n<p.length-1&&typeof p[n+1]=="object"&&(m&&!p[n+1].UGLY_DELIMITER_SUPPRESS_HACK&&(p[n]+=c(m)),p[n+1].UGLY_DELIMITER_SUPPRESS_HACK=!0));if(i&&(i.decorations.length||i.strings.suffix))k=p.length;else if(i&&i.strings.prefix){for(var n=0,r=p.length;n<r;n++)if(typeof p[n].num<"u"){k=n,n===0&&(p[n].strings.prefix=i.strings.prefix+p[n].strings.prefix);break}}var w=e.output.renderBlobs(p.slice(0,k),m,!1,i);if(w&&i&&(i.decorations.length||i.strings.suffix||i.strings.prefix)){if(!e.tmp.suppress_decorations)for(var n=0,r=i.decorations.length;n<r;n+=1)b=i.decorations[n],!(["@cite","@bibliography","@display","@showid"].indexOf(b[0])>-1)&&(e.normalDecorIsOrphan(d,b)||b[0]&&typeof w=="string"&&(w=e.fun.decorate[b[0]][b[1]].call(i,e,w,b[2])));if(l=w,h=i.strings.suffix,l&&l.length&&(v=i.strings.prefix,l=c(v)+l+c(h),e.tmp.count_offset_characters&&(e.tmp.offset_characters+=v.length+h.length)),w=l,!e.tmp.suppress_decorations)for(var n=0,r=i.decorations.length;n<r;n+=1)b=i.decorations[n],["@cite","@bibliography","@display","@showid"].indexOf(b[0])!==-1&&typeof w=="string"&&(w=e.fun.decorate[b[0]][b[1]].call(i,e,w,b[2]))}var C=p.slice(k,p.length);return!C.length&&w?p=[w]:C.length&&!w?p=C:w&&C.length&&(p=[w].concat(C)),typeof i>"u"?(this.queue=[],this.current.mystack=[],this.current.mystack.push(this.queue),e.tmp.suppress_decorations&&(p=e.output.renderBlobs(p,void 0,!1))):typeof i=="boolean"&&(p=e.output.renderBlobs(p,void 0,!0)),i&&i.new_locale&&(e.opt.lang=i.old_locale),p};u.Output.Queue.prototype.clearlevel=function(){var e,t,i;for(e=this.current.value(),i=e.blobs.length,t=0;t<i;t+=1)e.blobs.pop()};u.Output.Queue.prototype.renderBlobs=function(e,t,i,n){var r,a,o,l,c,f,p,m,d,h,v;if(v=u.getSafeEscape(this.state),t||(t=""),r=this.state,a="",o="",f=e.length,this.state.tmp.area==="citation"&&!this.state.tmp.just_looking&&f===1&&typeof e[0]=="object"&&n)return e[0].strings.prefix=n.strings.prefix+e[0].strings.prefix,e[0].strings.suffix=e[0].strings.suffix+n.strings.suffix,e[0].decorations=e[0].decorations.concat(n.decorations),e[0].params=n.params,e[0];var b=!0;for(c=0;c<f;c+=1)e[c].checkNext?(e[c].checkNext(e[c+1],b),b=!1):e[c+1]&&e[c+1].splice_prefix?b=!1:b=!0;var y=!0;for(c=e.length-1;c>0;c+=-1)e[c].checkLast?y&&e[c].checkLast(e[c-1])&&(y=!1):y=!0;for(f=e.length,c=0;c<f;c+=1)if(l=e[c],a&&(o=t),typeof l=="string")a+=v(o),a+=l,r.tmp.count_offset_characters&&(r.tmp.offset_characters+=o.length);else if(i)a?a=[a,l]:a=[l];else if(l.status!==u.SUPPRESS){l.particle?d=l.particle+l.num:d=l.formatter.format(l.num,l.gender);var g=d.replace(/<[^>]*>/g,"").length;this.append(d,"empty",!0);var x=this.pop(),k=r.tmp.count_offset_characters;if(d=this.string(r,[x],!1),r.tmp.count_offset_characters=k,l.strings["text-case"]&&(d=u.Output.Formatters[l.strings["text-case"]](this.state,d)),d&&this.state.tmp.strip_periods&&(d=d.replace(/\.([^a-z]|$)/g,"$1")),!r.tmp.suppress_decorations)for(m=l.decorations.length,p=0;p<m;p+=1)h=l.decorations[p],!r.normalDecorIsOrphan(l,h)&&(d=r.fun.decorate[h[0]][h[1]].call(l,r,d,h[2]));d=v(l.strings.prefix)+d+v(l.strings.suffix);var w="";l.status===u.END?w=v(l.range_prefix):l.status===u.SUCCESSOR?w=v(l.successor_prefix):l.status===u.START?c>0&&!l.suppress_splice_prefix?w=v(l.splice_prefix):w="":l.status===u.SEEN&&(w=v(l.splice_prefix)),a+=w,a+=d,r.tmp.count_offset_characters&&(r.tmp.offset_characters+=w.length+l.strings.prefix.length+g+l.strings.suffix.length)}return a};u.Output.Queue.purgeEmptyBlobs=function(e){if(!(typeof e!="object"||typeof e.blobs!="object"||!e.blobs.length))for(var t=e.blobs.length-1;t>-1;t--){u.Output.Queue.purgeEmptyBlobs(e.blobs[t]);var i=e.blobs[t];if(!i||!i.blobs||!i.blobs.length){for(var n=[];e.blobs.length-1>t;)n.push(e.blobs.pop());for(e.blobs.pop();n.length;)e.blobs.push(n.pop())}}};u.Output.Queue.adjust=function(e){var t={";":!0,":":!0},i={".":!0,"!":!0,"?":!0},n={"!":{".":"!","?":"!?",":":"!",",":"!,",";":"!;"},"?":{"!":"?!",".":"?",":":"?",",":"?,",";":"?;"},".":{"!":".!","?":".?",":":".:",",":".,",";":".;"},":":{"!":"!","?":"?",".":":",",":":,",";":":;"},",":{"!":",!","?":",?",":":",:",".":",.",";":",;"},";":{"!":"!","?":"?",":":";",",":";,",".":";"}},r={},a={},o={},l={};for(var c in n)o[c]=!0,l[c]=!0,t[c]||(r[c]=!0),i[c]||(a[c]=!0);l[" "]=!0,l[" "]=!0;var f={};for(var c in n)for(var p in n[c])f[p]||(f[p]={}),f[p][c]=n[c][p];function m(_){return typeof _.num=="number"||_.blobs&&_.blobs.length===1&&typeof _.blobs[0].num=="number"}function d(_){if(typeof _.num=="number")return!0;if(!_.blobs||typeof _.blobs!="object")return!1;if(d(_.blobs[_.blobs.length-1]))return!0}function h(_,S){var T=!1,D=["@font-style","@font-variant","@font-weight","@text-decoration","@vertical-align"];if(S&&D.push("@quotes"),_.decorations){for(var H=0,V=_.decorations.length;H<V;H++)if(D.indexOf(_.decorations[H][0])>-1){T=!0;break}}return T}function v(_){if(_.decorations){for(var S=0,T=_.decorations.length;S<T;S++)if(_.decorations[S][0]==="@quotes"&&_.decorations[S][1]!=="false")return!0}return typeof _.blobs!="object"?!1:v(_.blobs[_.blobs.length-1])}function b(_,S){var T=S.strings.suffix.slice(-1);!T&&typeof S.blobs=="string"&&(T=S.blobs.slice(-1));var D=f[_][T];return D&&D.length===1?!0:typeof S.blobs!="object"?!1:!!b(_,S.blobs[S.blobs.length-1])}function y(_,S){if(!o[S])return!1;if(typeof _.blobs=="string")return _.blobs.slice(-1)===S;var T=_.blobs[_.blobs.length-1];if(T){var D=T.strings.suffix.slice(-1);return D?T.strings.suffix.slice(-1)==S:y(T,S)}else return!1}function g(_,S,T,D,H){var V=S==="blobs"?_:_.strings,M=D==="blobs"?T:T.strings,$=V[S].slice(-1),P=M[D].slice(0,1);function W(){M[D]=M[D].slice(1)}function L(){V[S]=V[S].slice(0,-1)}function Q(F){M[D]=F+M[D]}function j(F){V[S]+=F}var O=H?L:W;function R(){return f[P]}function U(){return n[$]}var oe=H?U:R;function ie(){var F=n[$][P];typeof F=="string"?(L(),W(),Q(F)):(Q($),L())}function ee(){var F=f[P][$];typeof F=="string"?(L(),W(),j(F)):(j(P),W())}var te=H?ie:ee,X=$===P;X?O():oe()&&te()}function x(_){if(_.blobs&&typeof _.blobs=="string"){o[_.strings.suffix.slice(0,1)]&&_.strings.suffix.slice(0,1)===_.blobs.slice(-1)&&(_.strings.suffix=_.strings.suffix.slice(1));return}else if(typeof _!="object"||typeof _.blobs!="object"||!_.blobs.length)return;for(var S=h(_,!0),T=_.blobs.length-1;T>-1;T--){this.upward(_.blobs[T]);var D=_.strings,H=_.blobs[T].strings;if(T===0){D.prefix.slice(-1)===" "&&H.prefix.slice(0,1)===" "&&(H.prefix=H.prefix.slice(1));var V=H.prefix.slice(0,1);!S&&l[V]&&!D.prefix&&(D.prefix+=V,H.prefix=H.prefix.slice(1))}if(T===_.blobs.length-1){var V=H.suffix.slice(-1);!S&&[" "].indexOf(V)>-1&&(D.suffix.slice(0,1)!==V&&(D.suffix=V+D.suffix),H.suffix=H.suffix.slice(0,-1))}D.delimiter&&T>0&&l[D.delimiter.slice(-1)]&&D.delimiter.slice(-1)===H.prefix.slice(0,1)&&(H.prefix=H.prefix.slice(1))}}function k(_){if(!(typeof _!="object"||typeof _.blobs!="object"||!_.blobs.length)){for(var S=_.blobs.length-1;S>-1;S--)if(this.leftward(_.blobs[S]),S<_.blobs.length-1&&!_.strings.delimiter){var T=_.blobs[S],D=T.strings.suffix.slice(-1),H=_.blobs[S+1],V=H.strings.prefix.slice(0,1),M=h(T)||h(H),$=typeof D=="number"||typeof V=="number";if(!M&&!$&&o[V]&&!$){var P=V===T.strings.suffix.slice(-1),W=!T.strings.suffix&&typeof T.blobs=="string"&&T.blobs.slice(-1)===V;!P&&!W?g(T,"suffix",H,"prefix"):H.strings.prefix=H.strings.prefix.slice(1)}}}}function w(_){if(_.blobs&&typeof _.blobs=="string"){o[_.strings.suffix.slice(0,1)]&&_.strings.suffix.slice(0,1)===_.blobs.slice(-1)&&(_.strings.suffix=_.strings.suffix.slice(1));return}else if(typeof _!="object"||typeof _.blobs!="object"||!_.blobs.length)return;for(var S=_.strings,T=0,D=_.blobs.length;T<D&&!m(_.blobs[T]);T++);if(S.delimiter&&o[S.delimiter.slice(0,1)]){for(var H=S.delimiter.slice(0,1),T=_.blobs.length-2;T>-1;T--){var V=_.blobs[T].strings;V.suffix.slice(-1)!==H&&(V.suffix+=H)}S.delimiter=S.delimiter.slice(1)}for(var T=_.blobs.length-1;T>-1;T--){var M=_.blobs[T],V=_.blobs[T].strings,$=h(M,!0),P=m(M);if(T===_.blobs.length-1){{var W=S.suffix.slice(0,1),L=!1;o[W]&&(L=b(W,M),!L&&e&&(L=v(M))),L&&o[W]&&(d(M)||(typeof M.blobs=="string"?g(M,"blobs",_,"suffix"):g(M,"suffix",_,"suffix"),S.suffix.slice(0,1)==="."&&(V.suffix+=S.suffix.slice(0,1),S.suffix=S.suffix.slice(1)))),V.suffix.slice(-1)===" "&&S.suffix.slice(0,1)===" "&&(S.suffix=S.suffix.slice(1)),l[V.suffix.slice(0,1)]&&(typeof M.blobs=="string"&&M.blobs.slice(-1)===V.suffix.slice(0,1)&&(V.suffix=V.suffix.slice(1)),V.suffix.slice(-1)===S.suffix.slice(0,1)&&(S.suffix=S.suffix.slice(0,-1)))}y(_,_.strings.suffix.slice(0,1))&&(_.strings.suffix=_.strings.suffix.slice(1))}else if(S.delimiter)l[S.delimiter.slice(0,1)]&&S.delimiter.slice(0,1)===V.suffix.slice(-1)&&(_.blobs[T].strings.suffix=_.blobs[T].strings.suffix.slice(0,-1));else{var Q=_.blobs[T+1].strings;!m(M)&&!$&&l[V.suffix.slice(-1)]&&V.suffix.slice(-1)===Q.prefix.slice(0,1)&&(Q.prefix=Q.prefix.slice(1))}!P&&!$&&o[V.suffix.slice(0,1)]&&typeof M.blobs=="string"&&g(M,"blobs",M,"suffix"),this.downward(_.blobs[T])}}function C(_){var S=_.strings.suffix.slice(0,1);if(typeof _.blobs=="string")for(;r[S];)g(_,"blobs",_,"suffix"),S=_.strings.suffix.slice(0,1);else for(;r[S];)g(_.blobs[_.blobs.length-1],"suffix",_,"suffix"),S=_.strings.suffix.slice(0,1)}function E(_){if(typeof _.blobs=="string")for(var S=_.blobs.slice(-1);a[S];)g(_,"blobs",_,"suffix",!0),S=_.blobs.slice(-1);else for(var S=_.blobs[_.blobs.length-1].strings.suffix.slice(-1);a[S];)g(_.blobs[_.blobs.length-1],"suffix",_,"suffix",!0),S=_.blobs[_.blobs.length-1].strings.suffix.slice(-1)}function B(_){if(!(typeof _!="object"||typeof _.blobs!="object"||!_.blobs.length)){for(var S,T=0,D=_.blobs.length;T<D;T++){for(var H=_.blobs[T],V=!1,M=0,$=H.decorations.length;M<$;M++){var P=H.decorations[M];P[0]==="@quotes"&&P[1]!=="false"&&(V=!0)}V&&(e?C(H):E(H)),S=this.fix(_.blobs[T]),H.blobs&&typeof H.blobs=="string"&&(S=H.blobs.slice(-1))}return S}}this.upward=x,this.leftward=k,this.downward=w,this.fix=B};u.Engine.Opt=function(){this.parallel={enable:!1},this.has_disambiguate=!1,this.mode="html",this.dates={},this.jurisdictions_seen={},this.suppressedJurisdictions={},this.inheritedAttributes={},this["locale-sort"]=[],this["locale-translit"]=[],this["locale-translat"]=[],this.citeAffixes={persons:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}},institutions:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}},titles:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}},journals:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}},publishers:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}},places:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}}},this["default-locale"]=[],this.update_mode=u.NONE,this.bib_mode=u.NONE,this.sort_citations=!1,this["et-al-min"]=0,this["et-al-use-first"]=1,this["et-al-use-last"]=!1,this["et-al-subsequent-min"]=!1,this["et-al-subsequent-use-first"]=!1,this["demote-non-dropping-particle"]="display-and-sort",this["parse-names"]=!0,this.citation_number_slug=!1,this.trigraph="Aaaa00:AaAa00:AaAA00:AAAA00",this.nodenames=[],this.gender={},this["cite-lang-prefs"]={persons:["orig"],institutions:["orig"],titles:["orig"],journals:["orig"],publishers:["orig"],places:["orig"],number:["orig"]},this.has_layout_locale=!1,this.disable_duplicate_year_suppression=[],this.use_context_condition=!1,this.jurisdiction_fallbacks={},this.development_extensions={},this.development_extensions.field_hack=!0,this.development_extensions.allow_field_hack_date_override=!0,this.development_extensions.locator_date_and_revision=!0,this.development_extensions.locator_label_parse=!0,this.development_extensions.raw_date_parsing=!0,this.development_extensions.clean_up_csl_flaws=!0,this.development_extensions.consolidate_legal_items=!1,this.development_extensions.csl_reverse_lookup_support=!1,this.development_extensions.wrap_url_and_doi=!1,this.development_extensions.thin_non_breaking_space_html_hack=!1,this.development_extensions.apply_citation_wrapper=!1,this.development_extensions.main_title_from_short_title=!1,this.development_extensions.uppercase_subtitles=!1,this.development_extensions.normalize_lang_keys_to_lowercase=!1,this.development_extensions.strict_text_case_locales=!1,this.development_extensions.expect_and_symbol_form=!1,this.development_extensions.require_explicit_legal_case_title_short=!1,this.development_extensions.spoof_institutional_affiliations=!1,this.development_extensions.force_jurisdiction=!1,this.development_extensions.parse_names=!0,this.development_extensions.hanging_indent_legacy_number=!1,this.development_extensions.throw_on_empty=!1,this.development_extensions.strict_inputs=!0,this.development_extensions.prioritize_disambiguate_condition=!1,this.development_extensions.force_short_title_casing_alignment=!0,this.development_extensions.implicit_short_title=!1,this.development_extensions.force_title_abbrev_fallback=!1,this.development_extensions.split_container_title=!1,this.development_extensions.legacy_institution_name_ordering=!1,this.development_extensions.etal_min_etal_usefirst_hack=!1};u.Engine.Tmp=function(){this.names_max=new u.Stack,this.names_base=new u.Stack,this.givens_base=new u.Stack,this.value=[],this.namepart_decorations={},this.namepart_type=!1,this.area="citation",this.root="citation",this.extension="",this.can_substitute=new u.Stack(0,u.LITERAL),this.element_rendered_ok=!1,this.element_trace=new u.Stack("style"),this.nameset_counter=0,this.group_context=new u.Stack({term_intended:!1,variable_attempt:!1,variable_success:!1,output_tip:void 0,label_form:void 0,parallel_first:void 0,parallel_last:void 0,parallel_delimiter_override:void 0,condition:!1,force_suppress:!1,done_vars:[]}),this.term_predecessor=!1,this.in_cite_predecessor=!1,this.jump=new u.Stack(0,u.LITERAL),this.decorations=new u.Stack,this.tokenstore_stack=new u.Stack,this.last_suffix_used="",this.last_names_used=[],this.last_years_used=[],this.years_used=[],this.names_used=[],this.taintedItemIDs={},this.taintedCitationIDs={},this.initialize_with=new u.Stack,this.disambig_request=!1,this["name-as-sort-order"]=!1,this.suppress_decorations=!1,this.disambig_settings=new u.AmbigConfig,this.bib_sort_keys=[],this.prefix=new u.Stack("",u.LITERAL),this.suffix=new u.Stack("",u.LITERAL),this.delimiter=new u.Stack("",u.LITERAL),this.cite_locales=[],this.cite_affixes={citation:!1,bibliography:!1,citation_sort:!1,bibliography_sort:!1},this.strip_periods=0,this.shadow_numbers={},this.authority_stop_last=0,this.loadedItemIDs={},this.condition_counter=0,this.condition_lang_val_arr=[],this.condition_lang_counter_arr=[]};u.Engine.Fun=function(e){this.match=new u.Util.Match,this.suffixator=new u.Util.Suffixator(u.SUFFIX_CHARS),this.romanizer=new u.Util.Romanizer,this.ordinalizer=new u.Util.Ordinalizer(e),this.long_ordinalizer=new u.Util.LongOrdinalizer};u.Engine.Build=function(){this["alternate-term"]=!1,this.in_bibliography=!1,this.in_style=!1,this.skip=!1,this.postponed_macro=!1,this.layout_flag=!1,this.name=!1,this.names_variables=[[]],this.name_label=[{}],this.form=!1,this.term=!1,this.macro={},this.macro_stack=[],this.text=!1,this.lang=!1,this.area="citation",this.root="citation",this.extension="",this.substitute_level=new u.Stack(0,u.LITERAL),this.names_level=0,this.render_nesting_level=0,this.render_seen=!1,this.bibliography_key_pos=0};u.Engine.Configure=function(){this.tests=[],this.fail=[],this.succeed=[]};u.Engine.Citation=function(e){this.opt={inheritedAttributes:{}},this.tokens=[],this.srt=new u.Registry.Comparifier(e,"citation_sort"),this.opt.collapse=[],this.opt["disambiguate-add-names"]=!1,this.opt["disambiguate-add-givenname"]=!1,this.opt["disambiguate-add-year-suffix"]=!1,this.opt["givenname-disambiguation-rule"]="by-cite",this.opt["near-note-distance"]=5,this.opt.topdecor=[],this.opt.layout_decorations=[],this.opt.layout_prefix="",this.opt.layout_suffix="",this.opt.layout_delimiter="",this.opt.sort_locales=[],this.opt.max_number_of_names=0,this.root="citation"};u.Engine.Bibliography=function(){this.opt={inheritedAttributes:{}},this.tokens=[],this.opt.collapse=[],this.opt.topdecor=[],this.opt.layout_decorations=[],this.opt.layout_prefix="",this.opt.layout_suffix="",this.opt.layout_delimiter="",this.opt["line-spacing"]=1,this.opt["entry-spacing"]=1,this.opt.sort_locales=[],this.opt.max_number_of_names=0,this.root="bibliography"};u.Engine.BibliographySort=function(){this.tokens=[],this.opt={},this.opt.sort_directions=[],this.opt.topdecor=[],this.opt.citation_number_sort_direction=u.ASCENDING,this.opt.citation_number_secondary=!1,this.tmp={},this.keys=[],this.root="bibliography"};u.Engine.CitationSort=function(){this.tokens=[],this.opt={},this.opt.sort_directions=[],this.keys=[],this.opt.topdecor=[],this.root="citation"};u.Engine.InText=function(){this.opt={inheritedAttributes:{}},this.tokens=[],this.opt.collapse=[],this.opt["disambiguate-add-names"]=!1,this.opt["disambiguate-add-givenname"]=!1,this.opt["disambiguate-add-year-suffix"]=!1,this.opt["givenname-disambiguation-rule"]="by-cite",this.opt["near-note-distance"]=5,this.opt.topdecor=[],this.opt.layout_decorations=[],this.opt.layout_prefix="",this.opt.layout_suffix="",this.opt.layout_delimiter="",this.opt.sort_locales=[],this.opt.max_number_of_names=0,this.root="intext"};u.Engine.prototype.previewCitationCluster=function(e,t,i,n){var r=this.opt.mode;this.setOutputFormat(n),e.citationID&&delete e.citationID;var a=this.processCitationCluster(e,t,i,u.PREVIEW);return this.setOutputFormat(r),a[1]};u.Engine.prototype.appendCitationCluster=function(e){for(var t=[],i=this.registry.citationreg.citationByIndex.length,n=0;n<i;n+=1){var r=this.registry.citationreg.citationByIndex[n];t.push([""+r.citationID,r.properties.noteIndex])}return this.processCitationCluster(e,t,[])[1]};u.Engine.prototype.processCitationCluster=function(e,t,i,n){var r,a,o,l,c,f,p,m,d,h,v,b,y,g,x,k,w,C;this.debug=!1,this.tmp.loadedItemIDs={},this.tmp.citation_errors=[],this.registry.return_data={bibchange:!1},this.setCitationId(e);var E,B,_;if(n===u.PREVIEW){this.debug&&u.debug("****** start state save *********"),E=this.registry.citationreg.citationByIndex.slice(),B=this.registry.reflist.slice();for(var S=t.concat(i),T={},D=[],l=0,c=S.length;l<c;l+=1)for(r=this.registry.citationreg.citationById[S[l][0]],f=0,p=r.citationItems.length;f<p;f+=1)T[r.citationItems[f].id]=!0,D.push(""+r.citationItems[f].id);for(f=0,p=e.citationItems.length;f<p;f+=1)T[e.citationItems[f].id]=!0,D.push(""+e.citationItems[f].id);_={};for(var l=0,c=B.length;l<c;l+=1)if(!T[B[l].id]){var H=this.registry.registry[B[l].id].ambig,V=this.registry.ambigcites[H];if(V)for(f=0,p=V.length;f<p;f+=1)_[V[f]]=u.cloneAmbigConfig(this.registry.registry[V[f]].disambig)}this.debug&&u.debug("****** end state save *********")}this.tmp.taintedCitationIDs={};for(var M=[],$={},l=0,c=e.citationItems.length;l<c;l+=1){g={};for(var b in e.citationItems[l])g[b]=e.citationItems[l][b];if(y=this.retrieveItem(""+g.id),y.id&&this.transform.loadAbbreviation("default","hereinafter",y.id,y.language),g=u.parseLocator.call(this,g),this.opt.development_extensions.consolidate_legal_items&&this.remapSectionVariable([[y,g]]),this.opt.development_extensions.locator_label_parse&&g.locator&&["bill","gazette","legislation","regulation","treaty"].indexOf(y.type)===-1&&(!g.label||g.label==="page")){var w=u.LOCATOR_LABELS_REGEXP.exec(g.locator);if(w){var P=u.LOCATOR_LABELS_MAP[w[2]];this.getTerm(P)&&(g.label=P,g.locator=w[3])}}var W=[y,g];M.push(W),e.citationItems[l].item=y}e.sortedItems=M;var L=[],Q={},j;for(l=0,c=t.length;l<c;l+=1)a=t[l],this.opt.development_extensions.strict_inputs&&(Q[a[0]]&&u.error("Previously referenced citationID "+a[0]+" encountered in citationsPre"),a[1]&&(j>a[1]&&u.debug("Note index sequence is not sane at citationsPre["+l+"]"),j=a[1])),this.registry.citationreg.citationById[a[0]].properties.noteIndex=a[1],L.push(this.registry.citationreg.citationById[a[0]]),Q[a[0]]=this.registry.citationreg.citationById[a[0]];for(e.properties||(e.properties={noteIndex:0}),this.opt.development_extensions.strict_inputs&&(Q[e.citationID]&&u.error("Citation with previously referenced citationID "+e.citationID),e.properties.noteIndex&&(j>e.properties.noteIndex&&u.debug("Note index sequence is not sane for citation "+e.citationID),j=e.properties.noteIndex)),L.push(e),Q[e.citationID]=e,l=0,c=i.length;l<c;l+=1)o=i[l],this.opt.development_extensions.strict_inputs&&(Q[o[0]]&&u.error("Previously referenced citationID "+o[0]+" encountered in citationsPost"),o[1]&&(j>o[1]&&u.debug("Note index sequence is not sane at postCitation["+l+"]"),j=o[1])),this.registry.citationreg.citationById[o[0]].properties.noteIndex=o[1],L.push(this.registry.citationreg.citationById[o[0]]),Q[o[0]]=this.registry.citationreg.citationById[o[0]];this.registry.citationreg.citationByIndex=L,this.registry.citationreg.citationById=Q,this.registry.citationreg.citationsByItemId={},this.opt.update_mode===u.POSITION&&(k=[],x=[],C={});for(var O=[],l=0,c=L.length;l<c;l+=1){for(L[l].properties.index=l,f=0,p=L[l].sortedItems.length;f<p;f+=1)g=L[l].sortedItems[f],this.registry.citationreg.citationsByItemId[g[1].id]||(this.registry.citationreg.citationsByItemId[g[1].id]=[],O.push(""+g[1].id)),this.registry.citationreg.citationsByItemId[g[1].id].indexOf(L[l])===-1&&this.registry.citationreg.citationsByItemId[g[1].id].push(L[l]);this.opt.update_mode===u.POSITION&&(L[l].properties.noteIndex?x.push(L[l]):(L[l].properties.noteIndex=0,k.push(L[l])))}if(n!==u.ASSUME_ALL_ITEMS_REGISTERED&&(this.debug&&u.debug("****** start update items *********"),this.updateItems(O,null,null,!0),this.debug&&u.debug("****** endo update items *********")),!this.opt.citation_number_sort&&M&&M.length>1&&this.citation_sort.tokens.length>0){for(var l=0,c=M.length;l<c;l+=1)M[l][1].sortkeys=u.getSortKeys.call(this,M[l][0],"citation_sort");if(this.opt.grouped_sort&&!e.properties.unsorted){for(var l=0,c=M.length;l<c;l+=1){var R=M[l][1].sortkeys;this.tmp.authorstring_request=!0;var U=this.registry.registry[M[l][0].id].disambig;this.tmp.authorstring_request=!0,u.getAmbiguousCite.call(this,M[l][0],U);var oe=this.registry.authorstrings[M[l][0].id];this.tmp.authorstring_request=!1,M[l][1].sortkeys=[oe].concat(R)}M.sort(this.citation.srt.compareCompositeKeys);for(var ie=!1,ee=!1,te=!1,l=0,c=M.length;l<c;l+=1)M[l][1].sortkeys[0]!==ie&&(te=M[l][1].sortkeys[0],ee=M[l][1].sortkeys[1]),M[l][1].sortkeys[0]=""+ee+l,ie=te}e.properties.unsorted||M.sort(this.citation.srt.compareCompositeKeys)}this.opt.parallel.enable&&this.parallel.StartCitation(e.sortedItems);var X;if(this.opt.update_mode===u.POSITION)for(var l=0;l<2;l+=1){var F={},q={},ne={};for(X=[k,x][l],f=0,p=X.length;f<p;f+=1){var se=X[f];for(X[f].properties.noteIndex||(X[f].properties.noteIndex=0),X[f].properties.noteIndex=parseInt(X[f].properties.noteIndex,10),f>0&&se.properties.noteIndex&&X[f-1].properties.noteIndex>se.properties.noteIndex&&(C={},F={},q={},ne={}),m=0,d=se.sortedItems.length;m<d;m+=1)se.sortedItems[m][1].parallel&&se.sortedItems[m][1].parallel!=="first"||(C[se.properties.noteIndex]?C[se.properties.noteIndex]+=1:C[se.properties.noteIndex]=1);for(m=0,d=X[f].sortedItems.length;m<d;m+=1){g=X[f].sortedItems[m];var Se=g[0].id,Ae=g[0].legislation_id?g[0].legislation_id:g[0].id,fe=g[0].legislation_id?g[0].legislation_id:g[0].container_id?g[0].container_id:g[0].id,ke=g[1]["locator-extra"],G=g[1].locator,yt=g[1].label,we,At;if(m>0)if(se.sortedItems[m-1][0].legislation_id)we=se.sortedItems[m-1][0].legislation_id;else{we=se.sortedItems[m-1][1].id,At=se.sortedItems[m-1][1]["locator-extra"];for(var K=m-2;K>-1;K--)se.sortedItems[K][1].parallel==="first"&&(we=se.sortedItems[K][1].id,At=se.sortedItems[K][1]["locator-extra"])}if(n===u.PREVIEW&&se.citationID!=e.citationID){typeof F[g[1].id]>"u"&&(F[Ae]=se.properties.noteIndex),q[fe]=se.properties.noteIndex;continue}var I={};if(I.position=g[1].position,I["first-reference-note-number"]=g[1]["first-reference-note-number"],I["first-container-reference-note-number"]=g[1]["first-container-reference-note-number"],I["near-note"]=g[1]["near-note"],g[1]["first-reference-note-number"]=0,g[1]["first-container-reference-note-number"]=0,g[1]["near-note"]=!1,this.registry.citationreg.citationsByItemId[Se]&&this.opt.xclass==="note"&&this.opt.has_disambiguate){var J=this.registry.registry[g[0].id]["citation-count"],ze=this.registry.citationreg.citationsByItemId[Se].length;if(this.registry.registry[g[0].id]["citation-count"]=this.registry.citationreg.citationsByItemId[Se].length,typeof J=="number"){var Ue=J<2,qe=ze<2;if(Ue!==qe)for(var K=0,Ht=this.registry.citationreg.citationsByItemId[Se].length;K<Ht;K++)$[this.registry.registry[g[0].id].ambig]=!0,this.tmp.taintedCitationIDs[this.registry.citationreg.citationsByItemId[Se][K].citationID]=!0}else for(var K=0,Ht=this.registry.citationreg.citationsByItemId[Se].length;K<Ht;K++)$[this.registry.registry[g[0].id].ambig]=!0,this.tmp.taintedCitationIDs[this.registry.citationreg.citationsByItemId[Se][K].citationID]=!0}var pt,dt;if(typeof q[fe]>"u"&&se.properties.mode!=="author-only")F[Ae]=se.properties.noteIndex,q[fe]=se.properties.noteIndex,ne[fe]=se.properties.noteIndex,g[1].position=u.POSITION_FIRST;else{var Ot=!1,ri=!1,Xe=null;if(f>0)var Xe=X[f-1];var Si=X[f];if(f>0){var dn=1;Xe.properties.mode==="author-only"&&f>1&&(dn=2);var mn=f-dn;X[mn].sortedItems.length&&(pt=X[mn].sortedItems.slice(-1)[0][1].id,dt=X[f-dn].sortedItems.slice(-1)[0][1]["locator-extra"]),Xe.sortedItems.length&&Xe.sortedItems[0].slice(-1)[0].legislation_id&&(pt=Xe.sortedItems[0].slice(-1)[0].legislation_id)}if(f>0&&m===0&&Xe.properties.noteIndex!==Si.properties.noteIndex){var Ci=!1,ai=Xe.sortedItems[0][0].id;if(Xe.sortedItems[0][0].legislation_id&&(ai=Xe.sortedItems[0][0].legislation_id),ai==Ae&&Xe.properties.noteIndex>=Si.properties.noteIndex-1){var Wa=Xe.sortedItems[0][1]["locator-extra"],jt=Si.sortedItems[0][1]["locator-extra"];(C[Xe.properties.noteIndex]===1||Xe.properties.noteIndex===0)&&Wa===jt&&(Ci=!0)}Ci?Ot=!0:ri=!0}else m>0&&we==Ae&&At==ke||m===0&&f>0&&Xe.properties.noteIndex==Si.properties.noteIndex&&Xe.sortedItems.length&&pt==Ae&&dt==ke?Ot=!0:ri=!0;var mt,Tt,hn,Mt,Ei;Ot&&(m>0?mt=se.sortedItems[m-1][1]:mt=X[f-1].sortedItems[0][1],mt.locator?(mt.label?hn=mt.label:hn="",Tt=""+mt.locator+hn):Tt=mt.locator,G?(yt?Ei=yt:Ei="",Mt=""+G+Ei):Mt=G),Ot&&Tt&&!Mt&&(Ot=!1,ri=!0),Ot&&(!Tt&&Mt?g[1].position=u.POSITION_IBID_WITH_LOCATOR:!Tt&&!Mt||Tt&&Mt===Tt?g[1].position=u.POSITION_IBID:Tt&&Mt&&Mt!==Tt?g[1].position=u.POSITION_IBID_WITH_LOCATOR:(Ot=!1,ri=!0)),ri&&(g[1].position=u.POSITION_CONTAINER_SUBSEQUENT,typeof F[Ae]>"u"?F[Ae]=se.properties.noteIndex:g[1].position=u.POSITION_SUBSEQUENT),(ri||Ot)&&(se.properties.mode==="author-only"&&(g[1].position=u.POSITION_FIRST),ne[fe]!=se.properties.noteIndex&&(g[1]["first-container-reference-note-number"]=ne[fe],this.registry.registry[g[0].id]&&(this.registry.registry[g[0].id]["first-container-reference-note-number"]=ne[fe])),F[Ae]!=se.properties.noteIndex&&(g[1]["first-reference-note-number"]=F[Ae],this.registry.registry[g[0].id]&&(this.registry.registry[g[0].id]["first-reference-note-number"]=F[Ae])))}if(se.properties.noteIndex){var Ga=parseInt(se.properties.noteIndex,10)-parseInt(q[fe],10);g[1].position!==u.POSITION_FIRST&&Ga<=this.citation.opt["near-note-distance"]&&(g[1]["near-note"]=!0),q[fe]=se.properties.noteIndex}else g[1].position!==u.POSITION_FIRST&&(g[1]["near-note"]=!0);if(se.citationID!=e.citationID)for(h=0,v=u.POSITION_TEST_VARS.length;h<v;h+=1){var qt=u.POSITION_TEST_VARS[h];g[1][qt]!==I[qt]&&(this.registry.registry[g[0].id]&&qt==="first-reference-note-number"&&($[this.registry.registry[g[0].id].ambig]=!0,this.tmp.taintedItemIDs[g[0].id]=!0),this.tmp.taintedCitationIDs[se.citationID]=!0)}this.sys.variableWrapper&&(g[1].index=se.properties.index,g[1].noteIndex=se.properties.noteIndex)}}}if(this.opt.citation_number_sort&&M&&M.length>1&&this.citation_sort.tokens.length>0&&!e.properties.unsorted){for(var l=0,c=M.length;l<c;l+=1)M[l][1].sortkeys=u.getSortKeys.call(this,M[l][0],"citation_sort");M.sort(this.citation.srt.compareCompositeKeys)}for(var b in this.tmp.taintedItemIDs)if(this.tmp.taintedItemIDs.hasOwnProperty(b)&&(X=this.registry.citationreg.citationsByItemId[b],X))for(var l=0,c=X.length;l<c;l+=1)this.tmp.taintedCitationIDs[X[l].citationID]=!0;var oi=[];if(n===u.PREVIEW){this.debug&&u.debug("****** start run processor *********");try{oi=this.process_CitationCluster.call(this,e.sortedItems,e)}catch(li){u.error("Error running CSL processor for preview: "+li)}this.debug&&(u.debug("****** end run processor *********"),u.debug("****** start state restore *********")),this.registry.citationreg.citationByIndex=E,this.registry.citationreg.citationById={};for(var l=0,c=E.length;l<c;l+=1)this.registry.citationreg.citationById[E[l].citationID]=E[l];this.debug&&u.debug("****** start final update *********");for(var zt=[],l=0,c=B.length;l<c;l+=1)zt.push(""+B[l].id);this.updateItems(zt,null,null,!0),this.debug&&u.debug("****** end final update *********");for(var b in _)_.hasOwnProperty(b)&&(this.registry.registry[b].disambig=_[b]);this.debug&&u.debug("****** end state restore *********")}else{for(var si in $)this.disambiguate.run(si,e);var st;for(var b in this.tmp.taintedCitationIDs)if(b!=e.citationID){var lt=this.registry.citationreg.citationById[b];if(!lt.properties.unsorted){for(var l=0,c=lt.sortedItems.length;l<c;l+=1)lt.sortedItems[l][1].sortkeys=u.getSortKeys.call(this,lt.sortedItems[l][0],"citation_sort");lt.sortedItems.sort(this.citation.srt.compareCompositeKeys)}this.tmp.citation_pos=lt.properties.index,this.tmp.citation_note_index=lt.properties.noteIndex,this.tmp.citation_id=""+lt.citationID,st=[],st.push(lt.properties.index),st.push(this.process_CitationCluster.call(this,lt.sortedItems,lt)),st.push(lt.citationID),oi.push(st)}this.tmp.taintedItemIDs={},this.tmp.taintedCitationIDs={},this.tmp.citation_pos=e.properties.index,this.tmp.citation_note_index=e.properties.noteIndex,this.tmp.citation_id=""+e.citationID,st=[],st.push(t.length),st.push(this.process_CitationCluster.call(this,M,e)),st.push(e.citationID),oi.push(st),oi.sort(function(li,Yn){return li[0]>Yn[0]?1:li[0]<Yn[0]?-1:0})}return this.registry.return_data.citation_errors=this.tmp.citation_errors.slice(),[this.registry.return_data,oi]};u.Engine.prototype.process_CitationCluster=function(e,t){var i="";if(t&&t.properties&&t.properties.mode==="composite"){t.properties.mode="author-only";var n=u.getCitationCluster.call(this,e,t);t.properties.mode="suppress-author";var r="";t.properties.infix&&(this.output.append(t.properties.infix),r=this.output.string(this,this.output.queue),typeof r=="object"&&(r=r.join("")));var a=u.getCitationCluster.call(this,e,t);t.properties.mode="composite",n&&r&&u.SWAPPING_PUNCTUATION.concat(["’","'"]).indexOf(r[0])>-1&&(n+=r,r=!1),i=[n,r,a].filter(function(o){return o}).join(" ")}else i=u.getCitationCluster.call(this,e,t);return i};u.Engine.prototype.makeCitationCluster=function(e){var t,i,p,n,r,a,o;for(t=[],r=e.length,n=0;n<r;n+=1){a={};for(var l in e[n])a[l]=e[n][l];if(o=this.retrieveItem(""+a.id),this.opt.development_extensions.locator_label_parse&&a.locator&&["bill","gazette","legislation","regulation","treaty"].indexOf(o.type)===-1&&(!a.label||a.label==="page")){var c=u.LOCATOR_LABELS_REGEXP.exec(a.locator);if(c){var f=u.LOCATOR_LABELS_MAP[c[2]];this.getTerm(f)&&(a.label=f,a.locator=c[3])}}a.locator&&(a.locator=(""+a.locator).replace(/\s+$/,"")),i=[o,a],t.push(i)}if(this.opt.development_extensions.consolidate_legal_items&&this.remapSectionVariable(t),t&&t.length>1&&this.citation_sort.tokens.length>0){for(r=t.length,n=0;n<r;n+=1)t[n][1].sortkeys=u.getSortKeys.call(this,t[n][0],"citation_sort");t.sort(this.citation.srt.compareCompositeKeys)}this.tmp.citation_errors=[];var p=u.getCitationCluster.call(this,t);return p};u.getAmbiguousCite=function(e,t,i,n){var d,r=this.tmp.group_context.tip,a={term_intended:r.term_intended,variable_attempt:r.variable_attempt,variable_success:r.variable_success,output_tip:r.output_tip,label_form:r.label_form,non_parallel:r.non_parallel,parallel_last:r.parallel_last,parallel_first:r.parallel_first,parallel_last_override:r.parallel_last_override,parallel_delimiter_override:r.parallel_delimiter_override,parallel_delimiter_override_on_suppress:r.parallel_delimiter_override_on_suppress,condition:r.condition,force_suppress:r.force_suppress,done_vars:r.done_vars.slice()};t?this.tmp.disambig_request=t:this.tmp.disambig_request=!1;var o={position:u.POSITION_SUBSEQUENT,"near-note":!0};n&&(o.locator=n.locator,o.label=n.label),this.registry.registry[e.id]&&this.registry.citationreg.citationsByItemId&&this.registry.citationreg.citationsByItemId[e.id]&&this.registry.citationreg.citationsByItemId[e.id].length&&i&&this.citation.opt["givenname-disambiguation-rule"]==="by-cite"&&(o["first-reference-note-number"]=this.registry.registry[e.id]["first-reference-note-number"]),this.tmp.area="citation",this.tmp.root="citation";var l=this.tmp.suppress_decorations;this.tmp.suppress_decorations=!0,this.tmp.just_looking=!0,u.getCite.call(this,e,o,null,!1);for(var c=0,f=this.output.queue.length;c<f;c+=1)u.Output.Queue.purgeEmptyBlobs(this.output.queue[c]);if(this.opt.development_extensions.clean_up_csl_flaws)for(var p=0,m=this.output.queue.length;p<m;p+=1)this.output.adjust.upward(this.output.queue[p]),this.output.adjust.leftward(this.output.queue[p]),this.output.adjust.downward(this.output.queue[p]),this.output.adjust.fix(this.output.queue[p]);var d=this.output.string(this,this.output.queue);return this.tmp.just_looking=!1,this.tmp.suppress_decorations=l,this.tmp.group_context.replace(a),d};u.getSpliceDelimiter=function(e,t,i){if(this.citation.opt["after-collapse-delimiter"]!==void 0)e?this.tmp.splice_delimiter=this.citation.opt["after-collapse-delimiter"]:t&&!this.tmp.have_collapsed?this.tmp.splice_delimiter=this.citation.opt["after-collapse-delimiter"]:!t&&!this.tmp.have_collapsed&&this.citation.opt.collapse!=="year-suffix"?this.tmp.splice_delimiter=this.citation.opt["after-collapse-delimiter"]:this.tmp.splice_delimiter=this.citation.opt.layout_delimiter;else if(this.tmp.use_cite_group_delimiter)this.tmp.splice_delimiter=this.citation.opt.cite_group_delimiter;else if(this.tmp.have_collapsed&&this.opt.xclass==="in-text"&&this.opt.update_mode!==u.NUMERIC)this.tmp.splice_delimiter=", ";else if(this.tmp.cite_locales[i-1]){var n=this.tmp.cite_affixes[this.tmp.area][this.tmp.cite_locales[i-1]];n&&n.delimiter&&(this.tmp.splice_delimiter=n.delimiter)}else this.tmp.splice_delimiter||(this.tmp.splice_delimiter="");return this.tmp.splice_delimiter};u.getCitationCluster=function(e,t){var i,n,r,a,o,l,c,f,p,m,d,h,v,b,y,g,x,k,w,C,E,B="";this.output.checkNestedBrace=new u.checkNestedBrace(this),t&&(w=t.citationID,C=t.properties.mode==="author-only"?!!t.properties.mode:!1,this.opt.xclass!=="note"&&(E=t.properties.mode==="suppress-author"?!!t.properties.mode:!1),t.properties.prefix&&(B=u.checkPrefixSpaceAppend(this,t.properties.prefix))),e=e||[],this.tmp.last_primary_names_string=!1,x=u.getSafeEscape(this),this.tmp.area="citation",this.tmp.root="citation",i="",n=[],this.tmp.last_suffix_used="",this.tmp.last_names_used=[],this.tmp.last_years_used=[],this.tmp.backref_index=[],this.tmp.cite_locales=[],this.tmp.just_looking||(this.tmp.abbrev_trimmer={QUASHES:{}});var _=this.output.checkNestedBrace.update(this.citation.opt.layout_prefix+B),S=!1;if(this.citation.opt.suppressTrailingPunctuation&&(S=!0),w&&this.registry.citationreg.citationById[w].properties["suppress-trailing-punctuation"]&&(S=!0),this.opt.xclass==="note"){for(var T=[],D=!1,H=!1,V=[],M=0,$=e.length;M<$;M+=1){var P=e[M][0].type,W=e[M][0].title,L=e[M][1].position,Q=e[M][0].id;W&&P==="legal_case"&&Q!==H&&L&&((W!==D||T.length===0)&&(V=[],T.push(V)),V.push(e[M][1])),D=W,H=Q}for(M=0,$=T.length;M<$;M+=1)if(V=T[M],!(V.length<2)){var j=V.slice(-1)[0].locator;if(j)for(var O=0,R=V.length-1;O<R;O+=1)V[O].locator&&(j=!1);j&&(V[0].locator=j,delete V.slice(-1)[0].locator,V[0].label=V.slice(-1)[0].label,V.slice(-1)[0].label&&delete V.slice(-1)[0].label)}}for(r=[],a=e.length,e[0]&&e[0][1]&&(C?(delete e[0][1]["suppress-author"],e[0][1]["author-only"]=!0):E&&(delete e[0][1]["author-only"],e[0][1]["suppress-author"]=!0)),this.opt.parallel.enable&&this.parallel.StartCitation(e),o=0;o<a;o+=1){this.tmp.cite_index=o,h=e[o][0],l=e[o][1],l=u.parseLocator.call(this,l),c=this.tmp.have_collapsed;var U=!1;if(o>0&&e[o-1][1]&&(U=!!e[o-1][1].locator),f={},this.tmp.shadow_numbers={},!this.tmp.just_looking&&this.opt.hasPlaceholderTerm){var oe=this.output;this.output=new u.Output.Queue(this),this.output.adjust=new u.Output.Queue.adjust,u.getAmbiguousCite.call(this,h,null,!1,l),this.output=oe}if(this.tmp.in_cite_predecessor=!1,o>0?u.getCite.call(this,h,l,""+e[o-1][0].id,!0):(this.tmp.term_predecessor=!1,u.getCite.call(this,h,l,null,!0)),this.tmp.cite_renders_content||(k={citationID:""+this.tmp.citation_id,index:this.tmp.citation_pos,noteIndex:this.tmp.citation_note_index,itemID:""+h.id,citationItems_pos:o,error_code:u.ERROR_NO_RENDERED_FORM},this.tmp.citation_errors.push(k)),f.splice_delimiter=u.getSpliceDelimiter.call(this,U,c,o),l&&l["author-only"]&&(this.tmp.suppress_decorations=!0),o>0){g=e[o-1][1];var ie=g.suffix&&[";",".",","].indexOf(g.suffix.slice(-1))>-1,ee=!g.suffix&&l.prefix&&[";",".",","].indexOf(l.prefix.slice(0,1))>-1;if(ie||ee){var te=f.splice_delimiter.indexOf(" ");te>-1&&!ee?f.splice_delimiter=f.splice_delimiter.slice(te):f.splice_delimiter=""}}if(f.suppress_decorations=this.tmp.suppress_decorations,f.have_collapsed=this.tmp.have_collapsed,r.push(f),l["author-only"])break}d=this.output.queue.slice();var X="";t&&(X=u.checkSuffixSpacePrepend(this,t.properties.suffix));var F=this.citation.opt.layout_suffix,q=this.tmp.cite_locales[this.tmp.cite_locales.length-1];q&&this.tmp.cite_affixes[this.tmp.area][q]&&this.tmp.cite_affixes[this.tmp.area][q].suffix&&(F=this.tmp.cite_affixes[this.tmp.area][q].suffix),u.TERMINAL_PUNCTUATION.slice(0,-1).indexOf(F.slice(0,1))>-1&&(F=F.slice(0,1)),F=this.output.checkNestedBrace.update(X+F);for(var M=0,$=this.output.queue.length;M<$;M+=1)u.Output.Queue.purgeEmptyBlobs(this.output.queue[M]);if(!this.tmp.suppress_decorations&&this.output.queue.length&&(this.opt.development_extensions.apply_citation_wrapper&&this.sys.wrapCitationEntry&&!this.tmp.just_looking&&this.tmp.area==="citation"||(S||(this.output.queue[this.output.queue.length-1].strings.suffix=F),this.output.queue[0].strings.prefix=_)),this.opt.development_extensions.clean_up_csl_flaws)for(var O=0,R=this.output.queue.length;O<R;O+=1)this.output.adjust.upward(this.output.queue[O]),this.output.adjust.leftward(this.output.queue[O]),this.output.adjust.downward(this.output.queue[O]),this.tmp.last_chr=this.output.adjust.fix(this.output.queue[O]);for(o=0,a=d.length;o<a;o+=1){var ne=[];if(this.output.queue=[d[o]],this.tmp.suppress_decorations=r[o].suppress_decorations,this.tmp.splice_delimiter=r[o].splice_delimiter,d[o].parallel_delimiter&&(this.tmp.splice_delimiter=d[o].parallel_delimiter),this.tmp.have_collapsed=r[o].have_collapsed,p=this.output.string(this,this.output.queue),this.tmp.suppress_decorations=!1,typeof p=="string")return this.tmp.suppress_decorations=!1,p||(this.opt.development_extensions.throw_on_empty?u.error("Citation would render no content"):p="[NO_PRINTED_FORM]"),p;if(typeof p=="object"&&p.length===0&&!l["suppress-author"]){if(o===0){var se="[CSL STYLE ERROR: reference with no printed form.]",Se=o===0?x(this.citation.opt.layout_prefix):"",Ae=o===d.length-1?x(this.citation.opt.layout_suffix):"";p.push(Se+se+Ae)}else if(o===d.length-1){var fe=n[n.length-1];typeof fe=="string"?n[n.length-1]+=x(this.citation.opt.layout_suffix):typeof fe=="object"&&(fe.strings.suffix+=x(this.citation.opt.layout_suffix))}}if(ne.length&&typeof p[0]=="string"){p.reverse();var ke=p.pop();ke&&ke.slice(0,1)===","?ne.push(ke):typeof ne.slice(-1)[0]=="string"&&ne.slice(-1)[0].slice(-1)===","?ne.push(" "+ke):ke&&ne.push(x(this.tmp.splice_delimiter)+ke)}else p.reverse(),m=p.pop(),typeof m<"u"&&(ne.length&&typeof ne[ne.length-1]=="string"&&(ne[ne.length-1]+=m.successor_prefix),ne.push(m));for(v=p.length,b=0;b<v;b+=1){if(y=p[b],typeof y=="string"){ne.push(x(this.tmp.splice_delimiter)+y);continue}m=p.pop(),typeof m<"u"&&ne.push(m)}ne.length===0&&e[o][1]["suppress-author"],ne.length>1&&typeof ne[0]!="string"&&(ne=[this.output.renderBlobs(ne)]),ne.length&&(typeof ne[0]=="string"?o>0&&(ne[0]=x(this.tmp.splice_delimiter)+ne[0]):o>0?ne[0].splice_prefix=this.tmp.splice_delimiter:ne[0].splice_prefix=""),n=n.concat(ne)}if(i+=this.output.renderBlobs(n),i&&!this.tmp.suppress_decorations)for(a=this.citation.opt.layout_decorations.length,o=0;o<a;o+=1)f=this.citation.opt.layout_decorations[o],f[1]!=="normal"&&(!l||!l["author-only"])&&(i=this.fun.decorate[f[0]][f[1]](this,i));return this.tmp.suppress_decorations=!1,i||(this.opt.development_extensions.throw_on_empty?u.error("Citation would render no content"):i="[NO_PRINTED_FORM]"),i};u.getCite=function(e,t,i,n){var r,a,o=this.tmp.area;for(t&&t["author-only"]&&this.intext&&this.intext.tokens.length>0&&(this.tmp.area="intext"),this.tmp.cite_renders_content=!1,this.tmp.probably_rendered_something=!1,this.tmp.prevItemID=i,u.citeStart.call(this,e,t,n),r=0,this.tmp.name_node={},this.nameOutput=new u.NameOutput(this,e,t);r<this[this.tmp.area].tokens.length;)r=u.tokenExec.call(this,this[this.tmp.area].tokens[r],e,t);return u.citeEnd.call(this,e,t),!this.tmp.cite_renders_content&&!this.tmp.just_looking&&this.tmp.area==="bibliography"&&(a={index:this.tmp.bibliography_pos,itemID:""+e.id,error_code:u.ERROR_NO_RENDERED_FORM},this.tmp.bibliography_errors.push(a)),this.tmp.area=o,""+e.id};u.citeStart=function(e,t,i){if(this.tmp.lang_array=[],e.language){var n=e.language.match(/^([a-zA-Z]+).*/);n&&this.tmp.lang_array.push(n[1].toLowerCase())}if(this.tmp.lang_array.push(this.opt.lang),i||(this.tmp.shadow_numbers={}),this.tmp.disambiguate_count=0,this.tmp.disambiguate_maxMax=0,this.tmp.same_author_as_previous_cite=!1,this.tmp.suppress_decorations?this.tmp.subsequent_author_substitute_ok=!1:this.tmp.subsequent_author_substitute_ok=!0,this.tmp.lastchr="",this.tmp.area==="citation"&&this.citation.opt.collapse&&this.citation.opt.collapse.length?this.tmp.have_collapsed=!0:this.tmp.have_collapsed=!1,this.tmp.render_seen=!1,this.tmp.disambig_request&&!this.tmp.disambig_override?this.tmp.disambig_settings=this.tmp.disambig_request:this.registry.registry[e.id]&&!this.tmp.disambig_override?(this.tmp.disambig_request=this.registry.registry[e.id].disambig,this.tmp.disambig_settings=this.registry.registry[e.id].disambig):this.tmp.disambig_settings=new u.AmbigConfig,this.tmp.area!=="citation"){if(!this.registry.registry[e.id])this.tmp.disambig_restore=new u.AmbigConfig;else if(this.tmp.disambig_restore=u.cloneAmbigConfig(this.registry.registry[e.id].disambig),this.tmp.area==="bibliography"&&this.tmp.disambig_settings&&this.tmp.disambig_override&&(this.opt["disambiguate-add-names"]&&(this.tmp.disambig_settings.names=this.registry.registry[e.id].disambig.names.slice(),this.tmp.disambig_request&&(this.tmp.disambig_request.names=this.registry.registry[e.id].disambig.names.slice())),this.opt["disambiguate-add-givenname"])){this.tmp.disambig_request=this.tmp.disambig_settings,this.tmp.disambig_settings.givens=this.registry.registry[e.id].disambig.givens.slice(),this.tmp.disambig_request.givens=this.registry.registry[e.id].disambig.givens.slice();for(var r=0,a=this.tmp.disambig_settings.givens.length;r<a;r+=1)this.tmp.disambig_settings.givens[r]=this.registry.registry[e.id].disambig.givens[r].slice();for(var r=0,a=this.tmp.disambig_request.givens.length;r<a;r+=1)this.tmp.disambig_request.givens[r]=this.registry.registry[e.id].disambig.givens[r].slice()}}this.tmp.names_used=[],this.tmp.nameset_counter=0,this.tmp.years_used=[],this.tmp.names_max.clear(),this.tmp.just_looking||(!t||t.parallel==="first"||!t.parallel)&&(this.tmp.abbrev_trimmer={QUASHES:{}}),this.tmp.splice_delimiter=this[this.tmp.area].opt.layout_delimiter,this.bibliography_sort.keys=[],this.citation_sort.keys=[],this.tmp.has_done_year_suffix=!1,this.tmp.last_cite_locale=!1,!this.tmp.just_looking&&t&&!t.position&&this.registry.registry[e.id]&&(this.tmp.disambig_restore=u.cloneAmbigConfig(this.registry.registry[e.id].disambig)),this.tmp.first_name_string=!1,this.tmp.authority_stop_last=0};u.citeEnd=function(e,t){if(this.tmp.disambig_restore&&this.registry.registry[e.id]){this.registry.registry[e.id].disambig.names=this.tmp.disambig_restore.names.slice(),this.registry.registry[e.id].disambig.givens=this.tmp.disambig_restore.givens.slice();for(var i=0,n=this.registry.registry[e.id].disambig.givens.length;i<n;i+=1)this.registry.registry[e.id].disambig.givens[i]=this.tmp.disambig_restore.givens[i].slice()}if(this.tmp.disambig_restore=!1,t&&t.suffix?this.tmp.last_suffix_used=t.suffix:this.tmp.last_suffix_used="",this.tmp.last_years_used=this.tmp.years_used.slice(),this.tmp.last_names_used=this.tmp.names_used.slice(),this.tmp.cut_var=!1,this.tmp.disambig_request=!1,this.tmp.cite_locales.push(this.tmp.last_cite_locale),this.tmp.issued_date&&this.tmp.renders_collection_number){for(var r=[],i=this.tmp.issued_date.list.length-1;i>this.tmp.issued_date.pos;i+=-1)r.push(this.tmp.issued_date.list.pop());for(this.tmp.issued_date.list.pop(),i=r.length-1;i>-1;i+=-1)this.tmp.issued_date.list.push(r.pop())}this.tmp.issued_date=!1,this.tmp.renders_collection_number=!1};u.Engine.prototype.makeBibliography=function(e){var t,i,n,r,a,o,l,c,f;if(t=!1,!e&&(this.bibliography.opt.exclude_types||this.bibliography.opt.exclude_with_fields)){if(e={exclude:[]},this.bibliography.opt.exclude_types)for(var p in this.bibliography.opt.exclude_types){var m=this.bibliography.opt.exclude_types[p];e.exclude.push({field:"type",value:m})}if(this.bibliography.opt.exclude_with_fields)for(var p in this.bibliography.opt.exclude_with_fields){var d=this.bibliography.opt.exclude_with_fields[p];e.exclude.push({field:d,value:!0})}}if(!this.bibliography.tokens.length)return!1;if(typeof e=="string"&&(this.opt.citation_number_slug=e,e=!1),t){for(a=this.bibliography.tokens.length,o=0;o<a;o+=1)l=this.bibliography.tokens[o],u.debug("bibtok: "+l.name);for(u.debug("---"),a=this.citation.tokens.length,o=0;o<a;o+=1)this.citation.tokens[o],u.debug("cittok: "+l.name);for(u.debug("---"),a=this.bibliography_sort.tokens.length,o=0;o<a;o+=1)this.bibliography_sort.tokens[o],u.debug("bibsorttok: "+l.name)}i=u.getBibliographyEntries.call(this,e),c=i[0],f=i[1];var h=i[2];for(n={maxoffset:0,entryspacing:this.bibliography.opt["entry-spacing"],linespacing:this.bibliography.opt["line-spacing"],"second-field-align":!1,entry_ids:c,bibliography_errors:this.tmp.bibliography_errors.slice(),done:h},this.bibliography.opt["second-field-align"]&&(n["second-field-align"]=this.bibliography.opt["second-field-align"]),a=this.registry.reflist.length,o=0;o<a;o+=1)r=this.registry.reflist[o],r.offset>n.maxoffset&&(n.maxoffset=r.offset);return this.bibliography.opt.hangingindent&&(n.hangingindent=this.bibliography.opt.hangingindent),n.bibstart=this.fun.decorate.bibstart,n.bibend=this.fun.decorate.bibend,this.opt.citation_number_slug=!1,[n,f]};u.getBibliographyEntries=function(e){var t,i,n,r,a,o,l,c,f,p,m,d,h,v,b,y,g,x,k,w,C;t=[],k=[],this.tmp.area="bibliography",this.tmp.root="bibliography",this.tmp.last_rendered_name=!1,this.tmp.bibliography_errors=[],this.tmp.bibliography_pos=0,e&&e.page_start&&e.page_length?i=this.registry.getSortedIds():i=this.refetchItems(this.registry.getSortedIds()),this.tmp.disambig_override=!0;function E(P,W){return P===W}function B(P,W){for(p=W.length,m=0;m<p;m+=1)if(E(P,W[m]))return!0;return!1}function _(P,W){return typeof P=="boolean"||!P?P?!!W:!W:typeof W=="string"?E(P,W):W?B(P,W):!1}g={};var S;if(e&&e.page_start&&e.page_length&&(S=0,e.page_start!==!0))for(v=0,b=i.length;v<b&&(g[i[v]]=!0,e.page_start!=i[v]);v+=1);var T=[],D={};for(this.tmp.container_item_count={},i=i.filter(P=>{var W=P;return P.legislation_id?D[P.legislation_id]?W=!1:D[P.legislation_id]=!0:P.container_id&&(this.tmp.container_item_count[P.container_id]||(this.tmp.container_item_count[P.container_id]=0),this.tmp.container_item_count[P.container_id]++,this.bibliography.opt.consolidate_containers.indexOf(P.type)>-1&&(D[P.container_id]?W=!1:D[P.container_id]=!0)),W}),this.tmp.container_item_pos={},v=0,b=i.length;v<b;v+=1){if(e&&e.page_start&&e.page_length){if(g[i[v]])continue;if(c=this.refetchItem(i[v]),S===e.page_length)break}else if(c=i[v],g[c.id])continue;if(e){if(n=!0,e.include){for(n=!1,w=0,C=e.include.length;w<C;w+=1)if(f=e.include[w],_(f.value,c[f.field])){n=!0;break}}else if(e.exclude){for(r=!1,w=0,C=e.exclude.length;w<C;w+=1)if(f=e.exclude[w],_(f.value,c[f.field])){r=!0;break}r&&(n=!1)}else if(e.select){for(n=!1,a=!0,w=0,C=e.select.length;w<C;w+=1)f=e.select[w],_(f.value,c[f.field])||(a=!1);a&&(n=!0)}if(e.quash){for(a=!0,w=0,C=e.quash.length;w<C;w+=1)f=e.quash[w],_(f.value,c[f.field])||(a=!1);a&&(n=!1)}if(!n)continue}if(c.container_id&&(this.tmp.container_item_pos[c.container_id]||(this.tmp.container_item_pos[c.container_id]=0),this.tmp.container_item_pos[c.container_id]++),o=new u.Token("group",u.START),o.decorations=[["@bibliography","entry"]].concat(this.bibliography.opt.layout_decorations),this.output.startTag("bib_entry",o),c.system_id&&this.sys.embedBibliographyEntry?this.output.current.value().item_id=c.system_id:this.output.current.value().system_id=c.id,h=[],this.registry.registry[c.id].master&&!(e&&e.page_start&&e.page_length)){x=[[c,{id:c.id}]],y=this.registry.registry[c.id].siblings;for(var w=0,C=y.length;w<C;w++)x.push([this.refetchItem(y[w]),{id:y[w]}]);for(this.parallel.StartCitation(x),this.registry.registry[c.id].parallel_delimiter_override?this.output.queue[0].strings.delimiter=this.registry.registry[c.id].parallel_delimiter_override:this.output.queue[0].strings.delimiter=", ",this.tmp.term_predecessor=!1,this.tmp.cite_index=0,w=0,C=x.length;w<C;w+=1)w<x.length-1?this.tmp.parallel_and_not_last=!0:delete this.tmp.parallel_and_not_last,h.push(""+u.getCite.call(this,x[w][0],x[w][1])),this.tmp.cite_index++,g[x[w][0].id]=!0}else this.registry.registry[c.id].siblings||(this.tmp.term_predecessor=!1,this.tmp.cite_index=0,h.push(""+u.getCite.call(this,c)),e&&e.page_start&&e.page_length&&(S+=1));for(k.push(""),this.tmp.bibliography_pos+=1,T.push(h),this.output.endTag("bib_entry"),this.output.queue[0].blobs.length&&this.output.queue[0].blobs[0].blobs.length&&(this.output.queue[0].blobs[0].blobs[0].strings?d=this.output.queue[0].blobs[0].blobs:d=this.output.queue[0].blobs,d[0].strings.prefix=this.bibliography.opt.layout_prefix+d[0].strings.prefix),w=0,C=this.output.queue.length;w<C;w+=1)u.Output.Queue.purgeEmptyBlobs(this.output.queue[w]);for(w=0,C=this.output.queue.length;w<C;w+=1)this.output.adjust.upward(this.output.queue[w]),this.output.adjust.leftward(this.output.queue[w]),this.output.adjust.downward(this.output.queue[w],!0),this.output.adjust.fix(this.output.queue[w]);if(l=this.output.string(this,this.output.queue)[0],!l&&this.opt.update_mode===u.NUMERIC){var H=t.length+1+". [CSL STYLE ERROR: reference with no printed form.]";l=u.Output.Formats[this.opt.mode]["@bibliography/entry"](this,H)}l&&t.push(l)}var V=!1;if(e&&e.page_start&&e.page_length){var M=i.slice(-1)[0],$=T.slice(-1)[0];(!M||!$||M==$)&&(V=!0)}return this.tmp.disambig_override=!1,[T,t,V]};u.Engine.prototype.setCitationId=function(e,t){var i,n,r;if(i=!1,!e.citationID||t){for(n=Math.floor(Math.random()*1e14);;){if(r=0,this.registry.citationreg.citationById[n])!r&&n<5e13?r=1:r=-1;else{e.citationID="a"+n.toString(32);break}r===1?n+=1:n+=-1}i=""+n}return this.registry.citationreg.citationById[e.citationID]=e,i};u.Engine.prototype.rebuildProcessorState=function(e,t,i){e||(e=[]),t||(t="html");for(var n={},r=[],a=0,o=e.length;a<o;a+=1)for(var l=0,c=e[a].citationItems.length;l<c;l+=1){var f=""+e[a].citationItems[l].id;n[f]||r.push(f),n[f]=!0}this.updateItems(r);var p=[],m=[],d=[],h=this.opt.mode;this.setOutputFormat(t);for(var a=0,o=e.length;a<o;a+=1){var v=this.processCitationCluster(e[a],p,m,u.ASSUME_ALL_ITEMS_REGISTERED);p.push([e[a].citationID,e[a].properties.noteIndex]);for(var l=0,c=v[1].length;l<c;l+=1){var b=v[1][l][0];d[b]=[p[b][0],p[b][1],v[1][l][1]]}}return this.updateUncitedItems(i),this.setOutputFormat(h),d};u.Engine.prototype.restoreProcessorState=function(e){var t,i,n,r,a,o,l,c,f,p;c=[],f=[],e||(e=[]);var m=[],d={};for(t=0,i=e.length;t<i;t+=1)d[e[t].citationID]&&this.setCitationId(e[t],!0),d[e[t].citationID]=!0,m.push(e[t].properties.index);var h=e.slice();for(h.sort(function(b,y){return b.properties.index<y.properties.index?-1:b.properties.index>y.properties.index?1:0}),t=0,i=h.length;t<i;t+=1)h[t].properties.index=t;for(t=0,i=h.length;t<i;t+=1){for(p=[],n=0,r=h[t].citationItems.length;n<r;n+=1)a=h[t].citationItems[n],typeof a.sortkeys>"u"&&(a.sortkeys=[]),o=this.retrieveItem(""+a.id),l=[o,a],p.push(l),h[t].citationItems[n].item=o,f.push(""+a.id);h[t].properties.unsorted||p.sort(this.citation.srt.compareCompositeKeys),h[t].sortedItems=p,this.registry.citationreg.citationById[h[t].citationID]=h[t]}for(this.updateItems(f),t=0,i=e.length;t<i;t+=1)c.push([""+e[t].citationID,e[t].properties.noteIndex]);var v=[];return e&&e.length?v=this.processCitationCluster(e[0],[],c.slice(1)):(this.registry=new u.Registry(this),this.tmp=new u.Engine.Tmp,this.disambiguate=new u.Disambiguation(this)),v};u.Engine.prototype.updateItems=function(e,t,i,n){var r=this.tmp.area,a=this.tmp.root,o=this.tmp.extension;if(this.bibliography_sort.tokens.length===0&&(t=!0),this.tmp.area="citation",this.tmp.root="citation",this.tmp.extension="",n||(this.tmp.loadedItemIDs={}),this.registry.init(e),i)for(var l in this.registry.ambigcites)this.registry.ambigsTouched[l]=!0;return this.registry.dodeletes(this.registry.myhash),this.registry.doinserts(this.registry.mylist),this.registry.dorefreshes(),this.registry.rebuildlist(t),this.registry.setsortkeys(),this.registry.setdisambigs(),this.registry.sorttokens(t),this.registry.renumber(),this.tmp.extension=o,this.tmp.area=r,this.tmp.root=a,this.registry.getSortedIds()};u.Engine.prototype.updateUncitedItems=function(e,t){var i,n=this.tmp.area,r=this.tmp.root,a=this.tmp.extension;if(this.bibliography_sort.tokens.length===0&&(t=!0),this.tmp.area="citation",this.tmp.root="citation",this.tmp.extension="",this.tmp.loadedItemIDs={},e||(e=[]),typeof e=="object"){if(typeof e.length>"u"){i=e,e=[];for(var o in i)e.push(o)}else if(typeof e.length=="number"){i={};for(var l=0,c=e.length;l<c;l+=1)i[e[l]]=!0}}return this.registry.init(e,!0),this.registry.dopurge(i),this.registry.doinserts(this.registry.mylist),this.registry.dorefreshes(),this.registry.rebuildlist(t),this.registry.setsortkeys(),this.registry.setdisambigs(),this.registry.sorttokens(t),this.registry.renumber(),this.tmp.extension=a,this.tmp.area=n,this.tmp.root=r,this.registry.getSortedIds()};u.localeResolve=function(e,t){var i,n;return t||(t="en-US"),e||(e=t),i={},n=e.split(/[\-_]/),i.base=u.LANG_BASES[n[0]],typeof i.base>"u"?{base:t,best:e,bare:n[0]}:(n.length===1&&(i.generic=!0),n.length===1||n[1]==="x"?i.best=i.base.replace("_","-"):i.best=n.slice(0,2).join("-"),i.base=i.base.replace("_","-"),i.bare=n[0],i)};u.Engine.prototype.localeConfigure=function(e,t){var i;if(!(t&&this.locale[e.best])&&(e.best==="en-US"?(i=u.setupXml(this.sys.retrieveLocale("en-US")),this.localeSet(i,"en-US",e.best)):e.best!=="en-US"&&(e.base!==e.best&&(i=u.setupXml(this.sys.retrieveLocale(e.base)),this.localeSet(i,e.base,e.best)),i=u.setupXml(this.sys.retrieveLocale(e.best)),this.localeSet(i,e.best,e.best)),this.localeSet(this.cslXml,"",e.best),this.localeSet(this.cslXml,e.bare,e.best),e.base!==e.best&&this.localeSet(this.cslXml,e.base,e.best),this.localeSet(this.cslXml,e.best,e.best),typeof this.locale[e.best].terms["page-range-delimiter"]>"u"&&(["fr","pt"].indexOf(e.best.slice(0,2).toLowerCase())>-1?this.locale[e.best].terms["page-range-delimiter"]="-":this.locale[e.best].terms["page-range-delimiter"]="–"),typeof this.locale[e.best].terms["year-range-delimiter"]>"u"&&(this.locale[e.best].terms["year-range-delimiter"]="–"),typeof this.locale[e.best].terms["citation-range-delimiter"]>"u"&&(this.locale[e.best].terms["citation-range-delimiter"]="–"),this.opt.development_extensions.normalize_lang_keys_to_lowercase)){for(var n=["default-locale","locale-sort","locale-translit","locale-translat"],r=0,a=n.length;r<a;r+=1)for(var o=0,l=this.opt[n[r]].length;o<l;o+=1)this.opt[n[r]][o]=this.opt[n[r]][o].toLowerCase();this.opt.lang=this.opt.lang.toLowerCase()}};u.Engine.prototype.localeSet=function(e,t,i){var n,r,a,o,l,c,f,p,m,d,h,v,b,y,g,x;if(t=t.replace("_","-"),i=i.replace("_","-"),this.opt.development_extensions.normalize_lang_keys_to_lowercase&&(t=t.toLowerCase(),i=i.toLowerCase()),this.locale[i]||(this.locale[i]={},this.locale[i].terms={},this.locale[i].opts={},this.locale[i].opts["skip-words"]=u.SKIP_WORDS,this.locale[i].opts["leading-noise-words"]||(this.locale[i].opts["leading-noise-words"]=[]),this.locale[i].dates={},this.locale[i].ord={"1.0.1":!1,keys:{}},this.locale[i]["noun-genders"]={}),r=e.makeXml(),e.nodeNameIs(e.dataObj,"locale"))r=e.dataObj;else{a=e.getNodesByName(e.dataObj,"locale");var k=!1;for(l=0,v=e.numberofnodes(a);l<v;l+=1)if(n=a[l],!k&&e.getAttributeValue(n,"lang","xml")===t)r=n,k=!0;else{var w=e.getAttributeValue(n,"lang","xml"),C=e.getNodesByName(n,"style-options");if(w&&C&&C.length){var E=e.getAttributeValue(C[0],"jurisdiction-preference");E&&(this.locale[w]||(this.locale[w]={opts:{}}),this.locale[w].opts["jurisdiction-preference"]=E.split(/\s+/))}}}for(a=e.getNodesByName(r,"type"),g=0,x=e.numberofnodes(a);g<x;g+=1){var B=a[g],_=e.getAttributeValue(B,"name"),S=e.getAttributeValue(B,"gender");this.opt.gender[_]=S}var T=e.getNodesByName(r,"term","ordinal").length;if(T){for(var D in this.locale[i].ord.keys)delete this.locale[i].terms[D];this.locale[i].ord={"1.0.1":!1,keys:{}}}a=e.getNodesByName(r,"term");var H={"last-digit":{},"last-two-digits":{},"whole-number":{}},V=!1,M={};for(l=0,v=e.numberofnodes(a);l<v;l+=1){if(c=a[l],p=e.getAttributeValue(c,"name"),p==="sub verbo"&&(p="sub-verbo"),p.slice(0,7)==="ordinal"){if(p==="ordinal")V=!0;else{var $=e.getAttributeValue(c,"match"),P=p.slice(8),b=e.getAttributeValue(c,"gender-form");b||(b="neuter"),$||($="last-two-digits",P.slice(0,1)==="0"&&($="last-digit")),P.slice(0,1)==="0"&&(P=P.slice(1)),H[$][P]||(H[$][P]={}),H[$][P][b]=p}this.locale[i].ord.keys[p]=!0}typeof this.locale[i].terms[p]>"u"&&(this.locale[i].terms[p]={}),f="long",b=!1,e.getAttributeValue(c,"form")&&(f=e.getAttributeValue(c,"form")),e.getAttributeValue(c,"gender-form")&&(b=e.getAttributeValue(c,"gender-form")),e.getAttributeValue(c,"gender")&&(this.locale[i]["noun-genders"][p]=e.getAttributeValue(c,"gender")),b?(this.locale[i].terms[p][b]={},this.locale[i].terms[p][b][f]=[],y=this.locale[i].terms[p][b],M[p]=!0):(this.locale[i].terms[p][f]=[],y=this.locale[i].terms[p]),e.numberofnodes(e.getNodesByName(c,"multiple"))?(y[f][0]=e.getNodeValue(c,"single"),y[f][0].indexOf("%s")>-1&&(this.opt.hasPlaceholderTerm=!0),y[f][1]=e.getNodeValue(c,"multiple"),y[f][1].indexOf("%s")>-1&&(this.opt.hasPlaceholderTerm=!0)):(y[f]=e.getNodeValue(c),y[f].indexOf("%s")>-1&&(this.opt.hasPlaceholderTerm=!0))}if(this.locale[i].terms.supplement||(this.locale[i].terms.supplement={}),this.locale[i].terms.supplement.long||(this.locale[i].terms.supplement.long=["supplement","supplements"]),V){for(var W in M){var L={},Q=0;for(var j in this.locale[i].terms[W])["masculine","feminine"].indexOf(j)>-1?L[j]=this.locale[i].terms[W][j]:Q+=1;if(!Q){if(L.feminine)for(var j in L.feminine)this.locale[i].terms[W][j]=L.feminine[j];else if(L.masculine)for(var j in L.masculine)this.locale[i].terms[W][j]=L.masculine[j]}}this.locale[i].ord["1.0.1"]=H}for(p in this.locale[i].terms)for(g=0,x=2;g<x;g+=1)if(b=u.GENDERS[g],this.locale[i].terms[p][b])for(f in this.locale[i].terms[p])this.locale[i].terms[p][b][f]||(this.locale[i].terms[p][b][f]=this.locale[i].terms[p][f]);for(a=e.getNodesByName(r,"style-options"),l=0,v=e.numberofnodes(a);l<v;l+=1){m=a[l],o=e.attributes(m);for(h in o)if(o.hasOwnProperty(h)){if(h==="@punctuation-in-quote"||h==="@limit-day-ordinals-to-day-1")o[h]==="true"?this.locale[i].opts[h.slice(1)]=!0:this.locale[i].opts[h.slice(1)]=!1;else if(h==="@jurisdiction-preference"){var O=o[h].split(/\s+/);this.locale[i].opts[h.slice(1)]=O}else if(h==="@skip-words"){var R=o[h].split(/\s*,\s*/);this.locale[i].opts[h.slice(1)]=R}else if(h==="@leading-noise-words"){var U=o[h].split(/\s*,\s*/);this.locale[i].opts["leading-noise-words"]=U}else if(h==="@name-as-sort-order"){this.locale[i].opts["name-as-sort-order"]={};for(var oe=o[h].split(/\s+/),g=0,x=oe.length;g<x;g+=1)this.locale[i].opts["name-as-sort-order"][oe[g]]=!0}else if(h==="@name-as-reverse-order"){this.locale[i].opts["name-as-reverse-order"]={};for(var oe=o[h].split(/\s+/),g=0,x=oe.length;g<x;g+=1)this.locale[i].opts["name-as-reverse-order"][oe[g]]=!0}else if(h==="@name-never-short"){this.locale[i].opts["name-never-short"]={};for(var oe=o[h].split(/\s+/),g=0,x=oe.length;g<x;g+=1)this.locale[i].opts["name-never-short"][oe[g]]=!0}}}for(a=e.getNodesByName(r,"date"),l=0,v=e.numberofnodes(a);l<v;l+=1){var d=a[l];this.locale[i].dates[e.getAttributeValue(d,"form")]=d}u.SET_COURT_CLASSES(this,i,e,r)};u.getLocaleNames=function(e,t){var i=u.setupXml(e);function n(m,d){var h=["base","best"];if(d)for(var v=u.localeResolve(d),b=0,y=h.length;b<y;b++)v[h[b]]&&m.indexOf(v[h[b]])===-1&&m.push(v[h[b]])}var r=["en-US"];function a(m){for(var d=i.getNodesByName(i.dataObj,m),h=0,v=d.length;h<v;h++){var b=i.getAttributeValue(d[h],"locale");if(b){b=b.split(/ +/);for(var y=0,g=b.length;y<g;y++)this.extendLocaleList(r,b[y])}}}n(r,t);var o=i.getNodesByName(i.dataObj,"style")[0],l=i.getAttributeValue(o,"default-locale");n(r,l);for(var c=["layout","if","else-if","condition"],f=0,p=c.length;f<p;f++)a(i);return r};u.Node={};u.Node.bibliography={build:function(e,t){if(this.tokentype===u.START){e.build.area="bibliography",e.build.root="bibliography",e.build.extension="";var i=function(n){n.tmp.area="bibliography",n.tmp.root="bibliography",n.tmp.extension=""};this.execs.push(i)}t.push(this)}};u.Node.choose={build:function(e,t){var i;this.tokentype===u.START&&(i=function(n){n.tmp.jump.push(void 0,u.LITERAL)}),this.tokentype===u.END&&(i=function(n){n.tmp.jump.pop()}),this.execs.push(i),t.push(this)},configure:function(e,t){this.tokentype===u.END?(e.configure.fail.push(t),e.configure.succeed.push(t)):(e.configure.fail.pop(),e.configure.succeed.pop())}};u.Node.citation={build:function(e,t){if(this.tokentype===u.START){e.build.area="citation",e.build.root="citation",e.build.extension="";var i=function(r){r.tmp.area="citation",r.tmp.root="citation",r.tmp.extension=""};this.execs.push(i)}if(this.tokentype===u.END){if(e.opt.grouped_sort=e.opt.xclass==="in-text"&&e.citation.opt.collapse&&e.citation.opt.collapse.length||e.citation.opt.cite_group_delimiter&&e.citation.opt.cite_group_delimiter.length&&e.opt.update_mode!==u.POSITION&&e.opt.update_mode!==u.NUMERIC,e.opt.grouped_sort&&e.citation_sort.opt.sort_directions.length){var n=e.citation_sort.opt.sort_directions[0].slice();e.citation_sort.opt.sort_directions=[n].concat(e.citation_sort.opt.sort_directions)}e.citation.srt=new u.Registry.Comparifier(e,"citation_sort")}t.push(this)}};u.Node["#comment"]={build:function(){}};u.Node.date={build:function(e,t){var i,n,r,a,o,l,c,f,p,m;(this.tokentype===u.START||this.tokentype===u.SINGLETON)&&(e.dateput.string(e,e.dateput.queue),e.tmp.date_token=u.Util.cloneToken(this),e.tmp.date_token.strings.prefix="",e.tmp.date_token.strings.suffix="",e.dateput.openLevel(this),e.build.date_parts=[],e.build.date_variables=this.variables,e.build.extension||u.Util.substituteStart.call(this,e,t),e.build.extension?i=u.dateMacroAsSortKey:i=function(d,h,v){var b;if(d.tmp.element_rendered_ok=!1,d.tmp.donesies=[],d.tmp.dateparts=[],b=[],this.variables.length&&!(d.tmp.just_looking&&this.variables[0]==="accessed")){for(n=h[this.variables[0]],typeof n>"u"&&(n={"date-parts":[[0]]},d.opt.development_extensions.locator_date_and_revision&&v&&this.variables[0]==="locator-date"&&v["locator-date"]&&(n=v["locator-date"])),d.tmp.date_object=n,r=this.dateparts.length,a=0;a<r;a+=1)o=this.dateparts[a],(typeof d.tmp.date_object[o+"_end"]<"u"||o==="month"&&typeof d.tmp.date_object.season_end<"u")&&b.push(o);for(l=[],c=["year","month","day"],r=c.length,a=0;a<r;a+=1)b.indexOf(c[a])>-1&&l.push(c[a]);for(b=l.slice(),f=2,r=b.length,a=0;a<r;a+=1)if(o=b[a],p=d.tmp.date_object[o],m=d.tmp.date_object[o+"_end"],p!==m){f=a;break}d.tmp.date_collapse_at=b.slice(f)}else d.tmp.date_object=!1},this.execs.push(i),i=function(d,h){if(h[this.variables[0]]&&(d.output.startTag("date",this),this.variables[0]==="issued"&&(h.type==="legal_case"||h.type==="legislation")&&d.opt.disable_duplicate_year_suppression.indexOf(h.country)===-1&&!d.tmp.extension&&""+h["collection-number"]==""+d.tmp.date_object.year&&this.dateparts.length===1&&this.dateparts[0]==="year")){for(var v in d.tmp.date_object)if(d.tmp.date_object.hasOwnProperty(v)&&v.slice(0,4)==="year"){d.tmp.issued_date={};var b=d.output.current.mystack.slice(-2)[0].blobs;d.tmp.issued_date.list=b,d.tmp.issued_date.pos=b.length-1}}},this.execs.push(i)),!e.build.extension&&(this.tokentype===u.END||this.tokentype===u.SINGLETON)&&(i=function(d,h){h[this.variables[0]]&&d.output.endTag()},this.execs.push(i)),t.push(this),(this.tokentype===u.END||this.tokentype===u.SINGLETON)&&(e.build.extension||u.Util.substituteEnd.call(this,e,t))}};u.Node["date-part"]={build:function(e,t){var i,n,r,a,o,l,c,f,p,m,d,h,v,b,y,g,x,k,w,C,E;this.strings.form||(this.strings.form="long"),e.build.date_parts.push(this.strings.name);var B=e.build.date_variables[0];function _(S,T,D){if(!D)return D;if(D=""+u.Util.Dates[this.strings.name][S](e,D,T,this.default_locale),this.strings.name==="month"){if(e.tmp.strip_periods)D=D.replace(/\./g,"");else for(var H=0,V=this.decorations.length;H<V;H+=1)if(this.decorations[H][0]==="@strip-periods"&&this.decorations[H][1]==="true"){D=D.replace(/\./g,"");break}}return D}i=function(S,T){if(S.tmp.date_object)S.tmp.probably_rendered_something=!0;else return;var D="";if(a=!0,o="",l="",S.tmp.donesies.push(this.strings.name),S.tmp.date_object.literal&&this.strings.name==="year"&&(D=S.tmp.date_object.literal,S.output.append(S.tmp.date_object.literal,this)),S.tmp.date_object&&(o=S.tmp.date_object[this.strings.name],l=S.tmp.date_object[this.strings.name+"_end"]),this.strings.name==="year"&&o===0&&!S.tmp.suppress_decorations&&(o=!1),c=!S.tmp.suppress_decorations,f=S.tmp.have_collapsed,p=S[S.tmp.area].opt.collapse==="year-suffix"||S[S.tmp.area].opt.collapse==="year-suffix-ranged",m=S.opt["disambiguate-add-year-suffix"],c&&m&&p&&(S.tmp.years_used.push(o),d=S.tmp.last_years_used.length>=S.tmp.years_used.length,d&&f&&S.tmp.last_years_used[S.tmp.years_used.length-1]===o&&(o=!1)),typeof o<"u"){h=!1,v=!1,this.strings.name==="year"&&(parseInt(o,10)<500&&parseInt(o,10)>0&&(v=S.getTerm("ad")),parseInt(o,10)<0&&(h=S.getTerm("bc"),o=parseInt(o,10)*-1),l&&(parseInt(l,10)<500&&parseInt(l,10)>0&&S.getTerm("ad"),parseInt(l,10)<0&&(S.getTerm("bc"),l=parseInt(l,10)*-1)));for(var H=""+S.tmp.date_object.month;H.length<2;)H="0"+H;H="month-"+H;var V=S.locale[S.opt.lang]["noun-genders"][H];if(this.strings.form){var M=this.strings.form,$=this.strings.form;this.strings.name==="day"&&M==="ordinal"&&S.locale[S.opt.lang].opts["limit-day-ordinals-to-day-1"]&&(o!=1&&(M="numeric"),l!=1&&($="numeric")),o=_.call(this,M,V,o),l=_.call(this,$,V,l)}if(S.output.openLevel("empty"),S.tmp.date_collapse_at.length){for(b=!0,r=S.tmp.date_collapse_at.length,n=0;n<r;n+=1)if(C=S.tmp.date_collapse_at[n],S.tmp.donesies.indexOf(C)===-1){b=!1;break}if(b){if(""+l!="0"){if(S.dateput.queue.length===0&&(a=!0),S.opt["year-range-format"]&&S.opt["year-range-format"]!=="expanded"&&!S.tmp.date_object.day&&!S.tmp.date_object.month&&!S.tmp.date_object.season&&this.strings.name==="year"&&o&&l){l=S.fun.year_mangler(o+"-"+l,!0);var P=S.getTerm("year-range-delimiter");l=l.slice(l.indexOf(P)+1)}D=l,S.dateput.append(l,this),a&&(E=S.dateput.current.value().blobs[0],E&&(E.strings.prefix=""))}D=o,S.output.append(o,this),y=S.output.current.value(),E=y.blobs[y.blobs.length-1],E&&(E.strings.suffix=""),this.strings["range-delimiter"]?S.output.append(this.strings["range-delimiter"]):S.output.append(S.getTerm("year-range-delimiter"),"empty"),S.dateput.closeLevel(),g=S.dateput.current.value(),y.blobs=y.blobs.concat(g),S.dateput.string(S,S.dateput.queue),S.dateput.openLevel(S.tmp.date_token),S.tmp.date_collapse_at=[]}else D=o,S.output.append(o,this),S.tmp.date_collapse_at.indexOf(this.strings.name)>-1&&""+l!="0"&&(S.dateput.queue.length===0&&(a=!0),S.dateput.openLevel("empty"),D=l,S.dateput.append(l,this),a&&(E=S.dateput.current.value().blobs[0],E&&(E.strings.prefix="")),h&&(D=h,S.dateput.append(h)),v&&(D=v,S.dateput.append(v)),S.dateput.closeLevel())}else D=o,S.output.append(o,this);h&&(D=h,S.output.append(h)),v&&(D=v,S.output.append(v)),S.output.closeLevel()}else this.strings.name==="month"&&S.tmp.date_object.season&&(o=""+S.tmp.date_object.season,o&&o.match(/^[1-4]$/)?(S.tmp.group_context.tip.variable_success=!0,D="winter",S.output.append(S.getTerm("season-0"+o),this)):o&&(D=o,S.output.append(o,this)));S.tmp.value=[],T[B]&&(o||S.tmp.have_collapsed)&&!S.opt.has_year_suffix&&this.strings.name==="year"&&!S.tmp.just_looking&&S.registry.registry[T.id]&&S.registry.registry[T.id].disambig.year_suffix!==!1&&!S.tmp.has_done_year_suffix&&(S.tmp.has_done_year_suffix=!0,D="x",k=parseInt(S.registry.registry[T.id].disambig.year_suffix,10),x=new u.NumericBlob(S,!1,k,this,T.id),this.successor_prefix=S[S.build.area].opt.layout_delimiter,this.splice_prefix=S[S.build.area].opt.layout_delimiter,w=new u.Util.Suffixator(u.SUFFIX_CHARS),x.setFormatter(w),S[S.tmp.area].opt.collapse==="year-suffix-ranged"&&(x.range_prefix=S.getTerm("citation-range-delimiter")),S[S.tmp.area].opt.cite_group_delimiter?x.successor_prefix=S[S.tmp.area].opt.cite_group_delimiter:S[S.tmp.area].opt["year-suffix-delimiter"]?x.successor_prefix=S[S.tmp.area].opt["year-suffix-delimiter"]:x.successor_prefix=S[S.tmp.area].opt.layout_delimiter,x.UGLY_DELIMITER_SUPPRESS_HACK=!0,S.output.append(x,"literal")),D&&!S.tmp.group_context.tip.condition&&(S.tmp.just_did_number=D.match(/[0-9]$/),S.output.current.tip.strings.suffix&&(S.tmp.just_did_number=!1))},this.execs.push(i),t.push(this)}};u.Node["else-if"]={build:function(e,t){u.Conditions.TopNode.call(this,e,t),t.push(this)},configure:function(e,t){u.Conditions.Configure.call(this,e,t)}};u.Node.else={build:function(e,t){t.push(this)},configure:function(e,t){this.tokentype===u.START&&(e.configure.fail[e.configure.fail.length-1]=t)}};u.Node["et-al"]={build:function(e,t){if(e.build.area==="citation"||e.build.area==="bibliography"){var i=function(n){n.tmp.etal_node=this,typeof this.strings.term=="string"&&(n.tmp.etal_term=this.strings.term)};this.execs.push(i)}t.push(this)}};u.Node.group={build:function(e,t,i){var n,r;if(this.realGroup=i,this.tokentype===u.START&&(u.Util.substituteStart.call(this,e,t),e.build.substitute_level.value()&&e.build.substitute_level.replace(e.build.substitute_level.value()+1),this.juris||t.push(this),n=function(d){if(d.output.startTag("group",this),this.strings.label_form_override&&(d.tmp.group_context.tip.label_form||(d.tmp.group_context.tip.label_form=this.strings.label_form_override)),this.strings.label_capitalize_if_first_override&&(d.tmp.group_context.tip.label_capitalize_if_first||(d.tmp.group_context.tip.label_capitalize_if_first=this.strings.label_capitalize_if_first_override)),this.realGroup){d.tmp.group_context.tip.condition&&u.UPDATE_GROUP_CONTEXT_CONDITION(d,this.strings.prefix,null,this);var h=!1,v=!1;d.tmp.group_context.mystack.length&&(d.output.current.value().parent=d.tmp.group_context.tip.output_tip);var b=d.tmp.group_context.tip.label_form;b||(b=this.strings.label_form_override);var y=d.tmp.group_context.tip.label_capitalize_if_first;y||(y=this.strings.label_capitalize_if_first),d.tmp.group_context.tip.condition?(h=d.tmp.group_context.tip.condition,v=d.tmp.group_context.tip.force_suppress):this.strings.reject?h={test:this.strings.reject,not:!0}:this.strings.require&&(h={test:this.strings.require,not:!1});var g={old_term_predecessor:d.tmp.term_predecessor,term_intended:!1,variable_attempt:!1,variable_success:!1,variable_success_parent:d.tmp.group_context.tip.variable_success,output_tip:d.output.current.tip,label_form:b,label_static:d.tmp.group_context.tip.label_static,label_capitalize_if_first:y,parallel_delimiter_override:this.strings.set_parallel_delimiter_override,parallel_delimiter_override_on_suppress:this.strings.set_parallel_delimiter_override_on_suppress,condition:h,force_suppress:v,done_vars:d.tmp.group_context.tip.done_vars.slice()};if(this.non_parallel){var x=d.tmp.group_context.tip.non_parallel;x||(x={}),Object.assign(x,this.non_parallel),g.non_parallel=x}if(this.parallel_first){var k=d.tmp.group_context.tip.parallel_first;k||(k={}),Object.assign(k,this.parallel_first),g.parallel_first=k}if(this.parallel_last){var w=d.tmp.group_context.tip.parallel_last;w||(w={}),Object.assign(w,this.parallel_last),g.parallel_last=w}if(d.tmp.abbrev_trimmer&&d.tmp.abbrev_trimmer.LAST_TO_FIRST&&g.parallel_last){g.parallel_first||(g.parallel_first={});for(var C in d.tmp.abbrev_trimmer.LAST_TO_FIRST)g.parallel_last[C]&&(g.parallel_first[C]=!0,delete g.parallel_last[C])}if(d.tmp.group_context.push(g),d.tmp.abbrev_trimmer&&this.parallel_last_to_first){d.tmp.abbrev_trimmer.LAST_TO_FIRST||(d.tmp.abbrev_trimmer.LAST_TO_FIRST={});for(var C in this.parallel_last_to_first)d.tmp.abbrev_trimmer.LAST_TO_FIRST[C]=!0}}},r=[],r.push(n),this.execs=r.concat(this.execs),this.strings["has-publisher-and-publisher-place"]&&(e.build["publisher-special"]=!0,this.strings["subgroup-delimiter"]&&(n=function(d,h){if(h.publisher&&h["publisher-place"]){var v=h.publisher.split(/;\s*/),b=h["publisher-place"].split(/;\s*/);v.length>1&&v.length===b.length&&(d.publisherOutput=new u.PublisherOutput(d,this),d.publisherOutput["publisher-list"]=v,d.publisherOutput["publisher-place-list"]=b)}},this.execs.push(n))),this.juris)){var a=new u.Token("choose",u.START);u.Node.choose.build.call(a,e,t);var o=new u.Token("if",u.START);n=function(d){return function(h,v){return u.INIT_JURISDICTION_MACROS(e,h,v,d)}}(this.juris),o.tests||(o.tests=[]),o.tests.push(n),o.test=e.fun.match.any(o,e,o.tests),t.push(o);var l=new u.Token("text",u.SINGLETON);n=function(d,h,v){var b=h;v&&v["best-jurisdiction"]&&this.juris==="juris-locator"&&(b=v);var y=0;if(d.juris[b["best-jurisdiction"]][this.juris])for(;y<d.juris[b["best-jurisdiction"]][this.juris].length;)y=u.tokenExec.call(d,d.juris[b["best-jurisdiction"]][this.juris][y],h,v)},l.juris=this.juris,l.execs.push(n),t.push(l);var c=new u.Token("if",u.END);u.Node.if.build.call(c,e,t);var f=new u.Token("else",u.START);u.Node.else.build.call(f,e,t)}if(this.tokentype===u.END&&(e.build["publisher-special"]&&(e.build["publisher-special"]=!1,n=function(d){d.publisherOutput&&(d.publisherOutput.render(),d.publisherOutput=!1)},this.execs.push(n)),n=function(d,h,v){if(d.tmp.group_context.tip.condition||d.output.current.tip.strings.suffix&&(d.tmp.just_did_number=!1),d.output.endTag(),this.realGroup){var b=d.tmp.group_context.pop();if(b.parallel_delimiter_override&&(d.tmp.group_context.tip.parallel_delimiter_override=b.parallel_delimiter_override,!d.tmp.just_looking&&d.registry.registry[h.id].master&&(d.registry.registry[h.id].parallel_delimiter_override=b.parallel_delimiter_override)),b.parallel_delimiter_override_on_suppress&&(d.tmp.group_context.tip.parallel_delimiter_override_on_suppress=b.parallel_delimiter_override_on_suppress),d.tmp.area==="bibliography_sort"){var y=b.done_vars.indexOf("citation-number");this.strings.sort_direction&&y>-1&&d.tmp.group_context.length()==1&&(this.strings.sort_direction===u.DESCENDING?d.bibliography_sort.opt.citation_number_sort_direction=u.DESCENDING:d.bibliography_sort.opt.citation_number_sort_direction=u.ASCENDING,b.done_vars=b.done_vars.slice(0,y).concat(b.done_vars.slice(y+1)))}if(b.condition&&(b.force_suppress=u.EVALUATE_GROUP_CONDITION(d,b)),d.tmp.group_context.tip.condition&&(d.tmp.group_context.tip.force_suppress=b.force_suppress),!b.force_suppress&&(b.variable_success||b.term_intended&&!b.variable_attempt)){this.isJurisLocatorLabel||(d.tmp.group_context.tip.variable_success=!0);var g=d.output.current.value().blobs;if(d.output.current.value().blobs.length-1,!d.tmp.just_looking&&(b.non_parallel||b.parallel_last||b.parallel_first||b.parallel_delimiter_override||b.parallel_delimiter_override_on_suppress)){var x=d.parallel.checkRepeats(b);if(x&&g&&g.pop(),d.tmp.cite_index>0&&(x||!b.parallel_first&&!b.parallel_last&&!b.non_parallel)){var k=d.tmp.suppress_repeats[d.tmp.cite_index-1];x&&b.parallel_delimiter_override_on_suppress&&(k.SIBLING||k.ORPHAN)?d.output.queue.slice(-1)[0].parallel_delimiter=b.parallel_delimiter_override_on_suppress:b.parallel_delimiter_override&&k.SIBLING&&(d.output.queue.slice(-1)[0].parallel_delimiter=b.parallel_delimiter_override)}}}else{if(d.tmp.term_predecessor=b.old_term_predecessor,d.tmp.group_context.tip.variable_attempt=b.variable_attempt,b.force_suppress&&!d.tmp.group_context.tip.condition&&(d.tmp.group_context.tip.variable_attempt=!0,d.tmp.group_context.tip.variable_success=b.variable_success_parent),b.force_suppress)for(var w=0,C=b.done_vars.length;w<C;w++)for(var E=b.done_vars[w],B=0,_=d.tmp.done_vars.length;B<_;B++)d.tmp.done_vars[B]===E&&(d.tmp.done_vars=d.tmp.done_vars.slice(0,B).concat(d.tmp.done_vars.slice(B+1)));d.output.current.value().blobs&&d.output.current.value().blobs.pop()}}},this.execs.push(n),this.juris)){var p=new u.Token("else",u.END);u.Node.else.build.call(p,e,t);var m=new u.Token("choose",u.END);u.Node.choose.build.call(m,e,t)}this.tokentype===u.END&&(this.juris||t.push(this),e.build.substitute_level.value()&&e.build.substitute_level.replace(e.build.substitute_level.value()-1),u.Util.substituteEnd.call(this,e,t))}};u.Node.if={build:function(e,t){u.Conditions.TopNode.call(this,e,t),t.push(this)},configure:function(e,t){u.Conditions.Configure.call(this,e,t)}};u.Node.conditions={build:function(e){this.tokentype===u.START&&e.tmp.conditions.addMatch(this.match),this.tokentype===u.END&&e.tmp.conditions.matchCombine()}};u.Node.condition={build:function(e){if(this.tokentype===u.SINGLETON){var t=e.fun.match[this.match](this,e,this.tests);e.tmp.conditions.addTest(t)}}};u.Conditions={};u.Conditions.TopNode=function(e){var t;(this.tokentype===u.START||this.tokentype===u.SINGLETON)&&(this.locale&&(e.opt.lang=this.locale),!this.tests||!this.tests.length?e.tmp.conditions=new u.Conditions.Engine(e,this):this.test=e.fun.match[this.match](this,e,this.tests),e.build.substitute_level.value()===0&&(t=function(i){i.tmp.condition_counter++},this.execs.push(t))),(this.tokentype===u.END||this.tokentype===u.SINGLETON)&&(e.build.substitute_level.value()===0&&(t=function(i){if(i.tmp.condition_counter--,i.tmp.condition_lang_counter_arr.length>0){var n=i.tmp.condition_lang_counter_arr.slice(-1)[0];n===i.tmp.condition_counter&&(i.opt.lang=i.tmp.condition_lang_val_arr.pop(),i.tmp.condition_lang_counter_arr.pop())}this.locale_default&&(i.output.current.value().old_locale=this.locale_default,i.output.closeLevel("empty"),i.opt.lang=this.locale_default)},this.execs.push(t)),t=function(i){var n=this[i.tmp.jump.value()];return n},this.execs.push(t),this.locale_default&&(e.opt.lang=this.locale_default))};u.Conditions.Configure=function(e,t){this.tokentype===u.START?(this.fail=e.configure.fail.slice(-1)[0],this.succeed=this.next,e.configure.fail[e.configure.fail.length-1]=t):this.tokentype===u.SINGLETON?(this.fail=this.next,this.succeed=e.configure.succeed.slice(-1)[0],e.configure.fail[e.configure.fail.length-1]=t):(this.succeed=e.configure.succeed.slice(-1)[0],this.fail=this.next)};u.Conditions.Engine=function(e,t){this.token=t,this.state=e};u.Conditions.Engine.prototype.addTest=function(e){this.token.tests||(this.token.tests=[]),this.token.tests.push(e)};u.Conditions.Engine.prototype.addMatch=function(e){this.token.match=e};u.Conditions.Engine.prototype.matchCombine=function(){this.token.test=this.state.fun.match[this.token.match](this.token,this.state,this.token.tests)};u.Node.info={build:function(e){this.tokentype===u.START?e.build.skip="info":e.build.skip=!1}};u.Node.institution={build:function(e,t){if([u.SINGLETON,u.START].indexOf(this.tokentype)>-1){var i=function(n){typeof this.strings.delimiter=="string"?n.tmp.institution_delimiter=this.strings.delimiter:n.tmp.institution_delimiter=n.tmp.name_delimiter,n.inheritOpt(this,"and")==="text"?this.and_term=n.getTerm("and","long",0):n.inheritOpt(this,"and")==="symbol"?n.opt.development_extensions.expect_and_symbol_form?this.and_term=n.getTerm("and","symbol",0):this.and_term="&":n.inheritOpt(this,"and")==="none"&&(this.and_term=n.tmp.institution_delimiter),typeof this.and_term>"u"&&n.tmp.and_term&&(this.and_term=n.tmp.and_term),u.STARTSWITH_ROMANESQUE_REGEXP.test(this.and_term)?(this.and_prefix_single=" ",this.and_prefix_multiple=", ",typeof n.tmp.institution_delimiter=="string"&&(this.and_prefix_multiple=n.tmp.institution_delimiter),this.and_suffix=" "):(this.and_prefix_single="",this.and_prefix_multiple="",this.and_suffix=""),n.inheritOpt(this,"delimiter-precedes-last")==="always"?this.and_prefix_single=n.tmp.institution_delimiter:n.inheritOpt(this,"delimiter-precedes-last")==="never"&&this.and_prefix_multiple&&(this.and_prefix_multiple=" "),this.and={},typeof this.and_term<"u"?(n.output.append(this.and_term,"empty",!0),this.and.single=n.output.pop(),this.and.single.strings.prefix=this.and_prefix_single,this.and.single.strings.suffix=this.and_suffix,n.output.append(this.and_term,"empty",!0),this.and.multiple=n.output.pop(),this.and.multiple.strings.prefix=this.and_prefix_multiple,this.and.multiple.strings.suffix=this.and_suffix):this.strings.delimiter!=="undefined"&&(this.and.single=new u.Blob(n.tmp.institution_delimiter),this.and.single.strings.prefix="",this.and.single.strings.suffix="",this.and.multiple=new u.Blob(n.tmp.institution_delimiter),this.and.multiple.strings.prefix="",this.and.multiple.strings.suffix=""),n.nameOutput.institution=this};this.execs.push(i)}t.push(this)},configure:function(e){[u.SINGLETON,u.START].indexOf(this.tokentype)>-1&&(e.build.has_institution=!0)}};u.Node["institution-part"]={build:function(e,t){var i;this.strings.name==="long"?this.strings["if-short"]?i=function(n){n.nameOutput.institutionpart["long-with-short"]=this}:i=function(n){n.nameOutput.institutionpart.long=this}:this.strings.name==="short"&&(i=function(n){n.nameOutput.institutionpart.short=this}),this.execs.push(i),t.push(this)}};u.Node.key={build:function(e,t){t=e[e.build.root+"_sort"].tokens;var i,n=new u.Token("key",u.START);e.tmp.root=e.build.root,n.strings["et-al-min"]=e.inheritOpt(this,"et-al-min"),n.strings["et-al-use-first"]=e.inheritOpt(this,"et-al-use-first"),n.strings["et-al-use-last"]=e.inheritOpt(this,"et-al-use-last"),i=function(g){g.tmp.done_vars=[]},n.execs.push(i),i=function(g){g.output.openLevel("empty")},n.execs.push(i);var r=[];if(this.strings.sort_direction===u.DESCENDING?(r.push(1),r.push(-1)):(r.push(-1),r.push(1)),e[e.build.area].opt.sort_directions.push(r),u.DATE_VARIABLES.indexOf(this.variables[0])>-1&&(e.build.date_key=!0),i=function(g){g.tmp.sort_key_flag=!0,g.inheritOpt(this,"et-al-min")&&(g.tmp["et-al-min"]=g.inheritOpt(this,"et-al-min")),g.inheritOpt(this,"et-al-use-first")&&(g.tmp["et-al-use-first"]=g.inheritOpt(this,"et-al-use-first")),typeof g.inheritOpt(this,"et-al-use-last")=="boolean"&&(g.tmp["et-al-use-last"]=g.inheritOpt(this,"et-al-use-last"))},n.execs.push(i),t.push(n),this.variables.length){var a=this.variables[0];if(u.NAME_VARIABLES.indexOf(a)>-1){var o=new u.Token("names",u.START);o.tokentype=u.START,o.variables=this.variables,u.Node.names.build.call(o,e,t);var l=new u.Token("name",u.SINGLETON);l.tokentype=u.SINGLETON,l.strings["name-as-sort-order"]="all",l.strings["sort-separator"]=" ",l.strings["et-al-use-last"]=e.inheritOpt(this,"et-al-use-last"),l.strings["et-al-min"]=e.inheritOpt(this,"et-al-min"),l.strings["et-al-use-first"]=e.inheritOpt(this,"et-al-use-first"),u.Node.name.build.call(l,e,t);var c=new u.Token("institution",u.SINGLETON);c.tokentype=u.SINGLETON,u.Node.institution.build.call(c,e,t);var f=new u.Token("names",u.END);f.tokentype=u.END,u.Node.names.build.call(f,e,t)}else{var p=new u.Token("text",u.SINGLETON);if(p.strings.sort_direction=this.strings.sort_direction,p.dateparts=this.dateparts,u.NUMERIC_VARIABLES.indexOf(a)>-1)a==="citation-number"?i=function(g,x){if(g.tmp.area==="bibliography_sort"&&(this.strings.sort_direction===u.DESCENDING?g.bibliography_sort.opt.citation_number_sort_direction=u.DESCENDING:g.bibliography_sort.opt.citation_number_sort_direction=u.ASCENDING),g.tmp.area==="citation_sort"&&g.bibliography_sort.tmp.citation_number_map)var k=g.bibliography_sort.tmp.citation_number_map[g.registry.registry[x.id].seq];else var k=g.registry.registry[x.id].seq;k&&(k=u.Util.padding(""+k)),g.output.append(k,this)}:i=function(g,x){var k=!1;k=x[a],k&&(k=u.Util.padding(k)),g.output.append(k,this)};else if(a==="citation-label")i=function(g,x){var k=g.getCitationLabel(x);g.output.append(k,this)};else if(u.DATE_VARIABLES.indexOf(a)>-1)i=u.dateAsSortKey,p.variables=this.variables;else if(a==="title"){var m="title",d=!1,h=!1,v=!0;i=e.transform.getOutputFunction(this.variables,m,d,h,v)}else a==="court-class"?i=function(g,x,k){u.INIT_JURISDICTION_MACROS(g,x,k,"juris-main");var w=u.GET_COURT_CLASS(g,x,!0);g.output.append(w,"empty")}:i=function(g,x){var k=x[a];g.output.append(k,"empty")};p.execs.push(i),t.push(p)}}else{var b=new u.Token("text",u.SINGLETON);b.strings.sort_direction=this.strings.sort_direction,b.postponed_macro=this.postponed_macro,u.expandMacro.call(e,b,t)}var y=new u.Token("key",u.END);i=function(g){var x=g.output.string(g,g.output.queue);g.sys.normalizeUnicode&&(x=g.sys.normalizeUnicode(x)),x=x?x.split(" ").join(g.opt.sort_sep)+g.opt.sort_sep:"",x===""&&(x=void 0),typeof x!="string"&&(x=void 0),g[g[g.tmp.area].root+"_sort"].keys.push(x),g.tmp.value=[]},y.execs.push(i),e.build.date_key&&(e.build.area==="citation"&&e.build.extension==="_sort"&&(e[e.build.area].opt.sort_directions.push([-1,1]),i=function(g,x){var k=g.registry.registry[x.id].disambig.year_suffix;k||(k=0);var w=u.Util.padding(""+k);g[g.tmp.area].keys.push(w)},y.execs.push(i)),e.build.date_key=!1),i=function(g){g.tmp["et-al-min"]=void 0,g.tmp["et-al-use-first"]=void 0,g.tmp["et-al-use-last"]=void 0,g.tmp.sort_key_flag=!1},y.execs.push(i),t.push(y)}};u.Node.label={build:function(e,t){if(this.strings.term){var i=function(l,c,f){var p=u.evaluateLabel(this,l,c,f);f&&this.strings.term==="locator"&&(f.section_form_override=this.strings.form),p&&(l.tmp.group_context.tip.term_intended=!0),u.UPDATE_GROUP_CONTEXT_CONDITION(l,p,null,this),p.indexOf("%s")===-1&&(this.strings.capitalize_if_first&&!l.tmp.term_predecessor&&!(l.opt.class==="in-text"&&l.tmp.area==="citation")&&(p=u.Output.Formatters["capitalize-first"](l,p)),l.output.append(p,this))};this.execs.push(i)}else{this.strings.form||(this.strings.form="long");for(var n=e.build.names_variables[e.build.names_variables.length-1],r=e.build.name_label[e.build.name_label.length-1],a=0,o=n.length;a<o;a+=1)r[n[a]]||(r[n[a]]={});if(e.build.name_flag)for(var a=0,o=n.length;a<o;a+=1)r[n[a]].after=this;else for(var a=0,o=n.length;a<o;a+=1)r[n[a]].before=this}t.push(this)}};u.Node.layout={build:function(e,t){var i,n,r,a;function o(){e.build.area==="bibliography"&&(r=new u.Token("text",u.SINGLETON),i=function(f){if(!f.tmp.parallel_and_not_last){var p;f.tmp.cite_affixes[f.tmp.area][f.tmp.last_cite_locale]?p=f.tmp.cite_affixes[f.tmp.area][f.tmp.last_cite_locale].suffix:p=f.bibliography.opt.layout_suffix;var m=f.output.current.value();f.opt.using_display?m.blobs[m.blobs.length-1].strings.suffix=p:m.strings.suffix=p}f.bibliography.opt["second-field-align"]&&f.output.endTag("bib_other")},r.execs.push(i),t.push(r))}this.tokentype===u.START&&(this.locale_raw?e.build.current_default_locale=this.locale_raw:e.build.current_default_locale=e.opt["default-locale"],i=function(f,p,m){if(f.opt.development_extensions.apply_citation_wrapper&&f.sys.wrapCitationEntry&&!f.tmp.just_looking&&p.system_id&&f.tmp.area==="citation"){var d=new u.Token("group",u.START);d.decorations=[["@cite","entry"]],f.output.startTag("cite_entry",d),f.output.current.value().item_id=p.system_id,m&&(f.output.current.value().locator_txt=m.locator_txt,f.output.current.value().suffix_txt=m.suffix_txt)}},this.execs.push(i)),this.tokentype===u.START&&!e.tmp.cite_affixes[e.build.area]&&(i=function(f,p,m){if(f.tmp.done_vars=[],m&&m["author-only"]&&f.tmp.done_vars.push("locator"),f.opt.suppressedJurisdictions[p.country]&&p.country&&["treaty","patent"].indexOf(p.type)===-1&&f.tmp.done_vars.push("country"),!f.tmp.just_looking&&f.registry.registry[p.id]&&f.registry.registry[p.id].parallel&&f.tmp.done_vars.push("first-reference-note-number"),!f.tmp.just_looking&&f.tmp.abbrev_trimmer&&p.jurisdiction)for(var d in f.tmp.abbrev_trimmer.QUASHES[p.jurisdiction])f.tmp.done_vars.push(d);f.tmp.rendered_name=!1},this.execs.push(i),i=function(f){f.tmp.sort_key_flag=!1},this.execs.push(i),i=function(f){f.tmp.nameset_counter=0},this.execs.push(i),i=function(f,p){var m=new u.Token;f.output.openLevel(m)},this.execs.push(i),t.push(this),e.build.area==="citation"&&(n=new u.Token("text",u.SINGLETON),i=function(f,p,m){if(m&&m.prefix){var d=u.checkPrefixSpaceAppend(f,m.prefix);f.tmp.just_looking||(d=f.output.checkNestedBrace.update(d));var h=u.checkIgnorePredecessor(f,d);f.output.append(d,this,!1,h)}},n.execs.push(i),t.push(n)));var l;if(this.locale_raw&&(l=new u.Token("dummy",u.START),l.locale=this.locale_raw,l.strings.delimiter=this.strings.delimiter,l.strings.suffix=this.strings.suffix,e.tmp.cite_affixes[e.build.area]||(e.tmp.cite_affixes[e.build.area]={})),this.tokentype===u.START&&(e.build.layout_flag=!0,this.locale_raw||(e[e.tmp.area].opt.topdecor=[this.decorations],e[e.tmp.area+"_sort"].opt.topdecor=[this.decorations],e[e.build.area].opt.layout_prefix=this.strings.prefix,e[e.build.area].opt.layout_suffix=this.strings.suffix,e[e.build.area].opt.layout_delimiter=this.strings.delimiter,e[e.build.area].opt.layout_decorations=this.decorations,e.tmp.cite_affixes[e.build.area]&&(a=new u.Token("else",u.START),u.Node.else.build.call(a,e,t))),this.locale_raw)){if(e.build.layout_locale_flag)l.name="else-if",u.Attributes["@locale-internal"].call(l,e,this.locale_raw),u.Node["else-if"].build.call(l,e,t);else{var c=new u.Token("choose",u.START);u.Node.choose.build.call(c,e,t),l.name="if",u.Attributes["@locale-internal"].call(l,e,this.locale_raw),u.Node.if.build.call(l,e,t)}e.tmp.cite_affixes[e.build.area][l.locale]={},e.tmp.cite_affixes[e.build.area][l.locale].delimiter=this.strings.delimiter,e.tmp.cite_affixes[e.build.area][l.locale].suffix=this.strings.suffix}this.tokentype===u.END&&(this.locale_raw&&(o(),e.build.layout_locale_flag?(l.name="else-if",l.tokentype=u.END,u.Attributes["@locale-internal"].call(l,e,this.locale_raw),u.Node["else-if"].build.call(l,e,t)):(l.name="if",l.tokentype=u.END,u.Attributes["@locale-internal"].call(l,e,this.locale_raw),u.Node.if.build.call(l,e,t),e.build.layout_locale_flag=!0)),this.locale_raw||(o(),e.tmp.cite_affixes[e.build.area]&&e.build.layout_locale_flag&&(a=new u.Token("else",u.END),u.Node.else.build.call(a,e,t),a=new u.Token("choose",u.END),u.Node.choose.build.call(a,e,t)),e.build_layout_locale_flag=!0,e.build.area==="citation"&&(r=new u.Token("text",u.SINGLETON),i=function(f,p,m){if(m&&m.suffix){var d=u.checkSuffixSpacePrepend(f,m.suffix);f.tmp.just_looking||(d=f.output.checkNestedBrace.update(d)),f.output.append(d,this)}},r.execs.push(i),t.push(r)),i=function(f){f.output.closeLevel()},this.execs.push(i),i=function(f,p){f.opt.development_extensions.apply_citation_wrapper&&f.sys.wrapCitationEntry&&!f.tmp.just_looking&&p.system_id&&f.tmp.area==="citation"&&f.output.endTag()},this.execs.push(i),t.push(this),e.build.layout_flag=!1,e.build.layout_locale_flag=!1))}};u.Node.macro={build:function(){}};u.Node.alternative={build:function(e,t){if(this.tokentype===u.START){var i=new u.Token("choose",u.START);u.Node.choose.build.call(i,e,t);var n=new u.Token("if",u.START);u.Attributes["@alternative-node-internal"].call(n,e),u.Node.if.build.call(n,e,t);var r=function(a,o){if(a.tmp.oldItem=o,a.tmp.oldLang=a.opt.lang,a.tmp.abort_alternative=!0,o["language-name"]&&o["language-name-original"]){var l=JSON.parse(JSON.stringify(o));l.language=l["language-name"];var c=u.localeResolve(l.language,a.opt["default-locale"][0]);if(a.opt.multi_layout)for(var f in a.opt.multi_layout){var p=a.opt.multi_layout[f],m=!1;for(var d in p){var h=p[d];if(c.best===h.best||c.base===h.base||c.bare===h.bare){m=p[0].best;break}}m||(m=a.opt["default-locale"][0]),a.opt.lang=m}for(var v in l)if(["id","type","language","multi"].indexOf(v)===-1&&v.slice(0,4)!=="alt-")if(l.multi&&l.multi._keys[v]){var b=!0;for(var y in l.multi._keys[v])if(c.bare===y.replace(/^([a-zA-Z]+).*/,"$1")){b=!1;break}b&&delete l[v]}else delete l[v];for(var v in l)v.slice(0,4)==="alt-"?(l[v.slice(4)]=l[v],a.tmp.abort_alternative=!1):l.multi&&l.multi._keys&&!l["alt-"+v]&&l.multi._keys[v]&&(l.multi._keys[v][c.best]?(l[v]=l.multi._keys[v][c.best],a.tmp.abort_alternative=!1):l.multi._keys[v][c.base]?(l[v]=l.multi._keys[v][c.base],a.tmp.abort_alternative=!1):l.multi._keys[v][c.bare]&&(l[v]=l.multi._keys[v][c.bare],a.tmp.abort_alternative=!1))}a.output.openLevel(this),a.registry.refhash[o.id]=l,a.nameOutput=new u.NameOutput(a,l)};this.execs.push(r),t.push(this);var i=new u.Token("choose",u.START);u.Node.choose.build.call(i,e,t);var n=new u.Token("if",u.START);u.Attributes["@alternative-node-internal"].call(n,e);var r=function(a){a.tmp.abort_alternative=!0};n.execs.push(r),u.Node.if.build.call(n,e,t)}else if(this.tokentype===u.END){var n=new u.Token("if",u.END);u.Node.if.build.call(n,e,t);var i=new u.Token("choose",u.END);u.Node.choose.build.call(i,e,t);var r=function(c,f){c.output.closeLevel(),c.registry.refhash[f.id]=c.tmp.oldItem,c.opt.lang=c.tmp.oldLang,c.nameOutput=new u.NameOutput(c,c.tmp.oldItem),c.tmp.abort_alternative=!1};this.execs.push(r),t.push(this);var n=new u.Token("if",u.END);u.Node.if.build.call(n,e,t);var i=new u.Token("choose",u.END);u.Node.choose.build.call(i,e,t)}}};u.Node["alternative-text"]={build:function(e,t){if(this.tokentype===u.SINGLETON){var i=function(n,a){var a=n.refetchItem(a.id);u.getCite.call(n,a)};this.execs.push(i)}t.push(this)}};u.NameOutput=function(e,t,i){this.debug=!1,this.state=e,this.debug&&this.state.sys.print("(1)"),this.Item=t,this.item=i,this.nameset_base=0,this.etal_spec={},this._first_creator_variable=!1,this._please_chop=!1};u.NameOutput.prototype.init=function(e){this.requireMatch=e.requireMatch,this.state.tmp.term_predecessor&&(this.state.tmp.subsequent_author_substitute_ok=!1),this.nameset_offset&&(this.nameset_base=this.nameset_base+this.nameset_offset),this.nameset_offset=0,this.names=e,this.variables=e.variables,this.state.tmp.value=[],this.state.tmp.rendered_name=[],this.state.tmp.label_blob=!1,this.state.tmp.etal_node=!1,this.state.tmp.etal_term=!1;for(var t=0,i=this.variables.length;t<i;t+=1)this.Item[this.variables[t]]&&this.Item[this.variables[t]].length&&(this.state.tmp.value=this.state.tmp.value.concat(this.Item[this.variables[t]]));if(this["et-al"]=void 0,this.with=void 0,this.name=void 0,this.institutionpart={},this.state.tmp.group_context.tip.variable_attempt=!0,this.labelVariable=this.variables[0],!!this.state.tmp.value.length){var n=this.checkCommonAuthor(this.requireMatch);if(n){this.state.tmp.can_substitute.pop(),this.state.tmp.can_substitute.push(!0);for(var t in this.variables){var r=this.state.tmp.done_vars.indexOf(this.variables[t]);r>-1&&(this.state.tmp.done_vars=this.state.tmp.done_vars.slice(0,r).concat(this.state.tmp.done_vars.slice(t+1)))}this.state.tmp.common_term_match_fail=!0,this.variables=[]}}};u.NameOutput.prototype.reinit=function(e,t){if(this.requireMatch=e.requireMatch,this.labelVariable=t,this.state.tmp.can_substitute.value()){this.nameset_offset=0,this.variables=e.variables;var i=this.state.tmp.value.slice();this.state.tmp.value=[];for(var n=0,r=this.variables.length;n<r;n+=1)this.Item[this.variables[n]]&&this.Item[this.variables[n]].length&&(this.state.tmp.value=this.state.tmp.value.concat(this.Item[this.variables[n]]));this.state.tmp.value.length&&this.state.tmp.can_substitute.replace(!1,u.LITERAL),this.state.tmp.value=i}var a=this.checkCommonAuthor(this.requireMatch);if(a){this.state.tmp.can_substitute.pop(),this.state.tmp.can_substitute.push(!0);for(var n in this.variables){var o=this.state.tmp.done_vars.indexOf(this.variables[n]);o>-1&&(this.state.tmp.done_vars=this.state.tmp.done_vars.slice(0,o).concat(this.state.tmp.done_vars.slice(n+1)))}this.variables=[]}};u.NameOutput.prototype.outputNames=function(){var e,t,i=this.variables;if(this.institution.and&&((!this.institution.and.single.blobs||!this.institution.and.single.blobs.length)&&(this.institution.and.single.blobs=this.name.and.single.blobs),(!this.institution.and.multiple.blobs||!this.institution.and.multiple.blobs.length)&&(this.institution.and.multiple.blobs=this.name.and.multiple.blobs)),this.variable_offset={},this.family)for(this.family_decor=u.Util.cloneToken(this.family),this.family_decor.strings.prefix="",this.family_decor.strings.suffix="",e=0,t=this.family.execs.length;e<t;e+=1)this.family.execs[e].call(this.family_decor,this.state,this.Item);else this.family_decor=!1;if(this.given)for(this.given_decor=u.Util.cloneToken(this.given),this.given_decor.strings.prefix="",this.given_decor.strings.suffix="",e=0,t=this.given.execs.length;e<t;e+=1)this.given.execs[e].call(this.given_decor,this.state,this.Item);else this.given_decor=!1;if(this.debug&&this.state.sys.print("(2)"),this.getEtAlConfig(),this.debug&&this.state.sys.print("(3)"),this.divideAndTransliterateNames(),this.debug&&this.state.sys.print("(4)"),this.truncatePersonalNameLists(),this.debug&&this.state.sys.print("(5)"),this.debug&&this.state.sys.print("(6)"),this.disambigNames(),this.constrainNames(),this.debug&&this.state.sys.print("(7)"),this.name.strings.form==="count"){(this.state.tmp.extension||this.names_count!=0)&&(this.state.output.append(this.names_count,"empty"),this.state.tmp.group_context.tip.variable_success=!0);return}this.debug&&this.state.sys.print("(8)"),this.setEtAlParameters(),this.debug&&this.state.sys.print("(9)"),this.setCommonTerm(this.requireMatch),this.debug&&this.state.sys.print("(10)"),this.renderAllNames(),this.debug&&this.state.sys.print("(11)");var n=[];for(e=0,t=i.length;e<t;e+=1){var r=i[e],a=[],o=!1,l=null;if(!this.state.opt.development_extensions.spoof_institutional_affiliations)l=this._join([this.freeters[r]],"");else{this.debug&&this.state.sys.print("(11a)");for(var c=0,f=this.institutions[r].length;c<f;c+=1)a.push(this.joinPersonsAndInstitutions([this.persons[r][c],this.institutions[r][c]]));if(this.debug&&this.state.sys.print("(11b)"),this.institutions[r].length){var p=this.nameset_base+this.variable_offset[r];this.freeters[r].length&&(p+=1),o=this.joinInstitutionSets(a,p)}this.debug&&this.state.sys.print("(11c)");var l=this.joinFreetersAndInstitutionSets([this.freeters[r],o]);this.debug&&this.state.sys.print("(11d)")}if(l&&(this.state.tmp.extension||(l=this._applyLabels(l,r)),n.push(l)),this.debug&&this.state.sys.print("(11e)"),this.common_term)break}for(this.debug&&this.state.sys.print("(12)"),this.state.output.openLevel("empty"),this.state.output.current.value().strings.delimiter=this.state.inheritOpt(this.names,"delimiter","names-delimiter"),this.debug&&this.state.sys.print("(13)"),e=0,t=n.length;e<t;e+=1)this.state.output.append(n[e],"literal",!0);!this.state.tmp.just_looking&&n.length>0&&(this.state.tmp.probably_rendered_something=!0),this.debug&&this.state.sys.print("(14)"),this.state.output.closeLevel("empty"),this.debug&&this.state.sys.print("(15)");var m=this.state.output.pop();this.state.tmp.name_node.top=m,this.debug&&this.state.sys.print("(16)");var d=u.Util.cloneToken(this.names);if(this.state.tmp.group_context.tip.condition&&u.UPDATE_GROUP_CONTEXT_CONDITION(this.state,this.names.strings.prefix,null,this.names),this.state.output.append(m,d),this.state.tmp.term_predecessor_name&&(this.state.tmp.term_predecessor=!0),this.debug&&this.state.sys.print("(17)"),this.debug&&this.state.sys.print("(18)"),i[0]!=="authority"){var h=[],v=this.Item[i[0]];if(v)for(var e=0,t=v.length;e<t;e+=1){var b=u.Util.Names.getRawName(v[e]);b&&h.push(b)}h=h.join(", "),h&&(this.state.tmp.name_node.string=h)}if(this.state.tmp.name_node.string&&!this.state.tmp.first_name_string&&(this.state.tmp.first_name_string=this.state.tmp.name_node.string),this.Item.type==="classic"&&this.state.tmp.first_name_string){var y=[];y.push(this.state.tmp.first_name_string),this.Item.title&&y.push(this.Item.title),y=y.join(", "),y&&this.state.sys.getAbbreviation&&(this.state.sys.normalizeAbbrevsKey&&(y=this.state.sys.normalizeAbbrevsKey("classic",y)),this.state.transform.loadAbbreviation("default","classic",y,this.Item.language),this.state.transform.abbrevs.default.classic[y]&&(this.state.tmp.done_vars.push("title"),this.state.output.append(this.state.transform.abbrevs.default.classic[y],"empty",!0),m=this.state.output.pop(),this.state.tmp.name_node.top.blobs.pop(),this.state.tmp.name_node.top.blobs.push(m)))}this._collapseAuthor(),this.variables=[],this.state.tmp.authority_stop_last=0,this.debug&&this.state.sys.print("(19)")};u.NameOutput.prototype._applyLabels=function(e,t){var i;if(!this.label||!this.label[this.labelVariable])return e;var n=0,r=this.freeters_count[t]+this.institutions_count[t];if(r>1)n=1;else{for(var a=0,o=this.persons[t].length;a<o;a+=1)r+=this.persons_count[t][a];r>1&&(n=1)}return this.label[this.labelVariable].before?(typeof this.label[this.labelVariable].before.strings.plural=="number"&&(n=this.label[this.labelVariable].before.strings.plural),i=this._buildLabel(t,n,"before",this.labelVariable),this.state.output.openLevel("empty"),this.state.output.append(i,this.label[this.labelVariable].before,!0),this.state.output.append(e,"literal",!0),this.state.output.closeLevel("empty"),e=this.state.output.pop()):this.label[this.labelVariable].after&&(typeof this.label[this.labelVariable].after.strings.plural=="number"&&(n=this.label[this.labelVariable].after.strings.plural),i=this._buildLabel(t,n,"after",this.labelVariable),this.state.output.openLevel("empty"),this.state.output.append(e,"literal",!0),this.state.output.append(i,this.label[this.labelVariable].after,!0),this.state.tmp.label_blob=this.state.output.pop(),this.state.output.append(this.state.tmp.label_blob,"literal",!0),this.state.output.closeLevel("empty"),e=this.state.output.pop()),e};u.NameOutput.prototype._buildLabel=function(e,t,i,n){this.common_term&&(e=this.common_term);var r=!1,a=this.label[n][i];return a&&(r=u.castLabel(this.state,a,e,t,u.TOLERANT)),r};u.NameOutput.prototype._collapseAuthor=function(){var e,t,i;this.state.tmp.name_node.top.blobs.length!==0&&(this.nameset_base===0&&this.Item[this.variables[0]]&&!this._first_creator_variable&&(this._first_creator_variable=this.variables[0]),(this.state[this.state.tmp.area].opt.collapse&&this.state[this.state.tmp.area].opt.collapse.length||this.state[this.state.tmp.area].opt.cite_group_delimiter&&this.state[this.state.tmp.area].opt.cite_group_delimiter.length)&&(this.state.tmp.authorstring_request?(t="",e=this.state.tmp.name_node.top.blobs.slice(-1)[0].blobs,i=this.state.tmp.offset_characters,e&&(t=this.state.output.string(this.state,e,!1)),this.state.tmp.offset_characters=i,this.state.registry.authorstrings[this.Item.id]=t):!this.state.tmp.just_looking&&!this.state.tmp.suppress_decorations&&(this.state[this.state.tmp.area].opt.collapse&&this.state[this.state.tmp.area].opt.collapse.length||this.state[this.state.tmp.area].opt.cite_group_delimiter&&this.state[this.state.tmp.area].opt.cite_group_delimiter)&&(t="",e=this.state.tmp.name_node.top.blobs.slice(-1)[0].blobs,i=this.state.tmp.offset_characters,e&&(t=this.state.output.string(this.state,e,!1)),t===this.state.tmp.last_primary_names_string?((this.item["suppress-author"]||this.state[this.state.tmp.area].opt.collapse&&this.state[this.state.tmp.area].opt.collapse.length)&&(this.state.tmp.name_node.top.blobs.pop(),this.state.tmp.name_node.children=[],this.state.tmp.offset_characters=i),this.state[this.state.tmp.area].opt.cite_group_delimiter&&this.state[this.state.tmp.area].opt.cite_group_delimiter&&(this.state.tmp.use_cite_group_delimiter=!0)):(this.state.tmp.last_primary_names_string=t,this.variables.indexOf(this._first_creator_variable)>-1&&this.item&&this.item["suppress-author"]&&this.Item.type!=="legal_case"&&(this.state.tmp.name_node.top.blobs.pop(),this.state.tmp.name_node.children=[],this.state.tmp.offset_characters=i,this.state.tmp.term_predecessor=!1),this.state.tmp.have_collapsed=!1,this.state[this.state.tmp.area].opt.cite_group_delimiter&&this.state[this.state.tmp.area].opt.cite_group_delimiter&&(this.state.tmp.use_cite_group_delimiter=!1)))))};u.NameOutput.prototype.isPerson=function(e){return!(e.literal||!e.given&&e.family&&e.isInstitution)};u.NameOutput.prototype.truncatePersonalNameLists=function(){var e,t,i,n,r,a;this.freeters_count={},this.persons_count={},this.institutions_count={};for(e in this.freeters)this.freeters.hasOwnProperty(e)&&(this.freeters_count[e]=this.freeters[e].length,this.freeters[e]=this._truncateNameList(this.freeters,e));for(e in this.persons)if(this.persons.hasOwnProperty(e))for(this.institutions_count[e]=this.institutions[e].length,this._truncateNameList(this.institutions,e),this.persons[e]=this.persons[e].slice(0,this.institutions[e].length),this.persons_count[e]=[],n=0,r=this.persons[e].length;n<r;n+=1)this.persons_count[e][n]=this.persons[e][n].length,this.persons[e][n]=this._truncateNameList(this.persons,e,n);if(this.state.opt.development_extensions.etal_min_etal_usefirst_hack&&this.etal_min===1&&this.etal_use_first===1&&!(this.state.tmp.extension||this.state.tmp.just_looking)?a=e:a=!1,a||this._please_chop)for(t=0,i=this.variables.length;t<i;t+=1){e=this.variables[t],this.freeters[e].length&&(this._please_chop===e?(this.freeters[e]=this.freeters[e].slice(1),this.freeters_count[e]+=-1,this._please_chop=!1):a&&!this._please_chop&&(this.freeters[e]=this.freeters[e].slice(0,1),this.freeters_count[e]=1,this.institutions[e]=[],this.persons[e]=[],this._please_chop=a));for(var n=0,r=this.persons[e].length;n<r;n++)if(this.persons[e][n].length){if(this._please_chop===e){this.persons[e][n]=this.persons[e][n].slice(1),this.persons_count[e][n]+=-1,this._please_chop=!1;break}else if(a&&!this._please_chop){this.freeters[e]=this.persons[e][n].slice(0,1),this.freeters_count[e]=1,this.institutions[e]=[],this.persons[e]=[],this._please_chop=a;break}}this.institutions[e].length&&(this._please_chop===e?(this.institutions[e]=this.institutions[e].slice(1),this.institutions_count[e]+=-1,this._please_chop=!1):a&&!this._please_chop&&(this.institutions[e]=this.institutions[e].slice(0,1),this.institutions_count[e]=1,this._please_chop=a))}for(t=0,i=this.variables.length;t<i;t+=1){this.institutions[e].length&&(this.nameset_offset+=1);for(var n=0,r=this.persons[e].length;n<r;n++)this.persons[e][n].length&&(this.nameset_offset+=1)}};u.NameOutput.prototype._truncateNameList=function(e,t,i){var n;if(typeof i>"u"?n=e[t]:n=e[t][i],this.state[this.state[this.state.tmp.area].root].opt.max_number_of_names&&n.length>50&&n.length>this.state[this.state[this.state.tmp.area].root].opt.max_number_of_names+2){var r=this.state[this.state[this.state.tmp.area].root].opt.max_number_of_names;n=n.slice(0,r+1).concat(n.slice(-1))}return n};u.NameOutput.prototype.divideAndTransliterateNames=function(){var e,t,i,n,r=this.Item,a=this.variables;for(this.varnames=a.slice(),this.freeters={},this.persons={},this.institutions={},e=0,t=a.length;e<t;e+=1){var o=a[e];this.variable_offset[o]=this.nameset_offset;var l=this._normalizeVariableValue(r,o);if(this.name.strings["suppress-min"]&&l.length>=this.name.strings["suppress-min"]&&(l=[]),this.name.strings["suppress-max"]&&l.length<=this.name.strings["suppress-max"]&&(l=[]),this._getFreeters(o,l),this._getPersonsAndInstitutions(o,l),this.state.opt.development_extensions.spoof_institutional_affiliations){if(this.name.strings["suppress-min"]===0)for(this.freeters[o]=[],i=0,n=this.persons[o].length;i<n;i+=1)this.persons[o][i]=[];else if(this.institution.strings["suppress-min"]===0){for(this.institutions[o]=[],this.freeters[o]=this.freeters[o].concat(this.persons[o]),i=0,n=this.persons[o].length;i<n;i+=1)for(var c=0,f=this.persons[o][i].length;c<f;c+=1)this.freeters[o].push(this.persons[o][i][c]);this.persons[o]=[]}}}};u.NameOutput.prototype._normalizeVariableValue=function(e,t){var i;return typeof e[t]=="string"||typeof e[t]=="number"?(u.debug('name variable "'+t+'" is string or number, not array. Attempting to fix.'),i=[{literal:e[t]+""}]):e[t]?(typeof e[t].length!="number"&&(u.debug('name variable "'+t+'" is object, not array. Attempting to fix.'),e[t]=[e[t]]),i=e[t].slice()):i=[],i};u.NameOutput.prototype._getFreeters=function(e,t){if(this.freeters[e]=[],this.state.opt.development_extensions.spoof_institutional_affiliations)for(var i=t.length-1;i>-1&&this.isPerson(t[i]);i--){var n=this._checkNickname(t.pop());n&&this.freeters[e].push(n)}else for(var i=t.length-1;i>-1;i--){var n=t.pop();if(this.isPerson(n))var n=this._checkNickname(n);this.freeters[e].push(n)}this.freeters[e].reverse(),this.freeters[e].length&&(this.nameset_offset+=1)};u.NameOutput.prototype._getPersonsAndInstitutions=function(e,t){if(this.persons[e]=[],this.institutions[e]=[],!!this.state.opt.development_extensions.spoof_institutional_affiliations){for(var i=[],n=!1,r=!0,a=t.length-1;a>-1;a+=-1)if(this.isPerson(t[a])){var o=this._checkNickname(t[a]);o&&i.push(o)}else n=!0,this.institutions[e].push(t[a]),r||(i.reverse(),this.persons[e].push(i),i=[]),r=!1;n&&(i.reverse(),this.persons[e].push(i),this.persons[e].reverse(),this.institutions[e].reverse())}};u.NameOutput.prototype._clearValues=function(e){for(var t=e.length-1;t>-1;t+=-1)e.pop()};u.NameOutput.prototype._checkNickname=function(e){if(["interview","personal_communication"].indexOf(this.Item.type)>-1){var t="";if(t=u.Util.Names.getRawName(e),t&&this.state.sys.getAbbreviation&&!(this.item&&this.item["suppress-author"])){var i=t;this.state.sys.normalizeAbbrevsKey&&(i=this.state.sys.normalizeAbbrevsKey("author",t)),this.state.transform.loadAbbreviation("default","nickname",i,this.Item.language);var n=this.state.transform.abbrevs.default.nickname[i];n&&(n==="!here>>>"?e=!1:e={family:n,given:""})}}return e};u.NameOutput.prototype._purgeEmptyBlobs=function(e){for(var t=e.length-1;t>-1;t+=-1)(!e[t]||e[t].length===0||!e[t].blobs.length)&&(e=e.slice(0,t).concat(e.slice(t+1)));return e};u.NameOutput.prototype.joinPersons=function(e,t,i,n){var r;return e=this._purgeEmptyBlobs(e),typeof i>"u"?this.etal_spec[t].freeters===1?r=this._joinEtAl(e):this.etal_spec[t].freeters===2?r=this._joinEllipsis(e):this.state.tmp.sort_key_flag?r=this._join(e,this.state.inheritOpt(this.name,"delimiter","name-delimiter",", ")):r=this._joinAnd(e):this.etal_spec[t].persons[i]===1?r=this._joinEtAl(e):this.etal_spec[t].persons[i]===2?r=this._joinEllipsis(e):this.state.tmp.sort_key_flag?r=this._join(e,this.state.inheritOpt(this.name,"delimiter","name-delimiter",", ")):r=this._joinAnd(e),r};u.NameOutput.prototype.joinInstitutionSets=function(e,t){var i;return e=this._purgeEmptyBlobs(e),this.etal_spec[t].institutions===1?i=this._joinEtAl(e,"institution"):this.etal_spec[t].institutions===2?i=this._joinEllipsis(e,"institution"):i=this._joinAnd(e),i};u.NameOutput.prototype.joinPersonsAndInstitutions=function(e){e=this._purgeEmptyBlobs(e);var t=this._join(e,this.state.tmp.name_delimiter);return t.isInstitution=!0,t};u.NameOutput.prototype.joinFreetersAndInstitutionSets=function(e){e=this._purgeEmptyBlobs(e);var t=this._join(e,"[never here]",this.with.single,this.with.multiple);return t};u.NameOutput.prototype._getAfterInvertedName=function(e,t,i){if(i&&e.length>1&&this.state.inheritOpt(this.name,"delimiter-precedes-last")==="after-inverted-name"){var n=e[e.length-2];n.blobs.length>0&&n.blobs[0].isInverted&&(i.strings.prefix=t)}return i};u.NameOutput.prototype._getAndJoin=function(e,t){var i=!1;if(e.length>1){var n="single";e.length>2&&(n="multiple"),e[e.length-1].isInstitution?i=this.institution.and[n]:i=this.name.and[n],i=JSON.parse(JSON.stringify(i)),i=this._getAfterInvertedName(e,t,i)}return i};u.NameOutput.prototype._joinEtAl=function(e){var t=this.state.inheritOpt(this.name,"delimiter","name-delimiter",", "),i=this._join(e,t);return this.state.output.openLevel(this._getToken("name")),this.state.output.current.value().strings.delimiter="",this.state.output.append(i,"literal",!0),e.length>1?this.state.output.append(this["et-al"].multiple,"literal",!0):e.length===1&&this.state.output.append(this["et-al"].single,"literal",!0),this.state.output.closeLevel(),this.state.output.pop()};u.NameOutput.prototype._joinEllipsis=function(e){var t=this.state.inheritOpt(this.name,"delimiter","name-delimiter",", "),i=!1;if(e.length>1){var n="single";e.length>2&&(n="multiple"),i=JSON.parse(JSON.stringify(this.name.ellipsis[n])),i=this._getAfterInvertedName(e,t,i)}return this._join(e,t,i)};u.NameOutput.prototype._joinAnd=function(e){var t=this.state.inheritOpt(this.name,"delimiter","name-delimiter",", "),i=this._getAndJoin(e,t);return this._join(e,t,i)};u.NameOutput.prototype._join=function(e,t,i){var n,r;if(!e||(e=this._purgeEmptyBlobs(e),!e.length))return!1;if(e.length>1)if(e.length===2)i?e=[e[0],i,e[1]]:e[0].strings.suffix+=t;else{var a;i?a=1:a=0;for(var o=e.pop(),n=0,r=e.length-a;n<r;n++)e[n].strings.suffix+=t;e.push(i),e.push(o)}for(this.state.output.openLevel(),n=0,r=e.length;n<r;n+=1)this.state.output.append(e[n],!1,!0);return this.state.output.closeLevel(),this.state.output.pop()};u.NameOutput.prototype._getToken=function(e){var t=this[e];if(e==="institution"){var i=new u.Token;return i}return t};u.NameOutput.prototype.checkCommonAuthor=function(e){if(!e)return!1;var t=!1;if(this.variables.length===2){var i=this.variables,n=i.slice();n.sort(),t=n.join("")}if(!t)return!1;var r=!1;if(this.state.locale[this.state.opt.lang].terms[t]&&(r=!0),!r)return this.state.tmp.done_vars.push(this.variables[0]),this.state.tmp.done_vars.push(this.variables[1]),!1;var a=this.Item[this.variables[0]],o=this.Item[this.variables[1]],l=this._compareNamesets(a,o);return l===!0&&(this.state.tmp.done_vars.push(this.variables[0]),this.state.tmp.done_vars.push(this.variables[1])),!l};u.NameOutput.prototype.setCommonTerm=function(){var e=this.variables,t=e.slice();if(t.sort(),this.common_term=t.join(""),!!this.common_term){var i=!1;if(this.label&&this.label[this.variables[0]]&&(this.label[this.variables[0]].before?i=this.state.getTerm(this.common_term,this.label[this.variables[0]].before.strings.form,0):this.label[this.variables[0]].after&&(i=this.state.getTerm(this.common_term,this.label[this.variables[0]].after.strings.form,0))),!this.state.locale[this.state.opt.lang].terms[this.common_term]||!i||this.variables.length<2){this.common_term=!1;return}for(var n=0,r=this.variables.length-1;n<r;n+=1){var a=this.variables[n],o=this.variables[n+1];if((this.freeters[a].length||this.freeters[o].length)&&(this.etal_spec[a].freeters!==this.etal_spec[o].freeters||!this._compareNamesets(this.freeters[a],this.freeters[o]))){this.common_term=!1;return}if(this.persons[a].length!==this.persons[o].length){this.common_term=!1;return}for(var l=0,c=this.persons[a].length;l<c;l+=1)if(this.etal_spec[a].persons[l]!==this.etal_spec[o].persons[l]||!this._compareNamesets(this.persons[a][l],this.persons[o][l])){this.common_term=!1;return}}}};u.NameOutput.prototype._compareNamesets=function(e,t){if(!e||!t||e.length!==t.length)return!1;for(var i=0,n=t.length;i<n;i+=1)for(var r=0,a=u.NAME_PARTS.length;r<a;r+=1){var o=u.NAME_PARTS[r];if(!e[i]||e[i][o]!=t[i][o])return!1}return!0};u.NameOutput.prototype.constrainNames=function(){this.names_count=0;for(var e,t=0,i=this.variables.length;t<i;t+=1){var n=this.variables[t];e=this.nameset_base+t,this.freeters[n].length&&(this.state.tmp.names_max.push(this.freeters[n].length,"literal"),this._imposeNameConstraints(this.freeters,this.freeters_count,n,e),this.names_count+=this.freeters[n].length),this.institutions[n].length&&(this.state.tmp.names_max.push(this.institutions[n].length,"literal"),this._imposeNameConstraints(this.institutions,this.institutions_count,n,e),this.persons[n]=this.persons[n].slice(0,this.institutions[n].length),this.names_count+=this.institutions[n].length);for(var r=0,a=this.persons[n].length;r<a;r+=1)this.persons[n][r].length&&(this.state.tmp.names_max.push(this.persons[n][r].length,"literal"),this._imposeNameConstraints(this.persons[n],this.persons_count[n],r,e),this.names_count+=this.persons[n][r].length)}};u.NameOutput.prototype._imposeNameConstraints=function(e,t,i,n){var r=e[i],a=this.state.tmp["et-al-min"];this.state.tmp.suppress_decorations?this.state.tmp.disambig_request&&this.state.tmp.disambig_request.names[n]?a=this.state.tmp.disambig_request.names[n]:t[i]>=this.etal_min&&(a=this.etal_use_first):(this.state.tmp.disambig_request&&this.state.tmp.disambig_request.names[n]>this.etal_use_first?t[i]<this.etal_min?a=t[i]:a=this.state.tmp.disambig_request.names[n]:t[i]>=this.etal_min&&(a=this.etal_use_first),this.etal_use_last&&a>this.etal_min-2&&(a=this.etal_min-2));var o=this.etal_min>=this.etal_use_first,l=t[i]>a;a>t[i]&&(a=r.length),o&&l&&(this.etal_use_last?e[i]=r.slice(0,a).concat(r.slice(-1)):e[i]=r.slice(0,a)),this.state.tmp.disambig_settings.names[n]=e[i].length,this.state.disambiguate.padBase(this.state.tmp.disambig_settings)};u.NameOutput.prototype.disambigNames=function(){for(var e,t=0,i=this.variables.length;t<i;t+=1){var n=this.variables[t];if(e=this.nameset_base+t,this.freeters[n].length&&this._runDisambigNames(this.freeters[n],e),this.institutions[n].length){typeof this.state.tmp.disambig_settings.givens[e]>"u"&&(this.state.tmp.disambig_settings.givens[e]=[]);for(var r=0,a=this.institutions[n].length;r<a;r+=1)typeof this.state.tmp.disambig_settings.givens[e][r]>"u"&&this.state.tmp.disambig_settings.givens[e].push(2)}for(var r=0,a=this.persons[n].length;r<a;r+=1)this.persons[n][r].length&&this._runDisambigNames(this.persons[n][r],e)}};u.NameOutput.prototype._runDisambigNames=function(e,t){var i,n,r,a,o,l,c;for(o=0,l=e.length;o<l;o+=1)if(!(!e[o].given&&!e[o].family)){if(r=this.state.inheritOpt(this.name,"initialize-with"),this.state.registry.namereg.addname(""+this.Item.id,e[o],o),i=this.state.tmp.disambig_settings.givens[t],typeof i>"u")for(var f=0,p=t+1;f<p;f+=1)this.state.tmp.disambig_settings.givens[f]||(this.state.tmp.disambig_settings.givens[f]=[]);if(i=this.state.tmp.disambig_settings.givens[t][o],typeof i>"u"&&(n=this.state.inheritOpt(this.name,"form","name-form","long"),a=this.state.registry.namereg.evalname(""+this.Item.id,e[o],o,0,n,r),this.state.tmp.disambig_settings.givens[t].push(a)),n=this.state.inheritOpt(this.name,"form","name-form","long"),c=this.state.registry.namereg.evalname(""+this.Item.id,e[o],o,0,n,r),this.state.tmp.disambig_request){var m=this.state.tmp.disambig_settings.givens[t][o];m===1&&this.state.citation.opt["givenname-disambiguation-rule"]==="by-cite"&&(typeof this.state.inheritOpt(this.name,"initialize-with")>"u"||typeof e[o].given>"u")&&(m=2),a=m,this.state.opt["disambiguate-add-givenname"]&&e[o].given&&(a=this.state.registry.namereg.evalname(""+this.Item.id,e[o],o,a,this.state.inheritOpt(this.name,"form","name-form","long"),this.state.inheritOpt(this.name,"initialize-with")))}else a=c;!this.state.tmp.just_looking&&this.item&&this.item.position===u.POSITION_FIRST&&c>a&&(a=c),this.state.tmp.sort_key_flag||(this.state.tmp.disambig_settings.givens[t][o]=a,typeof r=="string"&&(typeof this.name.strings.initialize>"u"||this.name.strings.initialize===!0)&&(this.state.tmp.disambig_settings.use_initials=!0))}};u.NameOutput.prototype.getEtAlConfig=function(){var e=this.item;this["et-al"]={},this.state.output.append(this.etal_term,this.etal_style,!0),this["et-al"].single=this.state.output.pop(),this["et-al"].single.strings.suffix=this.etal_suffix,this["et-al"].single.strings.prefix=this.etal_prefix_single,this.state.output.append(this.etal_term,this.etal_style,!0),this["et-al"].multiple=this.state.output.pop(),this["et-al"].multiple.strings.suffix=this.etal_suffix,this["et-al"].multiple.strings.prefix=this.etal_prefix_multiple,typeof e>"u"&&(e={}),e.position?(this.state.inheritOpt(this.name,"et-al-subsequent-min")?this.etal_min=this.state.inheritOpt(this.name,"et-al-subsequent-min"):this.etal_min=this.state.inheritOpt(this.name,"et-al-min"),this.state.inheritOpt(this.name,"et-al-subsequent-use-first")?this.etal_use_first=this.state.inheritOpt(this.name,"et-al-subsequent-use-first"):this.etal_use_first=this.state.inheritOpt(this.name,"et-al-use-first")):(this.state.tmp["et-al-min"]?this.etal_min=this.state.tmp["et-al-min"]:this.etal_min=this.state.inheritOpt(this.name,"et-al-min"),this.state.tmp["et-al-use-first"]?this.etal_use_first=this.state.tmp["et-al-use-first"]:this.etal_use_first=this.state.inheritOpt(this.name,"et-al-use-first"),typeof this.state.tmp["et-al-use-last"]=="boolean"?this.etal_use_last=this.state.tmp["et-al-use-last"]:this.etal_use_last=this.state.inheritOpt(this.name,"et-al-use-last")),this.state.tmp["et-al-min"]||(this.state.tmp["et-al-min"]=this.etal_min)};u.NameOutput.prototype.setEtAlParameters=function(){var e,t,i,n;for(e=0,t=this.variables.length;e<t;e+=1){var r=this.variables[e];for(typeof this.etal_spec[r]>"u"&&(this.etal_spec[r]={freeters:0,institutions:0,persons:[]}),this.etal_spec[this.nameset_base+e]=this.etal_spec[r],this.freeters[r].length&&this._setEtAlParameter("freeters",r),i=0,n=this.persons[r].length;i<n;i+=1)typeof this.etal_spec[r][i]>"u"&&(this.etal_spec[r].persons[i]=0),this._setEtAlParameter("persons",r,i);this.institutions[r].length&&this._setEtAlParameter("institutions",r)}};u.NameOutput.prototype._setEtAlParameter=function(e,t,i){var n,r;e==="persons"?(n=this.persons[t][i],r=this.persons_count[t][i]):(n=this[e][t],r=this[e+"_count"][t]),n.length<r&&!this.state.tmp.sort_key_flag?this.etal_use_last?e==="persons"?this.etal_spec[t].persons[i]=2:this.etal_spec[t][e]=2:e==="persons"?this.etal_spec[t].persons[i]=1:this.etal_spec[t][e]=1:e==="persons"?this.etal_spec[t].persons[i]=0:this.etal_spec[t][e]=0};u.NameOutput.prototype.renderAllNames=function(){for(var e,t=0,i=this.variables.length;t<i;t+=1){var n=this.variables[t];(this.freeters[n].length||this.institutions[n].length)&&(this.state.tmp.group_context.tip.condition||(this.state.tmp.just_did_number=!1)),e=this.nameset_base+t,this.freeters[n].length&&(this.freeters[n]=this._renderNames(n,this.freeters[n],e));for(var r=0,a=this.institutions[n].length;r<a;r+=1)this.persons[n][r]=this._renderNames(n,this.persons[n][r],e,r)}this.renderInstitutionNames()};u.NameOutput.prototype.renderInstitutionNames=function(){for(var e=0,t=this.variables.length;e<t;e+=1)for(var i=this.variables[e],n=0,r=this.institutions[i].length;n<r;n+=1){var m,a=this.institutions[i][n],n,r,o;this.state.tmp.extension?o=["sort"]:a.isInstitution||a.literal?o=this.state.opt["cite-lang-prefs"].institutions:o=this.state.opt["cite-lang-prefs"].persons;var l={primary:"locale-orig",secondary:!1,tertiary:!1};if(o)for(var c=["primary","secondary","tertiary"],f=0,p=c.length;f<p&&!(o.length-1<f);f+=1)o[f]&&(l[c[f]]="locale-"+o[f]);else l.primary="locale-translat";this.state.tmp.area!=="bibliography"&&!(this.state.tmp.area==="citation"&&this.state.opt.xclass==="note"&&this.item&&!this.item.position)&&(l.secondary=!1,l.tertiary=!1),this.setRenderedName(a);var m=this._renderInstitutionName(i,a,l,n);this.institutions[i][n]=m}};u.NameOutput.prototype._renderInstitutionName=function(e,t,i,n){var r,a,o,l,c,f,p,m=this.getName(t,i.primary,!0),d=m.name,h=m.usedOrig;if(d&&(d=this.fixupInstitution(d,e,n)),r=!1,i.secondary){m=this.getName(t,i.secondary,!1,h);var r=m.name;h=m.usedOrig,r&&(r=this.fixupInstitution(r,e,n))}a=!1,i.tertiary&&(m=this.getName(t,i.tertiary,!1,h),a=m.name,a&&(a=this.fixupInstitution(a,e,n)));var v={l:{pri:!1,sec:!1,ter:!1},s:{pri:!1,sec:!1,ter:!1}};switch(d&&(v.l.pri=d.long,v.s.pri=d.short.length?d.short:d.long),r&&(v.l.sec=r.long,v.s.sec=r.short.length?r.short:r.long),a&&(v.l.ter=a.long,v.s.ter=a.short.length?a.short:a.long),this.institution.strings["institution-parts"]){case"short":d.short.length?(l=this._getShortStyle(),c=[this._composeOneInstitutionPart([v.s.pri,v.s.sec,v.s.ter],i,l,e)]):(o=this._getLongStyle(d,e,n),c=[this._composeOneInstitutionPart([v.l.pri,v.l.sec,v.l.ter],i,o,e)]);break;case"short-long":o=this._getLongStyle(d,e,n),l=this._getShortStyle(),f=this._renderOneInstitutionPart(d.short,l),p=this._composeOneInstitutionPart([v.l.pri,v.l.sec,v.l.ter],i,o,e),c=[f,p];break;case"long-short":o=this._getLongStyle(d,e,n),l=this._getShortStyle(),f=this._renderOneInstitutionPart(d.short,l),p=this._composeOneInstitutionPart([v.l.pri,v.l.sec,v.l.ter],i,o,e),c=[p,f];break;default:o=this._getLongStyle(d,e,n),c=[this._composeOneInstitutionPart([v.l.pri,v.l.sec,v.l.ter],i,o,e)];break}var b=this._join(c," ");return b&&(b.isInstitution=!0),this.state.tmp.name_node.children.push(b),b};u.NameOutput.prototype._composeOneInstitutionPart=function(e,t,i){var n=!1,r=!1,a=!1,o,l,c;if(e[0]){if(o=u.Util.cloneToken(i),this.state.opt.citeAffixes[t.primary]&&this.state.opt.citeAffixes.institutions[t.primary].prefix==="<i>"){for(var f=!1,p=0,m=o.decorations.length;p<m;p+=1)i.decorations[p][0]==="@font-style"&&o.decorations[p][1]==="italic"&&(f=!0);f||o.decorations.push(["@font-style","italic"])}n=this._renderOneInstitutionPart(e[0],o)}e[1]&&(r=this._renderOneInstitutionPart(e[1],i)),e[2]&&(a=this._renderOneInstitutionPart(e[2],i));var d;if(r||a){this.state.output.openLevel("empty"),this.state.output.append(n),l=u.Util.cloneToken(i),t.secondary&&(l.strings.prefix=this.state.opt.citeAffixes.institutions[t.secondary].prefix,l.strings.suffix=this.state.opt.citeAffixes.institutions[t.secondary].suffix,l.strings.prefix||(l.strings.prefix=" "));var h=new u.Token;h.decorations.push(["@font-style","normal"]),h.decorations.push(["@font-weight","normal"]),this.state.output.openLevel(h),this.state.output.append(r,l),this.state.output.closeLevel(),c=u.Util.cloneToken(i),t.tertiary&&(c.strings.prefix=this.state.opt.citeAffixes.institutions[t.tertiary].prefix,c.strings.suffix=this.state.opt.citeAffixes.institutions[t.tertiary].suffix,c.strings.prefix||(c.strings.prefix=" "));var v=new u.Token;v.decorations.push(["@font-style","normal"]),v.decorations.push(["@font-weight","normal"]),this.state.output.openLevel(v),this.state.output.append(a,c),this.state.output.closeLevel(),this.state.output.closeLevel(),d=this.state.output.pop()}else d=n;return d};u.NameOutput.prototype._renderOneInstitutionPart=function(e,t){for(var i=0,n=e.length;i<n;i+=1)if(e[i]){var r=e[i];if(this.state.tmp.strip_periods)r=r.replace(/\./g,"");else for(var a=0,o=t.decorations.length;a<o;a+=1)if(t.decorations[a][0]==="@strip-periods"&&t.decorations[a][1]==="true"){r=r.replace(/\./g,"");break}this.state.tmp.group_context.tip.variable_success=!0,this.state.tmp.can_substitute.replace(!1,u.LITERAL),r==="!here>>>"?e[i]=!1:(this.state.output.append(r,t,!0),e[i]=this.state.output.pop())}return typeof this.institution.strings["part-separator"]>"u"&&(this.institution.strings["part-separator"]=this.state.tmp.name_delimiter),this._join(e,this.institution.strings["part-separator"])};u.NameOutput.prototype._renderNames=function(e,t,i,n){var r=!1;if(t.length){for(var a=[],o=0,l=t.length;o<l;o+=1){var c=t[o],r,f;this.state.tmp.extension?f=["sort"]:c.isInstitution||c.literal?f=this.state.opt["cite-lang-prefs"].institutions:f=this.state.opt["cite-lang-prefs"].persons;var p={primary:"locale-orig",secondary:!1,tertiary:!1};if(f)for(var m=["primary","secondary","tertiary"],d=0,h=m.length;d<h&&!(f.length-1<d);d+=1)p[m[d]]="locale-"+f[d];else p.primary="locale-translat";if((this.state.tmp.sort_key_flag||this.state.tmp.area!=="bibliography"&&!(this.state.tmp.area==="citation"&&this.state.opt.xclass==="note"&&this.item&&!this.item.position))&&(p.secondary=!1,p.tertiary=!1),this.setRenderedName(c),!c.literal&&!c.isInstitution){var v=this._renderPersonalName(e,c,p,i,o,n),b=u.Util.cloneToken(this.name);this.state.output.append(v,b,!0),a.push(this.state.output.pop())}else a.push(this._renderInstitutionName(e,c,p,n))}r=this.joinPersons(a,i,n)}return r};u.NameOutput.prototype._renderPersonalName=function(e,t,i,n,r,a){var o=this.getName(t,i.primary,!0),l=this._renderOnePersonalName(o.name,n,r,a),c=!1;i.secondary&&(o=this.getName(t,i.secondary,!1,o.usedOrig),o.name&&(c=this._renderOnePersonalName(o.name,n,r,a)));var f=!1;i.tertiary&&(o=this.getName(t,i.tertiary,!1,o.usedOrig),o.name&&(f=this._renderOnePersonalName(o.name,n,r,a)));var p;if(c||f){this.state.output.openLevel("empty"),this.state.output.append(l);var m=new u.Token;i.secondary&&(m.strings.prefix=this.state.opt.citeAffixes.persons[i.secondary].prefix,m.strings.suffix=this.state.opt.citeAffixes.persons[i.secondary].suffix,m.strings.prefix||(m.strings.prefix=" ")),this.state.output.append(c,m);var d=new u.Token;i.tertiary&&(d.strings.prefix=this.state.opt.citeAffixes.persons[i.tertiary].prefix,d.strings.suffix=this.state.opt.citeAffixes.persons[i.tertiary].suffix,d.strings.prefix||(d.strings.prefix=" ")),this.state.output.append(f,d),this.state.output.closeLevel(),p=this.state.output.pop()}else p=l;return p};u.NameOutput.prototype._isRomanesque=function(e){var t=2;e.family.replace(/\"/g,"").match(u.ROMANESQUE_REGEXP)||(t=0),!t&&e.given&&e.given.match(u.STARTSWITH_ROMANESQUE_REGEXP)&&(t=1);var i;return t==2&&(e.multi&&e.multi.main?i=e.multi.main.slice(0,2):this.Item.language&&(i=this.Item.language.slice(0,2)),["ja","zh"].indexOf(i)>-1&&(t=1)),t};u.NameOutput.prototype._renderOnePersonalName=function(e,t,i,n){var r=e,a=this._droppingParticle(r,t,n),o=this._familyName(r),l=this._nonDroppingParticle(r),c=this._givenName(r,t,i),f=c.blob,p=this._nameSuffix(r);f===!1&&(a=!1,p=!1);var m=this.state.inheritOpt(this.name,"sort-separator");m||(m="");var d;r["comma-suffix"]?d=", ":d=" ";var h=this._isRomanesque(r);function v(_){return _?typeof _.blobs=="string"?["’","'","-"," "].indexOf(_.blobs.slice(-1))>-1:v(_.blobs[_.blobs.length-1]):!1}var b=v(l),y;["fr","ru","cs"].indexOf(this.state.opt["default-locale"][0].slice(0,2))>-1?y=" ":y=" ";var g,x,k,w;if(h===0)g=this._join([l,o,f],"");else if(h===1||r["static-ordering"])x=this._join([l,o],y),g=this._join([x,f]," ");else if(r["reverse-ordering"])x=this._join([l,o],y),g=this._join([f,x]," ");else if(this.state.tmp.sort_key_flag)this.state.opt["demote-non-dropping-particle"]==="never"?(x=this._join([l,o],y),x=this._join([x,a]," "),x=this._join([x,f],this.state.opt.sort_sep),g=this._join([x,p]," ")):(w=this._join([f,a,l]," "),x=this._join([o,w],this.state.opt.sort_sep),g=this._join([x,p]," "));else if(this.state.inheritOpt(this.name,"name-as-sort-order")==="all"||this.state.inheritOpt(this.name,"name-as-sort-order")==="first"&&i===0&&(n===0||typeof n>"u"))["Lord","Lady"].indexOf(r.given)>-1&&(m=", "),["always","display-and-sort"].indexOf(this.state.opt["demote-non-dropping-particle"])>-1?(w=this._join([f,a],r["comma-dropping-particle"]+" "),w=this._join([w,l]," "),w&&this.given&&(w.strings.prefix=this.given.strings.prefix,w.strings.suffix=this.given.strings.suffix),o&&this.family&&(o.strings.prefix=this.family.strings.prefix,o.strings.suffix=this.family.strings.suffix),x=this._join([o,w],m),g=this._join([x,p],m)):(b?k=this._join([l,o],""):k=this._join([l,o],y),k&&this.family&&(k.strings.prefix=this.family.strings.prefix,k.strings.suffix=this.family.strings.suffix),w=this._join([f,a],r["comma-dropping-particle"]+" "),w&&this.given&&(w.strings.prefix=this.given.strings.prefix,w.strings.suffix=this.given.strings.suffix),x=this._join([k,w],m),g=this._join([x,p],m)),g.isInverted=!0;else{if(r["dropping-particle"]&&r.family&&!r["non-dropping-particle"]){var C=r["dropping-particle"],E=["'","ʼ","’","-"];E.indexOf(C.slice(-1))>-1&&C.slice(0,-1)!=="de"&&(o=this._join([a,o],""),a=!1)}b?(w=this._join([l,o],""),w=this._join([a,w],y)):w=this._join([a,l,o],y),w=this._join([w,p],d),w&&this.family&&(w.strings.prefix=this.family.strings.prefix,w.strings.suffix=this.family.strings.suffix),f&&this.given&&(f.strings.prefix=this.given.strings.prefix,f.strings.suffix=this.given.strings.suffix),w.strings.prefix&&(r["comma-dropping-particle"]="");var B;this.state.inheritOpt(this.name,"initialize-with")&&this.state.inheritOpt(this.name,"initialize-with").match(/[\u00a0\ufeff]/)&&c.initializationLevel===1?B=y:B=" ",g=this._join([f,w],r["comma-dropping-particle"]+B)}return this.state.tmp.group_context.tip.variable_success=!0,this.state.tmp.can_substitute.replace(!1,u.LITERAL),this.state.tmp.term_predecessor=!0,this.state.tmp.name_node.children.push(g),g};u.NameOutput.prototype._normalizeNameInput=function(e){var t={literal:e.literal,family:e.family,isInstitution:e.isInstitution,given:e.given,suffix:e.suffix,"comma-suffix":e["comma-suffix"],"non-dropping-particle":e["non-dropping-particle"],"dropping-particle":e["dropping-particle"],"static-ordering":e["static-ordering"],"static-particles":e["static-particles"],"reverse-ordering":e["reverse-ordering"],"full-form-always":e["full-form-always"],"parse-names":e["parse-names"],"comma-dropping-particle":"",block_initialize:e.block_initialize,multi:e.multi};return this._parseName(t),t};u.NameOutput.prototype._stripPeriods=function(e,t){var i=this[e+"_decor"];if(t){if(this.state.tmp.strip_periods)t=t.replace(/\./g,"");else if(i){for(var n=0,r=i.decorations.length;n<r;n+=1)if(i.decorations[n][0]==="@strip-periods"&&i.decorations[n][1]==="true"){t=t.replace(/\./g,"");break}}}return t};u.NameOutput.prototype._nonDroppingParticle=function(e){var t=e["non-dropping-particle"];t&&this.state.tmp.sort_key_flag&&(t=t.replace(/[\'\u2019]/,""));var i=this._stripPeriods("family",t);return this.state.output.append(i,this.family_decor,!0)?this.state.output.pop():!1};u.NameOutput.prototype._droppingParticle=function(e,t,i){var n=e["dropping-particle"];n&&this.state.tmp.sort_key_flag&&(n=n.replace(/[\'\u2019]/,""));var r=this._stripPeriods("given",n);if(e["dropping-particle"]&&e["dropping-particle"].match(/^et.?al[^a-z]$/))this.state.inheritOpt(this.name,"et-al-use-last")?typeof i>"u"?this.etal_spec[t].freeters=2:this.etal_spec[t].persons=2:typeof i>"u"?this.etal_spec[t].freeters=1:this.etal_spec[t].persons=1,e["comma-dropping-particle"]="";else if(this.state.output.append(r,this.given_decor,!0))return this.state.output.pop();return!1};u.NameOutput.prototype._familyName=function(e){var t=this._stripPeriods("family",e.family);return this.state.output.append(t,this.family_decor,!0)?this.state.output.pop():!1};u.NameOutput.prototype._givenName=function(e,t,i){var n,r=this.state.inheritOpt(this.name,"form","name-form","long")!=="long",a=this.state.inheritOpt(this.name,"initialize")!==!1,o=typeof this.state.inheritOpt(this.name,"initialize-with")=="string"&&!e.block_initialize,l,c;if(e["full-form-always"])c=2;else{r?l=0:o?l=1:l=2;var f=this.state.tmp.disambig_settings.givens[t][i];f>l?c=f:c=l}var p=this.state.citation.opt["givenname-disambiguation-rule"];if(p&&p.slice(-14)==="-with-initials"&&(o=!0),e.family&&c===1)if(o){var m=this.state.inheritOpt(this.name,"initialize-with",!1,"");e.given=u.Util.Names.initializeWith(this.state,e.given,m,!a)}else e.given=u.Util.Names.unInitialize(this.state,e.given);else{if(c===0)return{blob:!1};c===2&&(e.given=u.Util.Names.unInitialize(this.state,e.given))}var d=this._stripPeriods("given",e.given),h=this.state.output.append(d,this.given_decor,!0);return h?(n=this.state.output.pop(),{blob:n,initializationLevel:c}):{blob:!1}};u.NameOutput.prototype._nameSuffix=function(e){var t=e.suffix,i;t&&typeof this.state.inheritOpt(this.name,"initialize-with")=="string"&&(t=u.Util.Names.initializeWith(this.state,t,this.state.inheritOpt(this.name,"initialize-with"),!0)),t=this._stripPeriods("family",t);var n="";t&&t.slice(-1)==="."&&(t=t.slice(0,-1),n=".");var r=this.state.output.append(t,"empty",!0);return r?(i=this.state.output.pop(),i.strings.suffix=n+i.strings.suffix,i):!1};u.NameOutput.prototype._getLongStyle=function(e){var t;return e.short.length?this.institutionpart["long-with-short"]?t=this.institutionpart["long-with-short"]:t=this.institutionpart.long:t=this.institutionpart.long,t||(t=new u.Token),t};u.NameOutput.prototype._getShortStyle=function(){var e;return this.institutionpart.short?e=this.institutionpart.short:e=new u.Token,e};u.NameOutput.prototype._parseName=function(e){if(!e["parse-names"]&&typeof e["parse-names"]<"u")return e;e.family&&!e.given&&e.isInstitution&&(e.literal=e.family,e.family=void 0,e.isInstitution=void 0);var t;e.family&&e.family.slice(0,1)==='"'&&e.family.slice(-1)==='"'||!e["parse-names"]&&typeof e["parse-names"]<"u"?(e.family=e.family.slice(1,-1),t=!0,e["parse-names"]=0):t=!1,this.state.opt.development_extensions.parse_names&&!e["non-dropping-particle"]&&e.family&&!t&&e.given&&(e["static-particles"]||u.parseParticles(e,!0))};u.NameOutput.prototype.getName=function(e,t,i,n){if(n&&t==="locale-orig")return{name:!1,usedOrig:n};e.family||(e.family=""),e.given||(e.given="");var r={};r["static-ordering"]=this.getStaticOrder(e);var a=!0,o;if(t!=="locale-orig"&&(a=!1,e.multi)){for(var l=this.state.opt[t],c=0,f=l.length;c<f;c+=1)if(o=l[c],e.multi._key[o]){a=!0;var p=e.isInstitution;e=e.multi._key[o],e.isInstitution=p,r=this.getNameParams(o),r.transliterated=!0;break}}if(a||(o=!1,e.multi&&e.multi.main?o=e.multi.main:this.Item.language&&(o=this.Item.language),o&&(r=this.getNameParams(o))),!i&&!a)return{name:!1,usedOrig:n};e.family||(e.family=""),e.given||(e.given=""),e.literal&&(delete e.family,delete e.given),e={family:e.family,given:e.given,"non-dropping-particle":e["non-dropping-particle"],"dropping-particle":e["dropping-particle"],suffix:e.suffix,"static-ordering":r["static-ordering"],"static-particles":e["static-particles"],"reverse-ordering":r["reverse-ordering"],"full-form-always":r["full-form-always"],"parse-names":e["parse-names"],"comma-suffix":e["comma-suffix"],"comma-dropping-particle":e["comma-dropping-particle"],transliterated:r.transliterated,block_initialize:r["block-initialize"],literal:e.literal,isInstitution:e.isInstitution,multi:e.multi},!e.literal&&!e.given&&e.family&&e.isInstitution&&(e.literal=e.family),e.literal&&(delete e.family,delete e.given),e=this._normalizeNameInput(e);var m;return n?m=n:m=!a,{name:e,usedOrig:m}};u.NameOutput.prototype.getNameParams=function(e){var t={},i=u.localeResolve(this.Item.language,this.state.opt["default-locale"][0]),n=this.state.locale[i.best]?i.best:this.state.opt["default-locale"][0],r=this.state.locale[n].opts["name-as-sort-order"],a=this.state.locale[n].opts["name-as-reverse-order"],o=this.state.locale[n].opts["name-never-short"],l=e.split("-")[0];return r&&r[l]&&(t["static-ordering"]=!0,t["reverse-ordering"]=!1),a&&a[l]&&(t["reverse-ordering"]=!0,t["static-ordering"]=!1),o&&o[l]&&(t["full-form-always"]=!0),t["static-ordering"]&&(t["block-initialize"]=!0),t};u.NameOutput.prototype.setRenderedName=function(e){if(this.state.tmp.area==="bibliography"){for(var t="",i=0,n=u.NAME_PARTS.length;i<n;i+=1)e[u.NAME_PARTS[i]]&&(t+=e[u.NAME_PARTS[i]]);this.state.tmp.rendered_name.push(t)}};u.NameOutput.prototype.fixupInstitution=function(e,t,i){!e.literal&&e.family&&(e.literal=e.family,delete e.family);var n=e.literal,r=n,a={long:n.split(/\s*\|\s*/),short:r.split(/\s*\|\s*/)};if(this.state.sys.getAbbreviation){if(this.institution.strings.form==="short"){let d=this.Item.jurisdiction;d=this.state.transform.loadAbbreviation(d,"institution-entire",n,this.Item.language),this.state.transform.abbrevs[d]["institution-entire"][n]?n=this.state.transform.abbrevs[d]["institution-entire"][n]:(d=this.Item.jurisdiction,d=this.state.transform.loadAbbreviation(d,"institution-part",n,this.Item.language),this.state.transform.abbrevs[d]["institution-part"][n]&&(n=this.state.transform.abbrevs[d]["institution-part"][n])),n=this._quashChecks(d,n)}if(["short","short-long","long-short"].indexOf(this.institution.strings["institution-parts"])>-1){let d=this.Item.jurisdiction;d=this.state.transform.loadAbbreviation(d,"institution-part",r,this.Item.language),this.state.transform.abbrevs[d]["institution-part"][r]&&(r=this.state.transform.abbrevs[d]["institution-part"][r]),r=this._quashChecks(d,r),["short-long","long-short"].indexOf(this.institution.strings["institution-parts"])>-1&&r===n&&(r="")}if(a.long=n.split(/\s*\|\s*/),a.short=r.split(/\s*\|\s*/),["short","short-long","long-short"].indexOf(this.institution.strings["institution-parts"])>-1)for(var o=a.short.length-1;o>-1;o--){let d=this.Item.jurisdiction;var l=a.short[o];if(d=this.state.transform.loadAbbreviation(d,"institution-part",l,this.Item.language),this.state.transform.abbrevs[d]["institution-part"][l]&&(a.short[o]=this.state.transform.abbrevs[d]["institution-part"][l]),a.short[o].indexOf("|")>-1){let h=a.short,v=h[o].split(/\s*\|\s*/);a.short=h.slice(0,o).concat(v).concat(h.slice(o+1))}}if(this.state.opt.development_extensions.legacy_institution_name_ordering&&a.short.reverse(),a.short=this._trimInstitution(a.short),this.institution.strings["reverse-order"]&&a.short.reverse(),!this.state.tmp.just_looking&&this.Item.jurisdiction){let d=this.Item.jurisdiction;var c=this.state.tmp.abbrev_trimmer;if(c&&c[d]&&c[d][t])for(var f=0,p=a.short.length;f<p;f++){var m=a.short[f];a.short[f]=m.replace(c[d][t],"").trim()}}}return this.state.opt.development_extensions.legacy_institution_name_ordering&&a.long.reverse(),a.long=this._trimInstitution(a.long),this.institution.strings["reverse-order"]&&a.long.reverse(),a};u.NameOutput.prototype.getStaticOrder=function(e,t){var i=!1;return(!t&&e["static-ordering"]||this._isRomanesque(e)===0||(!e.multi||!e.multi.main)&&this.Item.language&&["vi","hu"].indexOf(this.Item.language)>-1||e.multi&&e.multi.main&&["vi","hu"].indexOf(e.multi.main.slice(0,2))>-1||this.state.opt["auto-vietnamese-names"]&&u.VIETNAMESE_NAMES.exec(e.family+" "+e.given)&&u.VIETNAMESE_SPECIALS.exec(e.family+e.given))&&(i=!0),i};u.NameOutput.prototype._quashChecks=function(e,i){var i=this.state.transform.quashCheck(e,i),n=i.split(/>>[0-9]{4}>>/),r=i.match(/>>([0-9]{4})>>/);i=n.pop();var a=this.Item["original-date"]?this.Item["original-date"]:this.Item.issued;if(a&&(a=parseInt(a.year,10),a=isNaN(a)?!1:a),a){if(n.length>0)for(var o=r.length-1;o>0&&!(a>=parseInt(r[o],10));o--)i=n.pop();i=i.replace(/\s*\|\s*/g,"|")}return i};u.NameOutput.prototype._trimInstitution=function(e){var t=!1,i=!1,n=!1,r=!1,a=e.slice();if(this.institution){if(typeof this.institution.strings["use-first"]<"u"&&(t=this.institution.strings["use-first"]),typeof this.institution.strings["use-last"]<"u"&&(n=this.institution.strings["use-last"]),typeof this.institution.strings["stop-first"]<"u"&&(r=this.institution.strings["stop-first"]),typeof this.institution.strings["stop-last"]<"u"&&(i=this.institution.strings["stop-last"]),t&&(i&&(a=a.slice(0,i*-1)),a=a.slice(0,t)),n){var o=e.slice();t?r=t:a=[],r&&(o=o.slice(r)),o=o.slice(n*-1),a=a.concat(o)}e=a}return e};u.PublisherOutput=function(e,t){this.state=e,this.group_tok=t,this.varlist=[]};u.PublisherOutput.prototype.render=function(){this.clearVars(),this.composeAndBlob(),this.composeElements(),this.composePublishers(),this.joinPublishers()};u.PublisherOutput.prototype.composeAndBlob=function(){this.and_blob={};var e=!1;this.group_tok.strings.and==="text"?e=this.state.getTerm("and"):this.group_tok.strings.and==="symbol"&&(e="&");var t=new u.Token;t.strings.suffix=" ",t.strings.prefix=" ",this.state.output.append(e,t,!0);var i=this.state.output.pop();t.strings.prefix=this.group_tok.strings["subgroup-delimiter"],this.state.output.append(e,t,!0);var n=this.state.output.pop();this.and_blob.single=!1,this.and_blob.multiple=!1,e&&(this.group_tok.strings["subgroup-delimiter-precedes-last"]==="always"?this.and_blob.single=n:this.group_tok.strings["subgroup-delimiter-precedes-last"]==="never"?(this.and_blob.single=i,this.and_blob.multiple=i):(this.and_blob.single=i,this.and_blob.multiple=n))};u.PublisherOutput.prototype.composeElements=function(){for(var e=0,t=2;e<t;e+=1)for(var i=["publisher","publisher-place"][e],n=0,r=this["publisher-list"].length;n<r;n+=1){var a=this[i+"-list"][n],o=this[i+"-token"];this.state.output.append(a,o,!0),this[i+"-list"][n]=this.state.output.pop()}};u.PublisherOutput.prototype.composePublishers=function(){for(var e,t=0,i=this["publisher-list"].length;t<i;t+=1)e=[this[this.varlist[0]+"-list"][t],this[this.varlist[1]+"-list"][t]],this["publisher-list"][t]=this._join(e,this.group_tok.strings.delimiter)};u.PublisherOutput.prototype.joinPublishers=function(){var e=this["publisher-list"],t=this._join(e,this.group_tok.strings["subgroup-delimiter"],this.and_blob.single,this.and_blob.multiple,this.group_tok);this.state.output.append(t,"literal")};u.PublisherOutput.prototype._join=u.NameOutput.prototype._join;u.PublisherOutput.prototype._getToken=u.NameOutput.prototype._getToken;u.PublisherOutput.prototype.clearVars=function(){this.state.tmp["publisher-list"]=!1,this.state.tmp["publisher-place-list"]=!1,this.state.tmp["publisher-group-token"]=!1,this.state.tmp["publisher-token"]=!1,this.state.tmp["publisher-place-token"]=!1};u.evaluateLabel=function(e,t,i,n){var r;e.strings.term==="locator"?(n&&n.label&&(n.label==="sub verbo"?r="sub-verbo":r=n.label),r||(r="page")):r=e.strings.term;var a=e.strings.plural;if(typeof a!="number"){var o=n&&e.strings.term==="locator"?n:i;o[e.strings.term]&&(t.processNumber(!1,o,e.strings.term,i.type),a=t.tmp.shadow_numbers[e.strings.term].plural,!t.tmp.shadow_numbers[e.strings.term].labelForm&&!t.tmp.shadow_numbers[e.strings.term].labelDecorations&&(e.strings.form?t.tmp.shadow_numbers[e.strings.term].labelForm=e.strings.form:t.tmp.group_context.tip.label_form&&(t.tmp.shadow_numbers[e.strings.term].labelForm=t.tmp.group_context.tip.label_form),t.tmp.shadow_numbers[e.strings.term].labelCapitalizeIfFirst=e.strings.capitalize_if_first,t.tmp.shadow_numbers[e.strings.term].labelDecorations=e.decorations.slice()),["locator","number","page"].indexOf(e.strings.term)>-1&&t.tmp.shadow_numbers[e.strings.term].label&&(r=t.tmp.shadow_numbers[e.strings.term].label),e.decorations&&t.opt.development_extensions.csl_reverse_lookup_support&&(e.decorations.reverse(),e.decorations.push(["@showid","true",e.cslid]),e.decorations.reverse()))}return u.castLabel(t,e,r,a,u.TOLERANT)};u.castLabel=function(e,t,i,n,r){var a=t.strings.form,o=t.strings.capitalize_if_first;e.tmp.group_context.tip.label_form&&(a==="static"?e.tmp.group_context.tip.label_static=!0:a=e.tmp.group_context.tip.label_form),e.tmp.group_context.tip.label_capitalize_if_first&&(o=e.tmp.group_context.tip.label_capitalize_if_first);var l=e.getTerm(i,a,n,!1,r,t.default_locale);if(o&&(l=u.Output.Formatters["capitalize-first"](e,l)),e.tmp.strip_periods)l=l.replace(/\./g,"");else for(var c=0,f=t.decorations.length;c<f;c+=1)if(t.decorations[c][0]==="@strip-periods"&&t.decorations[c][1]==="true"){l=l.replace(/\./g,"");break}return l};u.Node.name={build:function(e,t){var i;if([u.SINGLETON,u.START].indexOf(this.tokentype)>-1){var n;typeof e.tmp.root>"u"?(n=void 0,e.tmp.root="citation"):n=e.tmp.root,e.inheritOpt(this,"et-al-subsequent-min")&&e.inheritOpt(this,"et-al-subsequent-min")!==e.inheritOpt(this,"et-al-min")&&(e.opt.update_mode=u.POSITION),e.inheritOpt(this,"et-al-subsequent-use-first")&&e.inheritOpt(this,"et-al-subsequent-use-first")!==e.inheritOpt(this,"et-al-use-first")&&(e.opt.update_mode=u.POSITION),e.tmp.root=n,i=function(r){r.tmp.etal_term="et-al",r.tmp.name_delimiter=r.inheritOpt(this,"delimiter","name-delimiter",", "),r.tmp["delimiter-precedes-et-al"]=r.inheritOpt(this,"delimiter-precedes-et-al"),r.inheritOpt(this,"and")==="text"?this.and_term=r.getTerm("and","long",0):r.inheritOpt(this,"and")==="symbol"&&(r.opt.development_extensions.expect_and_symbol_form?this.and_term=r.getTerm("and","symbol",0):this.and_term="&"),r.tmp.and_term=this.and_term,u.STARTSWITH_ROMANESQUE_REGEXP.test(this.and_term)?(this.and_prefix_single=" ",this.and_prefix_multiple=", ",typeof r.tmp.name_delimiter=="string"&&(this.and_prefix_multiple=r.tmp.name_delimiter),this.and_suffix=" "):(this.and_prefix_single="",this.and_prefix_multiple="",this.and_suffix=""),r.inheritOpt(this,"delimiter-precedes-last")==="always"?this.and_prefix_single=r.tmp.name_delimiter:r.inheritOpt(this,"delimiter-precedes-last")==="never"?this.and_prefix_multiple&&(this.and_prefix_multiple=" "):r.inheritOpt(this,"delimiter-precedes-last")==="after-inverted-name"&&(this.and_prefix_single&&(this.and_prefix_single=r.tmp.name_delimiter),this.and_prefix_multiple&&(this.and_prefix_multiple=" ")),this.and={},r.inheritOpt(this,"and")?(r.output.append(this.and_term,"empty",!0),this.and.single=r.output.pop(),this.and.single.strings.prefix=this.and_prefix_single,this.and.single.strings.suffix=this.and_suffix,r.output.append(this.and_term,"empty",!0),this.and.multiple=r.output.pop(),this.and.multiple.strings.prefix=this.and_prefix_multiple,this.and.multiple.strings.suffix=this.and_suffix):r.tmp.name_delimiter&&(this.and.single=new u.Blob(r.tmp.name_delimiter),this.and.single.strings.prefix="",this.and.single.strings.suffix="",this.and.multiple=new u.Blob(r.tmp.name_delimiter),this.and.multiple.strings.prefix="",this.and.multiple.strings.suffix=""),this.ellipsis={},r.inheritOpt(this,"et-al-use-last")&&(this.ellipsis_term="…",this.ellipsis_prefix_single=" ",this.ellipsis_prefix_multiple=r.inheritOpt(this,"delimiter","name-delimiter",", "),this.ellipsis_suffix=" ",this.ellipsis.single=new u.Blob(this.ellipsis_term),this.ellipsis.single.strings.prefix=this.ellipsis_prefix_single,this.ellipsis.single.strings.suffix=this.ellipsis_suffix,this.ellipsis.multiple=new u.Blob(this.ellipsis_term),this.ellipsis.multiple.strings.prefix=this.ellipsis_prefix_multiple,this.ellipsis.multiple.strings.suffix=this.ellipsis_suffix),typeof r.tmp["et-al-min"]>"u"&&(r.tmp["et-al-min"]=r.inheritOpt(this,"et-al-min")),typeof r.tmp["et-al-use-first"]>"u"&&(r.tmp["et-al-use-first"]=r.inheritOpt(this,"et-al-use-first")),typeof r.tmp["et-al-use-last"]>"u"&&(r.tmp["et-al-use-last"]=r.inheritOpt(this,"et-al-use-last")),r.nameOutput.name=this},e.build.name_flag=!0,this.execs.push(i)}t.push(this)}};u.Node["name-part"]={build:function(e){e.build[this.strings.name]=this}};u.Node.names={build:function(e,t){var i;if((this.tokentype===u.START||this.tokentype===u.SINGLETON)&&(u.Util.substituteStart.call(this,e,t),e.build.substitute_level.push(1)),this.tokentype===u.SINGLETON){e.build.names_variables[e.build.names_variables.length-1].concat(this.variables);for(var n in this.variables){var r=this.variables[n],a=e.build.name_label[e.build.name_label.length-1];Object.keys(a).length&&(a[r]=a[Object.keys(a)[0]])}i=function(c){c.nameOutput.reinit(this,this.variables_real[0])},this.execs.push(i)}if(this.tokentype===u.START&&(e.build.names_flag=!0,e.build.name_flag=!1,e.build.names_level+=1,e.build.names_variables.push(this.variables),e.build.name_label.push({}),i=function(c){c.tmp.can_substitute.push(!0),c.tmp.name_node={},c.tmp.name_node.children=[],c.nameOutput.init(this)},this.execs.push(i)),this.tokentype===u.END){for(var n=0,o=3;n<o;n+=1){var l=["family","given","et-al"][n];this[l]=e.build[l],e.build.names_level===1&&(e.build[l]=void 0)}this.label=e.build.name_label[e.build.name_label.length-1],e.build.names_level+=-1,e.build.names_variables.pop(),e.build.name_label.pop(),i=function(c){c.tmp.etal_node?this.etal_style=c.tmp.etal_node:this.etal_style="empty",this.etal_term=c.getTerm(c.tmp.etal_term,"long",0),this.etal_prefix_single=" ",this.etal_prefix_multiple=c.tmp.name_delimiter,c.tmp["delimiter-precedes-et-al"]==="always"?this.etal_prefix_single=c.tmp.name_delimiter:c.tmp["delimiter-precedes-et-al"]==="never"?this.etal_prefix_multiple=" ":c.tmp["delimiter-precedes-et-al"]==="after-inverted-name"&&(this.etal_prefix_single=c.tmp.name_delimiter,this.etal_prefix_multiple=" "),this.etal_suffix="",u.STARTSWITH_ROMANESQUE_REGEXP.test(this.etal_term)||(this.etal_prefix_single===" "&&(this.etal_prefix_single=""),this.etal_prefix_multiple===" "&&(this.etal_prefix_multiple=""),this.etal_suffix===" "&&(this.etal_suffix=""));for(var f=0,p=3;f<p;f+=1){var m=["family","given"][f];c.nameOutput[m]=this[m]}c.nameOutput.with=this.with;var d="with",h="",v="";u.STARTSWITH_ROMANESQUE_REGEXP.test(d)&&(h=" ",v=" ");var b={};b.single=new u.Blob(d),b.single.strings.suffix=v,b.multiple=new u.Blob(d),b.multiple.strings.suffix=v,c.inheritOpt(c.nameOutput.name,"delimiter-precedes-last")==="always"?(b.single.strings.prefix=c.inheritOpt(this,"delimiter","names-delimiter"),b.multiple.strings.prefix=c.inheritOpt(this,"delimiter","names-delimiter")):c.inheritOpt(c.nameOutput.name,"delimiter-precedes-last")==="contextual"?(b.single.strings.prefix=h,b.multiple.strings.prefix=c.inheritOpt(this,"delimiter","names-delimiter")):c.inheritOpt(c.nameOutput.name,"delimiter-precedes-last")==="after-inverted-name"?(b.single.strings.prefix=c.inheritOpt(this,"delimiter","names-delimiter"),b.multiple.strings.prefix=h):(b.single.strings.prefix=h,b.multiple.strings.prefix=h),c.nameOutput.with=b,c.nameOutput.label=this.label,c.nameOutput.etal_style=this.etal_style,c.nameOutput.etal_term=this.etal_term,c.nameOutput.etal_prefix_single=this.etal_prefix_single,c.nameOutput.etal_prefix_multiple=this.etal_prefix_multiple,c.nameOutput.etal_suffix=this.etal_suffix,c.nameOutput.outputNames(),c.tmp["et-al-use-first"]=void 0,c.tmp["et-al-min"]=void 0,c.tmp["et-al-use-last"]=void 0},this.execs.push(i),i=function(c){c.tmp.can_substitute.pop()||c.tmp.can_substitute.replace(!1,u.LITERAL),c.tmp.can_substitute.mystack.length===1&&(c.tmp.can_block_substitute=!1)},this.execs.push(i),e.build.name_flag=!1}t.push(this),(this.tokentype===u.END||this.tokentype===u.SINGLETON)&&(e.build.substitute_level.pop(),u.Util.substituteEnd.call(this,e,t))}};u.Node.number={build:function(e,t){var i;u.Util.substituteStart.call(this,e,t),this.strings.form==="roman"?this.formatter=e.fun.romanizer:this.strings.form==="ordinal"?this.formatter=e.fun.ordinalizer:this.strings.form==="long-ordinal"&&(this.formatter=e.fun.long_ordinalizer),typeof this.successor_prefix>"u"&&(this.successor_prefix=e[e.build.area].opt.layout_delimiter),typeof this.splice_prefix>"u"&&(this.splice_prefix=e[e.build.area].opt.layout_delimiter),i=function(n,r,a){if(this.variables.length!==0){var o;if(o=this.variables[0],typeof a>"u")var a={};if(["locator","locator-extra"].indexOf(o)>-1){if(n.tmp.just_looking||!a[o])return}else if(!r[o])return;o==="collection-number"&&r.type==="legal_case"&&(n.tmp.renders_collection_number=!0);var l=this;if(n.tmp.group_context.tip.force_suppress)return!1;if(["locator","locator-extra"].indexOf(o)>-1?n.processNumber.call(n,l,a,o,r.type):(!n.tmp.group_context.tip.condition&&r[o]&&(n.tmp.just_did_number=(""+r[o]).match(/[0-9]$/)),n.processNumber.call(n,l,r,o,r.type)),this.substring){var c=r[o].slice(this.substring);n.output.append(c,l)}else u.Util.outputNumericField(n,o,r.id);["locator","locator-extra"].indexOf(this.variables_real[0])>-1&&!n.tmp.just_looking&&(n.tmp.done_vars.push(this.variables_real[0]),n.tmp.group_context.tip.done_vars.push(this.variables_real[0]))}},this.execs.push(i),t.push(this),u.Util.substituteEnd.call(this,e,t)}};u.Node.sort={build:function(e,t){if(t=e[e.build.root+"_sort"].tokens,this.tokentype===u.START){e.build.area==="citation"&&(e.opt.sort_citations=!0),e.build.area=e.build.root+"_sort",e.build.extension="_sort";var i=function(n,r){if(n.opt.has_layout_locale){for(var a=u.localeResolve(r.language,n.opt["default-locale"][0]),o=n[n.tmp.area.slice(0,-5)].opt.sort_locales,l,c=0,f=o.length;c<f&&(l=o[c][a.bare],l||(l=o[c][a.best]),!l);c+=1);l||(l=n.opt["default-locale"][0]),n.tmp.lang_sort_hold=n.opt.lang,n.opt.lang=l}};this.execs.push(i)}if(this.tokentype===u.END){e.build.area=e.build.root,e.build.extension="";var i=function(r){r.opt.has_layout_locale&&(r.opt.lang=r.tmp.lang_sort_hold,delete r.tmp.lang_sort_hold)};this.execs.push(i)}t.push(this)}};u.Node.substitute={build:function(e,t){var i;if(this.tokentype===u.START){var n=new u.Token("choose",u.START);u.Node.choose.build.call(n,e,t);var r=new u.Token("if",u.SINGLETON);i=function(){return!!(e.tmp.value.length&&!e.tmp.common_term_match_fail)},r.tests=[i],r.test=e.fun.match.any(r,e,r.tests),t.push(r),i=function(o){o.tmp.can_block_substitute=!0,o.tmp.value.length&&!o.tmp.common_term_match_fail&&o.tmp.can_substitute.replace(!1,u.LITERAL),o.tmp.common_term_match_fail=!1},this.execs.push(i),t.push(this)}if(this.tokentype===u.END){t.push(this);var a=new u.Token("choose",u.END);u.Node.choose.build.call(a,e,t)}}};u.Node.text={build:function(e,t){var i,n,r,a,o,l,c,f,p,m,d;if(this.postponed_macro){var h=u.Util.cloneToken(this);h.name="group",h.tokentype=u.START,u.Node.group.build.call(h,e,t),u.expandMacro.call(e,this,t);var v=u.Util.cloneToken(this);v.name="group",v.tokentype=u.END,this.postponed_macro==="juris-locator-label"&&(v.isJurisLocatorLabel=!0),u.Node.group.build.call(v,e,t)}else{if(u.Util.substituteStart.call(this,e,t),this.variables_real||(this.variables_real=[]),this.variables||(this.variables=[]),n="long",r=0,this.strings.form&&(n=this.strings.form),this.strings.plural&&(r=this.strings.plural),this.variables_real[0]==="citation-number"||this.variables_real[0]==="year-suffix"||this.variables_real[0]==="citation-label")this.variables_real[0]==="citation-number"?(e.build.root==="citation"&&(e.opt.update_mode=u.NUMERIC),e.build.root==="bibliography"&&(e.opt.bib_mode=u.NUMERIC),e[e.tmp.area].opt.collapse==="citation-number"&&(this.range_prefix=e.getTerm("citation-range-delimiter")),this.successor_prefix=e[e.build.area].opt.layout_delimiter,this.splice_prefix=e[e.build.area].opt.layout_delimiter,i=function(k,w,C){if(a=""+w.id,!k.tmp.just_looking){if(k.tmp.area.slice(-5)==="_sort"&&this.variables[0]==="citation-number"){if(k.tmp.area==="bibliography_sort"&&k.tmp.group_context.tip.done_vars.push("citation-number"),k.tmp.area==="citation_sort"&&k.bibliography_sort.tmp.citation_number_map)var E=k.bibliography_sort.tmp.citation_number_map[k.registry.registry[w.id].seq];else var E=k.registry.registry[w.id].seq;E&&(E=u.Util.padding(""+E)),k.output.append(E,this);return}C&&C["author-only"]&&k.tmp.element_trace.replace("suppress-me"),k.tmp.area!=="bibliography_sort"&&k.bibliography_sort.tmp.citation_number_map&&k.bibliography_sort.opt.citation_number_sort_direction===u.DESCENDING?E=k.bibliography_sort.tmp.citation_number_map[k.registry.registry[a].seq]:E=k.registry.registry[a].seq,k.opt.citation_number_slug?k.output.append(k.opt.citation_number_slug,this):(l=new u.NumericBlob(k,!1,E,this,w.id),k.tmp.in_cite_predecessor&&(l.suppress_splice_prefix=!0),k.output.append(l,"literal"))}},this.execs.push(i)):this.variables_real[0]==="year-suffix"?(e.opt.has_year_suffix=!0,e[e.tmp.area].opt.collapse==="year-suffix-ranged"&&(this.range_prefix=e.getTerm("citation-range-delimiter")),this.successor_prefix=e[e.build.area].opt.layout_delimiter,e[e.tmp.area].opt["year-suffix-delimiter"]&&(this.successor_prefix=e[e.build.area].opt["year-suffix-delimiter"]),i=function(k,w){if(k.registry.registry[w.id]&&k.registry.registry[w.id].disambig.year_suffix!==!1&&!k.tmp.just_looking){o=parseInt(k.registry.registry[w.id].disambig.year_suffix,10),k[k.tmp.area].opt.cite_group_delimiter&&(this.successor_prefix=k[k.tmp.area].opt.cite_group_delimiter),l=new u.NumericBlob(k,!1,o,this,w.id),c=new u.Util.Suffixator(u.SUFFIX_CHARS),l.setFormatter(c),k.output.append(l,"literal"),f=!1;for(var C=0,E=k.tmp.group_context.mystack.length;C<E;C++){var B=k.tmp.group_context.mystack[C];if(!B.variable_success&&(B.variable_attempt||!B.variable_attempt&&!B.term_intended)){f=!0;break}}p=k[k.tmp.area].opt["year-suffix-delimiter"],f&&p&&!k.tmp.sort_key_flag&&(k.tmp.splice_delimiter=k[k.tmp.area].opt["year-suffix-delimiter"])}},this.execs.push(i)):this.variables_real[0]==="citation-label"&&(e.build.root==="bibliography"&&(e.opt.bib_mode=u.TRIGRAPH),e.opt.has_year_suffix=!0,i=function(k,w){m=w["citation-label"],m||(m=k.getCitationLabel(w)),k.tmp.just_looking||(d="",k.registry.registry[w.id]&&k.registry.registry[w.id].disambig.year_suffix!==!1&&(o=parseInt(k.registry.registry[w.id].disambig.year_suffix,10),d=k.fun.suffixator.format(o)),m+=d),k.output.append(m,this)},this.execs.push(i));else if(this.strings.term)i=function(k,w){var C=k.opt.gender[w.type],E=this.strings.term;E=k.getTerm(E,n,r,C,u.TOLERANT,this.default_locale);var B;if(E!==""&&(k.tmp.group_context.tip.term_intended=!0),u.UPDATE_GROUP_CONTEXT_CONDITION(k,E,null,this),!k.tmp.term_predecessor&&!(k.opt.class==="in-text"&&k.tmp.area==="citation")?B=u.Output.Formatters["capitalize-first"](k,E):B=E,k.tmp.strip_periods)B=B.replace(/\./g,"");else for(var _=0,S=this.decorations.length;_<S;_+=1)if(this.decorations[_][0]==="@strip-periods"&&this.decorations[_][1]==="true"){B=B.replace(/\./g,"");break}k.output.append(B,this),k.tmp.can_block_substitute&&k.tmp.can_substitute.replace(!1,u.LITERAL)},this.execs.push(i),e.build.term=!1,e.build.form=!1,e.build.plural=!1;else if(this.variables_real.length){if(i=function(k,w){this.variables_real[0]!=="locator"&&(k.tmp.have_collapsed=!1),!k.tmp.group_context.tip.condition&&w[this.variables[0]]&&(k.tmp.just_did_number=!1);var C=w[this.variables[0]];C&&!k.tmp.group_context.tip.condition&&((""+C).slice(-1).match(/[0-9]/)?k.tmp.just_did_number=!0:k.tmp.just_did_number=!1)},this.execs.push(i),u.MULTI_FIELDS.indexOf(this.variables_real[0])>-1||this.variables_real[0].indexOf("-main")>-1||this.variables_real[0].indexOf("-sub")>-1||["language-name","language-name-original"].indexOf(this.variables_real[0])>-1){var b=this.variables[0],y=!1,g=!1,x=!1;n==="short"?this.variables_real[0].slice(-6)!=="-short"&&(g=this.variables_real[0]+"-short"):b=!1,e.build.extension?x=!0:(x=!0,y=!0),i=e.transform.getOutputFunction(this.variables,b,y,g,x)}else u.CITE_FIELDS.indexOf(this.variables_real[0])>-1?i=function(k,w,C){C&&C[this.variables[0]]&&(k.processNumber(this,C,this.variables[0],w.type),u.Util.outputNumericField(k,this.variables[0],w.id),["locator","locator-extra"].indexOf(this.variables_real[0])>-1&&!k.tmp.just_looking&&k.tmp.done_vars.push(this.variables_real[0]))}:["page","page-first","chapter-number","collection-number","edition","issue","number","number-of-pages","number-of-volumes","volume"].indexOf(this.variables_real[0])>-1?i=function(k,w){k.processNumber(this,w,this.variables[0],w.type),u.Util.outputNumericField(k,this.variables[0],w.id)}:["URL","DOI"].indexOf(this.variables_real[0])>-1?i=function(k,w){var C;if(this.variables[0]&&(C=k.getVariable(w,this.variables[0],n),C))if(this.variables[0]==="URL"&&n==="short"&&(C=C.replace(/(.*\.[^\/]+)\/.*/,"$1"),C.match(/\/\/www\./)&&(C=C.replace(/https?:\/\//,""))),k.opt.development_extensions.wrap_url_and_doi)if(!this.decorations.length||this.decorations[0][0]!=="@"+this.variables[0]){var E=u.Util.cloneToken(this),B=new u.Blob(null,null,"url-wrapper");if(B.decorations.push(["@DOI","true"]),this.variables_real[0]==="DOI"){var _;this.strings.prefix&&this.strings.prefix.match(/^.*https:\/\/doi\.org\/$/)&&(C=C.replace(/^https?:\/\/doi\.org\//,""),C.match(/^https?:\/\//)?_="":_="https://doi.org/",E.strings.prefix=this.strings.prefix.slice(0,E.strings.prefix.length-16));var S=new u.Blob(_),T=new u.Blob(C);B.push(S),B.push(T),k.output.append(B,E,!1,!1,!0)}else{var T=new u.Blob(C);B.push(T),k.output.append(B,E,!1,!1,!0)}}else k.output.append(C,this,!1,!1,!0);else{if(this.decorations.length)for(var D=this.decorations.length-1;D>-1;D--)this.decorations[D][0]==="@"+this.variables[0]&&(this.decorations=this.decorations.slice(0,D).concat(this.decorations.slice(D+1)));k.output.append(C,this,!1,!1,!0)}}:this.variables_real[0]==="section"?i=function(k,w){var C;C=k.getVariable(w,this.variables[0],n),C&&k.output.append(C,this)}:this.variables_real[0]==="hereinafter"?i=function(k,w){var C=k.transform.abbrevs.default.hereinafter[w.id];C&&(k.output.append(C,this),k.tmp.group_context.tip.variable_success=!0)}:i=function(k,w){var C;this.variables[0]&&(C=k.getVariable(w,this.variables[0],n),C&&(C=""+C,C=C.split("\\").join(""),k.output.append(C,this)))};this.execs.push(i)}else this.strings.value&&(i=function(k){k.tmp.group_context.tip.term_intended=!0,u.UPDATE_GROUP_CONTEXT_CONDITION(k,this.strings.value,!0,this),k.output.append(this.strings.value,this),k.tmp.can_block_substitute&&k.tmp.can_substitute.replace(!1,u.LITERAL)},this.execs.push(i));t.push(this),u.Util.substituteEnd.call(this,e,t)}}};u.Node.intext={build:function(e,t){if(this.tokentype===u.START){e.build.area="intext",e.build.root="intext",e.build.extension="";var i=function(n,r){n.tmp.area="intext",n.tmp.root="intext",n.tmp.extension=""};this.execs.push(i)}this.tokentype===u.END&&(e.intext_sort={opt:{sort_directions:e.citation_sort.opt.sort_directions}},e.intext.srt=e.citation.srt),t.push(this)}};u.Attributes={};u.Attributes["@disambiguate"]=function(e,t){if(this.tests||(this.tests=[]),t==="true"){e.opt.has_disambiguate=!0;var i=function(n){if(e.tmp.area==="bibliography"){if(e.tmp.disambiguate_count<e.registry.registry[n.id].disambig.disambiguate)return e.tmp.disambiguate_count+=1,!0}else if(e.tmp.disambiguate_maxMax+=1,e.tmp.disambig_settings.disambiguate&&e.tmp.disambiguate_count<e.tmp.disambig_settings.disambiguate)return e.tmp.disambiguate_count+=1,!0;return!1};this.tests.push(i)}else if(t==="check-ambiguity-and-backreference"){var i=function(r){return!!(e.registry.registry[r.id].disambig.disambiguate&&e.registry.registry[r.id]["citation-count"]>1)};this.tests.push(i)}};u.Attributes["@is-numeric"]=function(e,t){this.tests||(this.tests=[]);for(var i=t.split(/\s+/),n=function(a){return function(o,l){var c=o;if(l&&["locator","locator-extra"].indexOf(a)>-1&&(c=l),!c[a])return!1;if(u.NUMERIC_VARIABLES.indexOf(a)>-1){if(e.tmp.shadow_numbers[a]||e.processNumber(!1,c,a,o.type),e.tmp.shadow_numbers[a].numeric)return!0}else if(["title","version"].indexOf(a)>-1&&c[a].slice(-1)===""+parseInt(c[a].slice(-1),10))return!0;return!1}},r=0;r<i.length;r+=1)this.tests.push(n(i[r]))};u.Attributes["@is-uncertain-date"]=function(e,t){this.tests||(this.tests=[]);for(var i=t.split(/\s+/),n=function(o){return function(l){return!!(l[o]&&l[o].circa)}},r=0,a=i.length;r<a;r+=1)this.tests.push(n(i[r]))};u.Attributes["@locator"]=function(e,t){this.tests||(this.tests=[]);var i=t.replace("sub verbo","sub-verbo");i=i.split(/\s+/);for(var n=function(o){return function(l,c){var f;return e.processNumber(!1,c,"locator"),f=e.tmp.shadow_numbers.locator.label,!!(f&&o===f)}},r=0,a=i.length;r<a;r+=1)this.tests.push(n(i[r]))};u.Attributes["@position"]=function(e,t){this.tests||(this.tests=[]);var i;e.opt.update_mode=u.POSITION;for(var n=t.split(/\s+/),r=function(f,p){return!!(p&&u.POSITION_MAP[p.position]>=u.POSITION_MAP[u.POSITION_SUBSEQUENT]&&p["near-note"])},a=function(f,p){return!!(p&&u.POSITION_MAP[p.position]==u.POSITION_MAP[u.POSITION_SUBSEQUENT]&&!p["near-note"])},o=function(f){return function(p,m){if(e.tmp.area==="bibliography")return!1;if(m&&typeof m.position>"u"&&(m.position=0),m&&typeof m.position=="number"){if(m.position===0&&f===0)return!0;if(f>0&&u.POSITION_MAP[m.position]>=u.POSITION_MAP[f])return!0}else if(f===0)return!0;return!1}},l=0,c=n.length;l<c;l+=1){var i=n[l];i==="first"?i=u.POSITION_FIRST:i==="container-subsequent"?i=u.POSITION_CONTAINER_SUBSEQUENT:i==="subsequent"?i=u.POSITION_SUBSEQUENT:i==="ibid"?i=u.POSITION_IBID:i==="ibid-with-locator"&&(i=u.POSITION_IBID_WITH_LOCATOR),i==="near-note"?this.tests.push(r):i==="far-note"?this.tests.push(a):this.tests.push(o(i))}};u.Attributes["@type"]=function(e,t){this.tests||(this.tests=[]);for(var i=t.split(/\s+/),n=function(l){return function(c){var f=c.type===l;return!!f}},r=[],a=0,o=i.length;a<o;a+=1)r.push(n(i[a]));this.tests.push(e.fun.match.any(this,e,r))};u.Attributes["@variable"]=function(e,t){this.tests||(this.tests=[]);var i;if(this.variables=t.split(/\s+/),this.variables_real=this.variables.slice(),this.name==="label"&&this.variables[0])this.strings.term=this.variables[0];else if(["names","date","text","number"].indexOf(this.name)>-1)i=function(o,l,c){for(var f=this.variables.length-1;f>-1;f+=-1)this.variables.pop();for(var f=0,p=this.variables_real.length;f<p;f++)o.tmp.done_vars.indexOf(this.variables_real[f])===-1&&this.variables.push(this.variables_real[f]),o.tmp.can_block_substitute&&o.tmp.done_vars.push(this.variables_real[f])},this.execs.push(i),i=function(o,l,c){for(var f=!1,p=0,m=this.variables.length;p<m;p++){var d=this.variables[p];if(["authority","committee"].indexOf(d)>-1&&typeof l[d]=="string"&&this.name==="names"){var h=!0,v=l[d].split(/\s*;\s*/),b={};if(l.multi&&l.multi._keys[d]){for(var y in l.multi._keys[d])if(b[y]=l.multi._keys[d][y].split(/\s*;\s*/),b[y].length!==v.length){h=!1;break}}h||(v=[l[d]],b=l.multi._keys[d]);for(var g=0,x=v.length;g<x;g++){var k={literal:v[g],multi:{_key:{}}};for(var y in b){var w={literal:b[y][g]};k.multi._key[y]=w}v[g]=k}l[d]=v}if(this.strings.form==="short"&&!l[d]&&(d==="title"?d="title-short":d==="container-title"&&(d="container-title-short")),d==="year-suffix"){f=!0;break}else if(u.DATE_VARIABLES.indexOf(d)>-1){if(o.opt.development_extensions.locator_date_and_revision&&d==="locator-date"){f=!0;break}if(l[d]){for(var C in l[d])if(!(this.dateparts.indexOf(C)===-1&&C!=="literal")&&l[d][C]){f=!0;break}if(f)break}}else if(d==="locator"){c&&c.locator&&(f=!0);break}else if(d==="locator-extra"){c&&c["locator-extra"]&&(f=!0);break}else if(["citation-number","citation-label"].indexOf(d)>-1){f=!0;break}else if(d==="first-reference-note-number"){c&&c["first-reference-note-number"]&&(f=!0);break}else if(d==="first-container-reference-note-number"){c&&c["first-container-reference-note-number"]&&(f=!0);break}else if(d==="hereinafter"){o.transform.abbrevs.default.hereinafter[l.id]&&o.sys.getAbbreviation&&l.id&&(f=!0);break}else{if(typeof l[d]=="object")break;if(typeof l[d]=="string"&&l[d]){f=!0;break}else if(typeof l[d]=="number"){f=!0;break}}if(f)break}if(f){for(var p=0,m=this.variables_real.length;p<m;p++){var d=this.variables_real[p];(d!=="citation-number"||o.tmp.area!=="bibliography")&&(o.tmp.cite_renders_content=!0),o.tmp.group_context.tip.variable_success=!0,o.tmp.can_substitute.value()&&o.tmp.area==="bibliography"&&typeof l[d]=="string"&&(o.tmp.name_node.top=o.output.current.value(),o.tmp.rendered_name.push(l[d]))}o.tmp.can_substitute.replace(!1,u.LITERAL)}else o.tmp.group_context.tip.variable_attempt=!0},this.execs.push(i);else if(["if","else-if","condition"].indexOf(this.name)>-1)for(var n=function(o){return function(l,c){var f=l;if(c&&["locator","locator-extra","first-reference-note-number","first-container-reference-note-number","locator-date"].indexOf(o)>-1&&(f=c),o==="hereinafter"&&e.sys.getAbbreviation&&f.id){if(e.transform.abbrevs.default.hereinafter[f.id])return!0}else if(f[o]){if(typeof f[o]=="number"||typeof f[o]=="string")return!0;if(typeof f[o]=="object"){for(var p in f[o])if(f[o][p])return!0}}return!1}},r=0,a=this.variables.length;r<a;r+=1)this.tests.push(n(this.variables[r]))};u.Attributes["@page"]=function(e,t){this.tests||(this.tests=[]);var i=t.replace("sub verbo","sub-verbo");i=i.split(/\s+/);for(var n=function(o){return function(l){var c;return e.processNumber(!1,l,"page",l.type),e.tmp.shadow_numbers.page.label?e.tmp.shadow_numbers.page.label==="sub verbo"?c="sub-verbo":c=e.tmp.shadow_numbers.page.label:c="page",e.tmp.shadow_numbers.page.values.length>0&&e.tmp.shadow_numbers.page.values[0].gotosleepability&&(e.tmp.shadow_numbers.page.values[0].labelVisibility=!1),o===c}},r=0,a=i.length;r<a;r+=1)this.tests.push(n(i[r]))};u.Attributes["@number"]=function(e,t){this.tests||(this.tests=[]);for(var i=t.split(/\s+/),n=function(o){return function(l){var c;return e.processNumber(!1,l,"number",l.type),e.tmp.shadow_numbers.number.label?c=e.tmp.shadow_numbers.number.label:c="number",o===c}},r=0,a=i.length;r<a;r+=1)this.tests.push(n(i[r]))};u.Attributes["@jurisdiction"]=function(e,t){this.tests||(this.tests=[]);var i=t.split(/\s+/),n=function(r){return function(a){if(!a.jurisdiction)return!1;for(var o=a.jurisdiction,l=0,c=r.length;l<c;l++)if(o===r[l])return!0;return!1}};this.tests.push(n(i))};u.Attributes["@country"]=function(e,t){this.tests||(this.tests=[]);var i=t.split(/\s+/),n=function(r){return function(a){if(!a.country)return!1;for(var o=a.country,l=0,c=r.length;l<c;l++)if(o===r[l])return!0;return!1}};this.tests.push(n(i))};u.Attributes["@context"]=function(e,t){this.tests||(this.tests=[]);var i=function(){if(["bibliography","citation"].indexOf(t)>-1){var n=e.tmp.area.slice(0,t.length);return n===t}else if(t==="alternative")return!!e.tmp.abort_alternative};this.tests.push(i)};u.Attributes["@has-year-only"]=function(e,t){this.tests||(this.tests=[]);for(var i=t.split(/\s+/),n=function(o){return function(l){var c=l[o];return!(!c||c.month||c.season)}},r=0,a=i.length;r<a;r+=1)this.tests.push(n(i[r]))};u.Attributes["@has-to-month-or-season"]=function(e,t){this.tests||(this.tests=[]);for(var i=t.split(/\s+/),n=function(o){return function(l){var c=l[o];return!(!c||!c.month&&!c.season||c.day)}},r=0,a=i.length;r<a;r+=1)this.tests.push(n(i[r]))};u.Attributes["@has-day"]=function(e,t){this.tests||(this.tests=[]);for(var i=t.split(/\s+/),n=function(o){return function(l){var c=l[o];return!(!c||!c.day)}},r=0,a=i.length;r<a;r+=1)this.tests.push(n(i[r]))};u.Attributes["@is-plural"]=function(e,t){this.tests||(this.tests=[]);var i=function(n){var r=n[t];if(r&&r.length){for(var a=0,o=0,l=!1,c=0,f=r.length;c<f;c+=1)e.opt.development_extensions.spoof_institutional_affiliations&&(r[c].literal||r[c].isInstitution&&r[c].family&&!r[c].given)?(o+=1,l=!1):(a+=1,l=!0);if(a>1)return!0;if(o>1)return!0;if(o&&l)return!0}return!1};this.tests.push(i)};u.Attributes["@is-multiple"]=function(e,t){this.tests||(this.tests=[]);var i=function(n){var r=""+n[t],a=r.split(/(?:,\s|\s(?:tot\sen\smet|līdz|oraz|and|bis|έως|και|och|až|do|en|et|in|ir|ja|og|sa|to|un|und|és|și|i|u|y|à|e|a|и|-|–)\s|—|\&)/);return a.length>1};this.tests.push(i)};u.Attributes["@locale"]=function(e,t){this.tests||(this.tests=[]);var i,n,r,a,o,l=e.opt["default-locale"][0];if(this.name==="layout"){if(this.locale_raw=t,this.tokentype===u.START){e.opt.multi_layout||(e.opt.multi_layout=[]);var c=[],f=t.split(/\s+/),p={},m=u.localeResolve(f[0],l);c.push(m),m.generic?p[m.generic]=m.best:p[m.best]=m.best;for(var a=1,o=f.length;a<o;a+=1){var d=u.localeResolve(f[a],l);c.push(d),d.generic?p[d.generic]=m.best:p[d.best]=m.best}e[e.build.area].opt.sort_locales.push(p),e.opt.multi_layout.push(c)}e.opt.has_layout_locale=!0}else{r=t.split(/\s+/);var h=[];for(a=0,o=r.length;a<o;a+=1)n=r[a],i=u.localeResolve(n,l),r[a].length===2&&h.push(i.bare),e.localeConfigure(i,!0),r[a]=i;var v=r.slice(),b=function(y,g,x){return function(k){var w;w=!1;var C=!1,E;for(k.language?E=k.language:E=g,C=u.localeResolve(E,g),a=0,o=y.length;a<o;a+=1)if(C.best===y[a].best){e.tmp.condition_lang_counter_arr.push(e.tmp.condition_counter),e.tmp.condition_lang_val_arr.push(e.opt.lang),e.opt.lang=y[0].best,w=!0;break}return!w&&x.indexOf(C.bare)>-1&&(e.tmp.condition_lang_counter_arr.push(e.tmp.condition_counter),e.tmp.condition_lang_val_arr.push(e.opt.lang),e.opt.lang=y[0].best,w=!0),w}};this.tests.push(b(v,l,h))}};u.Attributes["@alternative-node-internal"]=function(e){this.tests||(this.tests=[]);var t=function(){return function(){return!e.tmp.abort_alternative}};this.tests.push(t())};u.Attributes["@locale-internal"]=function(e,t){this.tests||(this.tests=[]);var i,n,r,a,o;for(r=t.split(/\s+/),this.locale_bares=[],a=0,o=r.length;a<o;a+=1)n=r[a],i=u.localeResolve(n,e.opt["default-locale"][0]),r[a].length===2&&this.locale_bares.push(i.bare),e.localeConfigure(i),r[a]=i;this.locale_default=e.opt["default-locale"][0],this.locale=r[0].best,this.locale_list=r.slice();var l=function(f){return function(p){var m;m=!1;var d=!1;if(p.language&&(n=p.language,d=u.localeResolve(n,e.opt["default-locale"][0]),d.best===e.opt["default-locale"][0]&&(d=!1)),d){for(a=0,o=f.locale_list.length;a<o;a+=1)if(d.best===f.locale_list[a].best){e.opt.lang=f.locale,e.tmp.last_cite_locale=f.locale,e.output.openLevel("empty"),e.output.current.value().new_locale=f.locale,m=!0;break}!m&&f.locale_bares.indexOf(d.bare)>-1&&(e.opt.lang=f.locale,e.tmp.last_cite_locale=f.locale,e.output.openLevel("empty"),e.output.current.value().new_locale=f.locale,m=!0)}return m}},c=this;this.tests.push(l(c))};u.Attributes["@court-class"]=function(e,t){this.tests||(this.tests=[]);for(var i=t.split(/\s+/),n=function(o){return function(l){var c=u.GET_COURT_CLASS(e,l);return c===o}},r=0,a=i.length;r<a;r++)this.tests.push(n(i[r]))};u.Attributes["@container-multiple"]=function(e,t){this.tests||(this.tests=[]);var i=t==="true",n=function(r){return function(a){if(e.tmp.container_item_count[a.container_id]){if(e.tmp.container_item_count[a.container_id]>1)return r}else return!r;return!r}};this.tests.push(n(i))};u.Attributes["@container-subsequent"]=function(e,t){this.tests||(this.tests=[]);var i=t==="true",n=function(r){return function(a){return e.tmp.container_item_pos[a.container_id]>1?r:!r}};this.tests.push(n(i))};u.Attributes["@has-subunit"]=function(e,t){this.tests||(this.tests=[]);var i=function(n){return function(r){var a=0;for(var o in r[n]){var l=r[n][o];if(!l.given){var c=l.literal?l.literal:l.family,f=c.split("|").length;(a===0||f<a)&&(a=f)}}return a>1}};this.tests.push(i(t))};u.Attributes["@cite-form"]=function(e,t){this.tests||(this.tests=[]);var i=function(n){return function(r){return r["cite-form"]===n}};this.tests.push(i(t))};u.Attributes["@disable-duplicate-year-suppression"]=function(e,t){e.opt.disable_duplicate_year_suppression=t.split(/\s+/)};u.Attributes["@consolidate-containers"]=function(e,t){u.Attributes["@track-containers"](e,t);var i=t.split(/\s+/);e.bibliography.opt.consolidate_containers=i};u.Attributes["@track-containers"]=function(e,t){var i=t.split(/\s+/);e.bibliography.opt.track_container_items||(e.bibliography.opt.track_container_items=[]),e.bibliography.opt.consolidate_containers||(e.bibliography.opt.consolidate_containers=[]),e.bibliography.opt.track_container_items=e.bibliography.opt.track_container_items.concat(i)};u.Attributes["@parallel-first"]=function(e,t){e.opt.parallel.enable=!0;var i=t.split(/\s+/);e.opt.track_repeat||(e.opt.track_repeat={}),this.parallel_first={};for(var n in i){var r=i[n];this.parallel_first[r]=!0,e.opt.track_repeat[r]=!0}};u.Attributes["@parallel-last"]=function(e,t){e.opt.parallel.enable=!0;var i=t.split(/\s+/);e.opt.track_repeat||(e.opt.track_repeat={}),this.parallel_last={};for(var n in i){var r=i[n];this.parallel_last[r]=!0,e.opt.track_repeat[r]=!0}};u.Attributes["@parallel-last-to-first"]=function(e,t){e.opt.parallel.enable=!0;var i=t.split(/\s+/);this.parallel_last_to_first={};for(var n=0,r=i.length;n<r;n++)this.parallel_last_to_first[i[n]]=!0};u.Attributes["@parallel-delimiter-override"]=function(e,t){e.opt.parallel.enable=!0,this.strings.set_parallel_delimiter_override=t};u.Attributes["@parallel-delimiter-override-on-suppress"]=function(e,t){e.opt.parallel.enable=!0,this.strings.set_parallel_delimiter_override_on_suppress=t};u.Attributes["@no-repeat"]=function(e,t){e.opt.parallel.enable=!0;var i=t.split(/\s+/);e.opt.track_repeat||(e.opt.track_repeat={}),this.non_parallel={};for(var n in i){var r=i[n];this.non_parallel[r]=!0,e.opt.track_repeat[r]=!0}};u.Attributes["@require"]=function(e,t){e.opt.use_context_condition=!0,this.strings.require=t};u.Attributes["@reject"]=function(e,t){e.opt.use_context_condition=!0,this.strings.reject=t};u.Attributes["@require-comma-on-symbol"]=function(e,t){e.opt.require_comma_on_symbol=t};u.Attributes["@gender"]=function(e,t){this.gender=t};u.Attributes["@cslid"]=function(e,t){this.cslid=parseInt(t,10)};u.Attributes["@capitalize-if-first"]=function(e,t){this.strings.capitalize_if_first_override=t};u.Attributes["@label-capitalize-if-first"]=function(e,t){this.strings.label_capitalize_if_first_override=t};u.Attributes["@label-form"]=function(e,t){this.strings.label_form_override=t};u.Attributes["@part-separator"]=function(e,t){this.strings["part-separator"]=t};u.Attributes["@leading-noise-words"]=function(e,t){this["leading-noise-words"]=t};u.Attributes["@name-never-short"]=function(e,t){this["name-never-short"]=t};u.Attributes["@class"]=function(e,t){e.opt.class=t};u.Attributes["@version"]=function(e,t){e.opt.version=t};u.Attributes["@value"]=function(e,t){this.strings.value=t};u.Attributes["@name"]=function(e,t){this.strings.name=t};u.Attributes["@form"]=function(e,t){this.strings.form=t};u.Attributes["@date-parts"]=function(e,t){this.strings["date-parts"]=t};u.Attributes["@range-delimiter"]=function(e,t){this.strings["range-delimiter"]=t};u.Attributes["@macro"]=function(e,t){this.postponed_macro=t};u.Attributes["@term"]=function(e,t){t==="sub verbo"?this.strings.term="sub-verbo":this.strings.term=t};u.Attributes["@xmlns"]=function(){};u.Attributes["@lang"]=function(e,t){t&&(e.build.lang=t)};u.Attributes["@lingo"]=function(){};u.Attributes["@macro-has-date"]=function(){this["macro-has-date"]=!0};u.Attributes["@suffix"]=function(e,t){this.strings.suffix=t};u.Attributes["@prefix"]=function(e,t){this.strings.prefix=t};u.Attributes["@delimiter"]=function(e,t){this.strings.delimiter=t};u.Attributes["@match"]=function(e,t){this.match=t};u.Attributes["@names-min"]=function(e,t){var i=parseInt(t,10);e[e.build.area].opt.max_number_of_names<i&&(e[e.build.area].opt.max_number_of_names=i),this.strings["et-al-min"]=i};u.Attributes["@names-use-first"]=function(e,t){this.strings["et-al-use-first"]=parseInt(t,10)};u.Attributes["@names-use-last"]=function(e,t){t==="true"?this.strings["et-al-use-last"]=!0:this.strings["et-al-use-last"]=!1};u.Attributes["@sort"]=function(e,t){t==="descending"&&(this.strings.sort_direction=u.DESCENDING)};u.Attributes["@plural"]=function(e,t){t==="always"||t==="true"?this.strings.plural=1:t==="never"||t==="false"?this.strings.plural=0:t==="contextual"&&(this.strings.plural=!1)};u.Attributes["@has-publisher-and-publisher-place"]=function(){this.strings["has-publisher-and-publisher-place"]=!0};u.Attributes["@publisher-delimiter-precedes-last"]=function(e,t){this.strings["publisher-delimiter-precedes-last"]=t};u.Attributes["@publisher-delimiter"]=function(e,t){this.strings["publisher-delimiter"]=t};u.Attributes["@publisher-and"]=function(e,t){this.strings["publisher-and"]=t};u.Attributes["@givenname-disambiguation-rule"]=function(e,t){u.GIVENNAME_DISAMBIGUATION_RULES.indexOf(t)>-1&&(e.citation.opt["givenname-disambiguation-rule"]=t)};u.Attributes["@collapse"]=function(e,t){t&&(e[this.name].opt.collapse=t)};u.Attributes["@cite-group-delimiter"]=function(e,t){t&&(e[e.tmp.area].opt.cite_group_delimiter=t)};u.Attributes["@names-delimiter"]=function(e,t){e.setOpt(this,"names-delimiter",t)};u.Attributes["@name-form"]=function(e,t){e.setOpt(this,"name-form",t)};u.Attributes["@subgroup-delimiter"]=function(e,t){this.strings["subgroup-delimiter"]=t};u.Attributes["@subgroup-delimiter-precedes-last"]=function(e,t){this.strings["subgroup-delimiter-precedes-last"]=t};u.Attributes["@name-delimiter"]=function(e,t){e.setOpt(this,"name-delimiter",t)};u.Attributes["@et-al-min"]=function(e,t){var i=parseInt(t,10);e[e.build.area].opt.max_number_of_names<i&&(e[e.build.area].opt.max_number_of_names=i),e.setOpt(this,"et-al-min",i)};u.Attributes["@et-al-use-first"]=function(e,t){e.setOpt(this,"et-al-use-first",parseInt(t,10))};u.Attributes["@et-al-use-last"]=function(e,t){t==="true"?e.setOpt(this,"et-al-use-last",!0):e.setOpt(this,"et-al-use-last",!1)};u.Attributes["@et-al-subsequent-min"]=function(e,t){var i=parseInt(t,10);e[e.build.area].opt.max_number_of_names<i&&(e[e.build.area].opt.max_number_of_names=i),e.setOpt(this,"et-al-subsequent-min",i)};u.Attributes["@et-al-subsequent-use-first"]=function(e,t){e.setOpt(this,"et-al-subsequent-use-first",parseInt(t,10))};u.Attributes["@suppress-min"]=function(e,t){this.strings["suppress-min"]=parseInt(t,10)};u.Attributes["@suppress-max"]=function(e,t){this.strings["suppress-max"]=parseInt(t,10)};u.Attributes["@and"]=function(e,t){e.setOpt(this,"and",t)};u.Attributes["@delimiter-precedes-last"]=function(e,t){e.setOpt(this,"delimiter-precedes-last",t)};u.Attributes["@delimiter-precedes-et-al"]=function(e,t){e.setOpt(this,"delimiter-precedes-et-al",t)};u.Attributes["@initialize-with"]=function(e,t){e.setOpt(this,"initialize-with",t)};u.Attributes["@initialize"]=function(e,t){t==="false"&&e.setOpt(this,"initialize",!1)};u.Attributes["@name-as-reverse-order"]=function(e,t){this["name-as-reverse-order"]=t};u.Attributes["@name-as-sort-order"]=function(e,t){this.name==="style-options"?this["name-as-sort-order"]=t:e.setOpt(this,"name-as-sort-order",t)};u.Attributes["@sort-separator"]=function(e,t){e.setOpt(this,"sort-separator",t)};u.Attributes["@require-match"]=function(e,t){t==="true"&&(this.requireMatch=!0)};u.Attributes["@exclude-types"]=function(e,t){e.bibliography.opt.exclude_types=t.split(/\s+/)};u.Attributes["@exclude-with-fields"]=function(e,t){e.bibliography.opt.exclude_with_fields=t.split(/\s+/)};u.Attributes["@year-suffix-delimiter"]=function(e,t){e[this.name].opt["year-suffix-delimiter"]=t};u.Attributes["@after-collapse-delimiter"]=function(e,t){e[this.name].opt["after-collapse-delimiter"]=t};u.Attributes["@subsequent-author-substitute"]=function(e,t){e[this.name].opt["subsequent-author-substitute"]=t};u.Attributes["@subsequent-author-substitute-rule"]=function(e,t){e[this.name].opt["subsequent-author-substitute-rule"]=t};u.Attributes["@disambiguate-add-names"]=function(e,t){t==="true"&&(e.opt["disambiguate-add-names"]=!0)};u.Attributes["@disambiguate-add-givenname"]=function(e,t){t==="true"&&(e.opt["disambiguate-add-givenname"]=!0)};u.Attributes["@disambiguate-add-year-suffix"]=function(e,t){t==="true"&&e.opt.xclass!=="numeric"&&(e.opt["disambiguate-add-year-suffix"]=!0)};u.Attributes["@second-field-align"]=function(e,t){(t==="flush"||t==="margin")&&(e[this.name].opt["second-field-align"]=t)};u.Attributes["@hanging-indent"]=function(e,t){t==="true"&&(e.opt.development_extensions.hanging_indent_legacy_number?e[this.name].opt.hangingindent=2:e[this.name].opt.hangingindent=!0)};u.Attributes["@line-spacing"]=function(e,t){t&&t.match(/^[.0-9]+$/)&&(e[this.name].opt["line-spacing"]=parseFloat(t,10))};u.Attributes["@entry-spacing"]=function(e,t){t&&t.match(/^[.0-9]+$/)&&(e[this.name].opt["entry-spacing"]=parseFloat(t,10))};u.Attributes["@near-note-distance"]=function(e,t){e[this.name].opt["near-note-distance"]=parseInt(t,10)};u.Attributes["@substring"]=function(e,t){this.substring=parseInt(t,10)};u.Attributes["@text-case"]=function(e,t){var i=function(n,r){t==="normal"?this.text_case_normal=!0:(this.strings["text-case"]=t,t==="title"&&r.jurisdiction&&(this.strings["text-case"]="passthrough"))};this.execs.push(i)};u.Attributes["@page-range-format"]=function(e,t){e.opt["page-range-format"]=t};u.Attributes["@year-range-format"]=function(e,t){e.opt["year-range-format"]=t};u.Attributes["@default-locale"]=function(e,t){if(this.name==="style"){var i,n,r,o,a,o=t.match(/-x-(sort|translit|translat)-/g);if(o)for(r=0,n=o.length;r<n;r+=1)o[r]=o[r].replace(/^-x-/,"").replace(/-$/,"");for(i=t.split(/-x-(?:sort|translit|translat)-/),a=[i[0]],r=1,n=i.length;r<n;r+=1)a.push(o[r-1]),a.push(i[r]);for(i=a.slice(),n=i.length,r=1;r<n;r+=2)e.opt["locale-"+i[r]].push(i[r+1].replace(/^\s*/g,"").replace(/\s*$/g,""));i.length?e.opt["default-locale"]=i.slice(0,1):e.opt["default-locale"]=["en"]}else t==="true"&&(this.default_locale=!0)};u.Attributes["@default-locale-sort"]=function(e,t){e.opt["default-locale-sort"]=t};u.Attributes["@demote-non-dropping-particle"]=function(e,t){e.opt["demote-non-dropping-particle"]=t};u.Attributes["@initialize-with-hyphen"]=function(e,t){t==="false"&&(e.opt["initialize-with-hyphen"]=!1)};u.Attributes["@institution-parts"]=function(e,t){this.strings["institution-parts"]=t};u.Attributes["@if-short"]=function(e,t){t==="true"&&(this.strings["if-short"]=!0)};u.Attributes["@substitute-use-first"]=function(e,t){this.strings["substitute-use-first"]=parseInt(t,10)};u.Attributes["@use-first"]=function(e,t){this.strings["use-first"]=parseInt(t,10)};u.Attributes["@use-last"]=function(e,t){this.strings["use-last"]=parseInt(t,10)};u.Attributes["@stop-first"]=function(e,t){this.strings["stop-first"]=parseInt(t,10)};u.Attributes["@stop-last"]=function(e,t){this.strings["stop-last"]=parseInt(t,10)*-1};u.Attributes["@reverse-order"]=function(e,t){t==="true"&&(this.strings["reverse-order"]=!0)};u.Attributes["@display"]=function(e,t){e.bibliography.tokens.length===2&&(e.opt.using_display=!0),this.strings.cls=t};u.Stack=function(e,t){this.mystack=[],(t||e)&&this.mystack.push(e),this.tip=this.mystack[0]};u.Stack.prototype.push=function(e,t){t||e?this.mystack.push(e):this.mystack.push(""),this.tip=this.mystack[this.mystack.length-1]};u.Stack.prototype.clear=function(){this.mystack=[],this.tip={}};u.Stack.prototype.replace=function(e,t){this.mystack.length===0&&u.error("Internal CSL processor error: attempt to replace nonexistent stack item with "+e),t||e?this.mystack[this.mystack.length-1]=e:this.mystack[this.mystack.length-1]="",this.tip=this.mystack[this.mystack.length-1]};u.Stack.prototype.pop=function(){var e=this.mystack.pop();return this.mystack.length?this.tip=this.mystack[this.mystack.length-1]:this.tip={},e};u.Stack.prototype.value=function(){return this.mystack.slice(-1)[0]};u.Stack.prototype.length=function(){return this.mystack.length};u.Parallel=function(e){this.state=e};u.Parallel.prototype.StartCitation=function(e,t){if(this.state.tmp.suppress_repeats=[],!(e.length<2)){for(var i=0,n=!1,r=[],a=0,o=e.length-1;a<o;a++){var l=e[a][0],c=e[a+1][0],f=!1,p={};if(e[a][0].seeAlso&&e[a][0].seeAlso.length>0&&!n){f=!0,n=[e[a][0].id].concat(e[a][0].seeAlso);var m=n.slice(),d=e.slice(a);d[0][1].parallel="first";for(var h=0,v=d.length;h<v;h++){var b=d[h][0].id,y=m.indexOf(b);if(i=!1,y===-1?i=a+h-1:a+h===e.length-1&&(i=a+h),i){r.push([a,i]);break}else m=m.slice(0,y).concat(m.slice(y+1))}}a>0&&f&&(this.state.tmp.suppress_repeats[a-1].START=!0,f=!1);for(var g in this.state.opt.track_repeat)if(!l[g]||!c[g])p[g]=!1;else if(typeof c[g]=="string"||typeof c[g]=="number"){if(g==="title"&&l["title-short"]&&c["title-short"])var x=l["title-short"],k=c["title-short"];else var x=l[g],k=c[g];x==k?p[g]=!0:p[g]=!1}else if(typeof l[g].length>"u"){p[g]=!1;var w=l[g].year,C=c[g].year;w&&C&&w==C&&(p[g]=!0)}else{var x=JSON.stringify(l[g]),k=JSON.stringify(c[g]);x===k?p[g]=!0:p[g]=!1}n||(p.ORPHAN=!0),i===a&&(p.END=!0,n=!1),this.state.tmp.suppress_repeats.push(p)}for(var h=0,v=r.length;h<v;h++){var E=e[r[h][0]][0].id;this.state.registry.registry[E].master=!0,this.state.registry.registry[E].siblings=[];for(var B=r[h][0],_=r[h][1],S=B;S<_;S++){this.state.tmp.suppress_repeats[S].SIBLING=!0;var T=e[S+1][0].id;e[S+1][1].parallel="other",this.state.registry.registry[E].siblings.push(T)}}}};u.Parallel.prototype.checkRepeats=function(e){var t=this.state.tmp.cite_index;if(this.state.tmp.suppress_repeats){if(e.parallel_first&&Object.keys(e.parallel_first).length>0){var i=[{}].concat(this.state.tmp.suppress_repeats),n=!0;for(var r in e.parallel_first)(!i[t][r]||i[t].START)&&(n=!1);return n}if(e.parallel_last&&Object.keys(e.parallel_last).length>0){var i=this.state.tmp.suppress_repeats.concat([{}]),n=Object.keys(e.parallel_last).length>0;for(var r in e.parallel_last)(!i[t][r]||i[t].END)&&(n=!1);return n}if(e.non_parallel&&Object.keys(e.non_parallel).length>0){var i=[{}].concat(this.state.tmp.suppress_repeats),n=!0;for(var r in e.non_parallel)i[t][r]||(n=!1);return n}}return!1};u.Util={};u.Util.Match=function(){this.any=function(e,t,i){return function(n,r){for(var a=0,o=i.length;a<o;a+=1){var l=i[a](n,r);if(l)return!0}return!1}},this.none=function(e,t,i){return function(n,r){for(var a=0,o=i.length;a<o;a+=1){var l=i[a](n,r);if(l)return!1}return!0}},this.all=function(e,t,i){return function(n,r){for(var a=0,o=i.length;a<o;a+=1){var l=i[a](n,r);if(!l)return!1}return!0}},this[void 0]=this.all,this.nand=function(e,t,i){return function(n,r){for(var a=0,o=i.length;a<o;a+=1){var l=i[a](n,r);if(!l)return!0}return!1}}};u.Transform=function(e){this.abbrevs={},this.abbrevs.default=new e.sys.AbbreviationSegments;function t(p,m,d){var h="";return e.sys.getHumanForm&&(p==="country"?(h=e.sys.getHumanForm(m.toLowerCase(),!1,!0),h=h.split("|")[0]):p==="jurisdiction"&&(h=e.sys.getHumanForm(m.toLowerCase(),!1,!0),d?h="":h=h.split("|").slice(1).join(", "))),h}function i(p,m,d,h,v,b,y){var g="",x=u.FIELD_CATEGORY_REMAP[b],k;if(!x)return v;var w=b,C=v;p.sys.normalizeAbbrevsKey&&(C=p.sys.normalizeAbbrevsKey(b,v));var E=!1;if(w==="jurisdiction"&&C&&(E=C.indexOf(":")===-1),["jurisdiction","country"].indexOf(b)>-1&&v===v.toLowerCase()&&(C=v.toUpperCase()),p.sys.getAbbreviation){["jurisdiction","country","language-name","language-name-original"].indexOf(w)>-1?k="default":d.jurisdiction?k=d.jurisdiction:k="default";var B=p.transform.loadAbbreviation(k,x,C,d.language);if(p.transform.abbrevs[B][x]&&C){var _=p.transform.abbrevs[B][x][C];m.strings.form==="short"&&_?E?g="":g=_:g=t(w,C,E)}}return!g&&(!p.opt.development_extensions.require_explicit_legal_case_title_short||d.type!=="legal_case")&&h&&d[h]&&y&&(g=d[h]),!g&&!p.sys.getAbbreviation&&p.sys.getHumanForm&&(g=t(w,C,E)),!g&&!E&&(!p.sys.getHumanForm||w!=="jurisdiction")&&(g=v),p.opt.development_extensions.force_title_abbrev_fallback&&w==="title"&&g===v&&d["title-short"]&&(g=d["title-short"]),g}function n(p,m){var d=e.opt["default-locale"][0].slice(0,2),h;if(e.opt.development_extensions.strict_text_case_locales?h=new RegExp("^([a-zA-Z]{2})(?:$|-.*| .*)"):h=new RegExp("^([a-zA-Z]{2})(?:$|-.*|.*)"),p.language){var v=(""+p.language).match(h);v?d=v[1]:d="tlh"}return p.multi&&p.multi&&p.multi.main&&p.multi.main[m]&&(d=p.multi.main[m]),(!e.opt.development_extensions.strict_text_case_locales||e.opt.development_extensions.normalize_lang_keys_to_lowercase)&&(d=d.toLowerCase()),d}function r(p,m,d,h,v,b){var y,g,x,k,w=v,C=!1;if(!p[m])return{name:"",usedOrig:v,token:u.Util.cloneToken(this)};var E=!1;u.VARIABLES_WITH_SHORT_FORM.indexOf(m)>-1&&b&&(m=m+"-short",E=!0);var B=!1,_=null,S=[];m.slice(-6)==="-short"?(S.push(m),S.push(m.slice(0,-6))):S.push(m);for(var T=0,D=S.length;T<D;T++){var H=!1,m=S[T];x={name:"",usedOrig:v,locale:n(p,m)},k=e.opt[d]?e.opt[d].slice():[];var V=!1;if(d==="locale-orig"?(v||(x.name=p[m],x.usedOrig=!1),V=!0,C=!0):h&&(typeof k>"u"||k.length===0)&&(x.name=p[m],x.usedOrig=!0,V=!0,C=!0),!V){for(var M=0,$=k.length;M<$;M+=1)if(y=k[M],g=y.split(/[\-_]/)[0],y&&p.multi&&p.multi._keys[m]&&p.multi._keys[m][y]){x.name=p.multi._keys[m][y],x.locale=y,V=!0,H=!0,C=!1;break}else if(g&&p.multi&&p.multi._keys[m]&&p.multi._keys[m][g]){x.name=p.multi._keys[m][g],x.locale=g,V=!0,H=!0,C=!1;break}!x.name&&h&&(x={name:p[m],usedOrig:!0,locale:n(p,m)},C=!0)}if(x.token=u.Util.cloneToken(this),T===0?(H&&(x.found_variant_ok=!0),_=x,!E&&(typeof k>"u"||k.length===0)&&(B=!0),H&&(B=!0)):!E&&!H&&_?(x=_,m=S[0]):H&&(x.found_variant_ok=!0),["title","container-title"].indexOf(m)>-1&&!w&&(!x.token.strings["text-case"]||x.token.strings["text-case"]==="sentence"||x.token.strings["text-case"]==="normal")){e.opt.lang;var P;C?P=!1:P=x.locale;var W=m.slice(0,-5),L=x.token.strings["text-case"]==="sentence";x.name=u.titlecaseSentenceOrNormal(e,p,W,P,L),delete x.token.strings["text-case"]}if(B)break}return x}this.getTextSubField=r;function a(p,m,d,h){p||(p="default");var v=p.split(":")[0],b=u.getAbbrevsDomain(e,v,h);return b&&(p+="@"+b),d?(e.sys.getAbbreviation&&(p=e.sys.getAbbreviation(e.opt.styleID,e.transform.abbrevs,p,m,d),p||(p="default",b&&(p+="@"+b))),p):(e.transform.abbrevs[p]||(e.transform.abbrevs[p]=new e.sys.AbbreviationSegments),e.transform.abbrevs[p][m]||(e.transform.abbrevs[p][m]={}),p)}this.loadAbbreviation=a;function o(p,m,d,h){var v=p.variables[0];if(e.publisherOutput&&d){if(["publisher","publisher-place"].indexOf(v)===-1)return!1;e.publisherOutput[v+"-token"]=p,e.publisherOutput.varlist.push(v);var b=d.split(/;\s*/);b.length===e.publisherOutput[v+"-list"].length&&(e.publisherOutput[v+"-list"]=b);for(var y=0,g=b.length;y<g;y+=1)b[y]=i(e,p,m,!1,b[y],h,!0);return e.tmp[v+"-token"]=p,!0}return!1}function l(p,m){var d=m.match(/^#([0-9]+).*>>>/);d&&d[1]&&(p["cite-form"]=d[1])}function c(p,m){var d=m.match(/^(?:#[0-9]+)*(?:!((?:[-_a-z]+(?:(?:.*)))(?:,(?:[-_a-z]+(?:(?:.*))))*))*>>>/);if(d&&(m=m.slice(d[0].length),d[1]))for(var h=d[1].split(","),v=0,b=h.length;v<b;v+=1){var y=h[v],g=y.match(/^([-_a-z]+)(?:\:(.*))*$/),x=g[1],k=e.tmp.abbrev_trimmer;g[2]?k&&p&&(k[p]||(k[p]={}),k[p][x]=g[2]):e.tmp.done_vars.indexOf(x)===-1&&(k&&p&&(k.QUASHES[p]||(k.QUASHES[p]={}),k.QUASHES[p][x]=!0),e.tmp.done_vars.push(x))}return m}this.quashCheck=c;function f(p,m,d,h){var v,b=u.LangPrefsMap[p[0]];return b?v=e.opt["cite-lang-prefs"][b]:v=!1,function(y,g,x){var k,w,C,E,B,_,$;if(!p[0]||!g[p[0]]&&!g[h]||!y.tmp.just_looking&&x&&x["suppress-author"]&&!y.tmp.probably_rendered_something&&y.tmp.can_substitute.length()>1)return null;var S={primary:!1,secondary:!1,tertiary:!1};if(y.tmp.area.slice(-5)==="_sort")S.primary="locale-sort";else if(v&&v.length===1&&v[0]==="locale-orig")S.primary="locale-orig",v=!1;else if(v&&!y.tmp.multi_layout)for(var T=["primary","secondary","tertiary"],D=0,H=T.length;D<H&&!(v.length-1<D);D+=1)v[D]&&(S[T[D]]="locale-"+v[D]);else S.primary="locale-orig";if((p[0]==="title-short"||y.tmp.area!=="bibliography"&&!(y.tmp.area==="citation"&&y.opt.xclass==="note"&&x&&!x.position))&&(S.secondary=!1,S.tertiary=!1),y.tmp.multi_layout&&(S.secondary=!1,S.tertiary=!1),y.tmp["publisher-list"])return p[0]==="publisher"?y.tmp["publisher-token"]=this:p[0]==="publisher-place"&&(y.tmp["publisher-place-token"]=this),null;var V=y.tmp.lang_array.slice(),M=r.call(this,g,p[0],S.primary,!0,null,m);k=M.name,w=M.locale;var $=M.token,P=M.usedOrig;if(m&&!M.found_variant_ok&&(k=i(y,$,g,h,k,m,!0),k&&(l(g,k),y.tmp.just_looking||(k=c(g.jurisdiction,k)))),o(this,g,k,m))return y.tmp.lang_array=V,null;C=!1,B=!1;var W,L;S.secondary&&(M=r.call(this,g,p[0],S.secondary,!1,M.usedOrig,null,m),C=M.name,E=M.locale,W=M.token,m&&!M.found_variant_ok&&C&&(C=i(y,W,g,!1,C,m,!0))),S.tertiary&&(M=r.call(this,g,p[0],S.tertiary,!1,M.usedOrig,null,m),B=M.name,_=M.locale,L=M.token,m&&!M.found_variant_ok&&B&&(B=i(y,L,g,!1,B,m,!0)));var Q;if(S.primary==="locale-translit"&&(Q=y.opt.citeAffixes[b][S.primary].prefix),Q==="<i>"&&p[0]==="title"&&!P){for(var j=!1,D=0,H=$.decorations.length;D<H;D+=1)$.decorations[D][0]==="@font-style"&&$.decorations[D][1]==="italic"&&(j=!0);j||$.decorations.push(["@font-style","italic"])}if(w!=="en"&&$.strings["text-case"]==="title"&&($.strings["text-case"]="passthrough"),p[0]==="title"&&(k=u.demoteNoiseWords(y,k,this["leading-noise-words"])),C||B){if(y.output.openLevel("empty"),$.strings.suffix=$.strings.suffix.replace(/[ .,]+$/,""),w&&(y.tmp.lang_array=[w].concat(V)),u.UPDATE_GROUP_CONTEXT_CONDITION(y,null,null,$,$.strings.prefix+k),y.output.append(k,$),y.tmp.probably_rendered_something=!0,k===C&&(C=!1),C){W.strings.prefix=y.opt.citeAffixes[b][S.secondary].prefix,W.strings.suffix=y.opt.citeAffixes[b][S.secondary].suffix,W.strings.prefix||(W.strings.prefix=" ");for(var D=W.decorations.length-1;D>-1;D+=-1)["@quotes/true","@font-style/italic","@font-style/oblique","@font-weight/bold"].indexOf(W.decorations[D].join("/"))>-1&&(W.decorations=W.decorations.slice(0,D).concat(W.decorations.slice(D+1)));E!=="en"&&W.strings["text-case"]==="title"&&(W.strings["text-case"]="passthrough"),E&&(y.tmp.lang_array=[E].concat(V));var O=new u.Token;O.decorations.push(["@font-style","normal"]),O.decorations.push(["@font-weight","normal"]),y.output.openLevel(O),y.output.append(C,W),y.output.closeLevel(),y.output.current.value(),y.output.current.value().blobs.length-1}if(k===B&&(B=!1),B){L.strings.prefix=y.opt.citeAffixes[b][S.tertiary].prefix,L.strings.suffix=y.opt.citeAffixes[b][S.tertiary].suffix,L.strings.prefix||(L.strings.prefix=" ");for(var D=L.decorations.length-1;D>-1;D+=-1)["@quotes/true","@font-style/italic","@font-style/oblique","@font-weight/bold"].indexOf(L.decorations[D].join("/"))>-1&&(L.decorations=L.decorations.slice(0,D).concat(L.decorations.slice(D+1)));_!=="en"&&L.strings["text-case"]==="title"&&(L.strings["text-case"]="passthrough"),_&&(y.tmp.lang_array=[_].concat(V));var R=new u.Token;R.decorations.push(["@font-style","normal"]),R.decorations.push(["@font-weight","normal"]),y.output.openLevel(R),y.output.append(B,L),y.output.closeLevel(),y.output.current.value(),y.output.current.value().blobs.length-1}y.output.closeLevel()}else w&&(y.tmp.lang_array=[w].concat(V)),u.UPDATE_GROUP_CONTEXT_CONDITION(y,null,null,$,$.strings.prefix+k),y.output.append(k,$),y.tmp.probably_rendered_something=!0;return y.tmp.lang_array=V,y.tmp.can_block_substitute&&y.tmp.name_node.children.push(y.output.current.value()),null}}this.getOutputFunction=f};u.Token=function(e,t,i){this.name=e,this.strings={},this.strings.delimiter=void 0,this.strings.prefix="",this.strings.suffix="",this.decorations=[],this.variables=[],this.execs=[],this.tokentype=t};u.Util.cloneToken=function(e){var t,i,n,r;if(typeof e=="string")return e;t=new u.Token(e.name,e.tokentype);for(var i in e.strings)e.strings.hasOwnProperty(i)&&(t.strings[i]=e.strings[i]);if(e.decorations)for(t.decorations=[],n=0,r=e.decorations.length;n<r;n+=1)t.decorations.push(e.decorations[n].slice());return e.variables&&(t.variables=e.variables.slice()),e.execs&&(t.execs=e.execs.slice(),e.tests&&(t.tests=e.tests.slice())),t};u.AmbigConfig=function(){this.maxvals=[],this.minval=1,this.names=[],this.givens=[],this.year_suffix=!1,this.disambiguate=0};u.Blob=function(e,t,i){var n,r,a;if(this.levelname=i,t){this.strings={prefix:"",suffix:""};for(var a in t.strings)t.strings.hasOwnProperty(a)&&(this.strings[a]=t.strings[a]);for(this.decorations=[],t.decorations===void 0?n=0:n=t.decorations.length,r=0;r<n;r+=1)this.decorations.push(t.decorations[r].slice())}else this.strings={},this.strings.prefix="",this.strings.suffix="",this.strings.delimiter="",this.decorations=[];typeof e=="string"?this.blobs=e:e?this.blobs=[e]:this.blobs=[],this.alldecor=[this.decorations]};u.Blob.prototype.push=function(e){typeof this.blobs=="string"?u.error("Attempt to push blob onto string object"):e!==!1&&(e.alldecor=e.alldecor.concat(this.alldecor),this.blobs.push(e))};u.NumericBlob=function(e,t,i,n,r){if(this.id=r,this.alldecor=[],this.num=i,this.particle=t,this.blobs=i.toString(),this.status=u.START,this.strings={},n){if(n.strings["text-case"]){var a=n.strings["text-case"];this.particle=u.Output.Formatters[a](e,this.particle),this.blobs=u.Output.Formatters[a](e,this.blobs)}this.gender=n.gender,this.decorations=n.decorations,this.strings.prefix=n.strings.prefix,this.strings.suffix=n.strings.suffix,this.strings["text-case"]=n.strings["text-case"],this.successor_prefix=n.successor_prefix,this.range_prefix=n.range_prefix,this.splice_prefix=n.splice_prefix,this.formatter=n.formatter,this.formatter||(this.formatter=new u.Output.DefaultFormatter),this.formatter&&(this.type=this.formatter.format(1))}else this.decorations=[],this.strings.prefix="",this.strings.suffix="",this.successor_prefix="",this.range_prefix="",this.splice_prefix="",this.formatter=new u.Output.DefaultFormatter};u.NumericBlob.prototype.setFormatter=function(e){this.formatter=e,this.type=this.formatter.format(1)};u.Output.DefaultFormatter=function(){};u.Output.DefaultFormatter.prototype.format=function(e){return e.toString()};u.NumericBlob.prototype.checkNext=function(e,t){t?(this.status=u.START,typeof e=="object"&&(e.num===this.num+1?e.status=u.SUCCESSOR:e.status=u.SEEN)):!e||!e.num||this.type!==e.type||e.num!==this.num+1?(this.status===u.SUCCESSOR_OF_SUCCESSOR&&(this.status=u.END),typeof e=="object"&&(e.status=u.SEEN)):this.status===u.START||this.status===u.SEEN?e.status=u.SUCCESSOR:(this.status===u.SUCCESSOR||this.status===u.SUCCESSOR_OF_SUCCESSOR)&&(this.range_prefix?(e.status=u.SUCCESSOR_OF_SUCCESSOR,this.status=u.SUPPRESS):e.status=u.SUCCESSOR)};u.NumericBlob.prototype.checkLast=function(e){return this.status===u.SEEN||e.num!==this.num-1&&this.status===u.SUCCESSOR?(this.status=u.SUCCESSOR,!0):!1};u.Util.fixDateNode=function(e,t,i){var n,r,a,o,l,c,f,p,m,d,h,v,b,g=this.cslXml.getAttributeValue(i,"lingo"),y=this.cslXml.getAttributeValue(i,"default-locale");this.build.date_key=!0,n=this.cslXml.getAttributeValue(i,"form");var g;if(y?g=this.opt["default-locale"][0]:g=this.cslXml.getAttributeValue(i,"lingo"),!this.getDate(n,y))return e;var x=this.cslXml.getAttributeValue(i,"date-parts");r=this.cslXml.getAttributeValue(i,"variable"),p=this.cslXml.getAttributeValue(i,"prefix"),m=this.cslXml.getAttributeValue(i,"suffix"),v=this.cslXml.getAttributeValue(i,"display"),b=this.cslXml.getAttributeValue(i,"cslid"),a=this.cslXml.nodeCopy(this.getDate(n,y)),this.cslXml.setAttribute(a,"lingo",this.opt.lang),this.cslXml.setAttribute(a,"form",n),this.cslXml.setAttribute(a,"date-parts",x),this.cslXml.setAttribute(a,"cslid",b),this.cslXml.setAttribute(a,"variable",r),this.cslXml.setAttribute(a,"default-locale",y),p&&this.cslXml.setAttribute(a,"prefix",p),m&&this.cslXml.setAttribute(a,"suffix",m),v&&this.cslXml.setAttribute(a,"display",v),d=this.cslXml.children(a);for(var k in d)o=d[k],this.cslXml.nodename(o)==="date-part"&&(l=this.cslXml.getAttributeValue(o,"name"),y&&this.cslXml.setAttributeOnNodeIdentifiedByNameAttribute(a,"date-part",l,"@default-locale","true"));d=this.cslXml.children(i);for(var k in d)if(o=d[k],this.cslXml.nodename(o)==="date-part"){l=this.cslXml.getAttributeValue(o,"name"),h=this.cslXml.attributes(o);for(c in h)c!=="@name"&&(g&&g!==this.opt.lang&&["@suffix","@prefix","@form"].indexOf(c)>-1||(f=h[c],this.cslXml.setAttributeOnNodeIdentifiedByNameAttribute(a,"date-part",l,c,f)))}if(this.cslXml.getAttributeValue(i,"date-parts")==="year")this.cslXml.deleteNodeByNameAttribute(a,"month"),this.cslXml.deleteNodeByNameAttribute(a,"day");else if(this.cslXml.getAttributeValue(i,"date-parts")==="year-month")this.cslXml.deleteNodeByNameAttribute(a,"day");else if(this.cslXml.getAttributeValue(i,"date-parts")==="month-day"){for(var w=this.cslXml.children(a),C=1,E=this.cslXml.numberofnodes(w);C<E;C++)if(this.cslXml.getAttributeValue(w[C],"name")==="year"){this.cslXml.setAttribute(w[C-1],"suffix","");break}this.cslXml.deleteNodeByNameAttribute(a,"year")}return this.cslXml.insertChildNodeAfter(e,i,t,a)};u.dateMacroAsSortKey=function(e,t){u.dateAsSortKey.call(this,e,t,!0)};u.dateAsSortKey=function(e,t,i){var n,r,a,o,l,c,f,p,m=this.variables[0],d="empty";if(i&&e.tmp.extension&&(d="macro-with-date"),n=t[m],typeof n>"u"&&(n={"date-parts":[[0]]}),typeof this.dateparts>"u"&&(this.dateparts=["year","month","day"]),n.raw?n=e.fun.dateparser.parseDateToArray(n.raw):n["date-parts"]&&(n=e.dateParseArray(n)),typeof n>"u"&&(n={}),n.year)for(f=0,p=u.DATE_PARTS_INTERNAL.length;f<p;f+=1)if(r=u.DATE_PARTS_INTERNAL[f],a=0,o=r,o.slice(-4)==="_end"&&(o=o.slice(0,-4)),n[r]&&this.dateparts.indexOf(o)>-1&&(a=n[r]),r.slice(0,4)==="year"){l=u.Util.Dates[o].numeric(e,a);var c="1";l[0]==="-"&&(c="0",l=l.slice(1),l=9999-parseInt(l,10)),e.output.append(u.Util.Dates[r.slice(0,4)].numeric(e,c+l),d)}else a=u.Util.Dates[o]["numeric-leading-zeros"](e,a),a||(a="00"),e.output.append(a,d)};u.Engine.prototype.dateParseArray=function(e){var t,i,n,r;t={};for(i in e)if(i==="date-parts"){n=e["date-parts"],n.length>1&&n[0].length!==n[1].length&&u.error("CSL data error: element mismatch in date range input."),r=["","_end"];for(var a=0,o=n.length;a<o;a+=1)for(var l=0,c=u.DATE_PARTS.length;l<c;l+=1)isNaN(parseInt(n[a][l],10))?t[u.DATE_PARTS[l]+r[a]]=void 0:t[u.DATE_PARTS[l]+r[a]]=parseInt(n[a][l],10)}else e.hasOwnProperty(i)&&(i==="literal"&&typeof e.literal=="object"&&typeof e.literal.part=="string"?(u.debug("Warning: fixing up weird literal date value"),t.literal=e.literal.part):t[i]=e[i]);return t};u.Util.Names={};u.Util.Names.compareNamesets=u.NameOutput.prototype._compareNamesets;u.Util.Names.unInitialize=function(e,t){var i,n,r,a,o;if(!t)return"";for(r=t.split(/(?:\-|\s+)/),a=t.match(/(\-|\s+)/g),o="",i=0,n=r.length;i<n;i+=1)o+=r[i],i<n-1&&(o+=a[i]);return o};u.Util.Names.initializeWith=function(e,t,i,n){var r,a,o;if(!t)return"";if(i||(i=""),["Lord","Lady"].indexOf(t)>-1||!t.replace(/^(?:<[^>]+>)*/,"").match(u.STARTSWITH_ROMANESQUE_REGEXP)&&!i.match("%s"))return t;e.opt["initialize-with-hyphen"]===!1&&(t=t.replace(/\-/g," ")),t=t.replace(/\s*\-\s*/g,"-").replace(/\s+/g," "),t=t.replace(/-([a-z])/g,"–$1");for(var r=t.length-2;r>-1;r+=-1)t.slice(r,r+1)==="."&&t.slice(r+1,r+2)!==" "&&(t=t.slice(0,r)+". "+t.slice(r+1));var l=u.Output.Formatters.nameDoppel.split(t),c=[];if(c=[l.strings[0]],l.tags.length===0){var f=c[0].match(/[^\.]+$/);f&&f[0].length===1&&f[0]!==f[0].toLowerCase()&&(c[0]+=".")}for(r=1,a=l.strings.length;r<a;r+=1)c.push(l.tags[r-1]),c.push(l.strings[r]);return n?o=this.doNormalize(e,c,i):o=this.doInitialize(e,c,i),o=o.replace(/\u2013([a-z])/g,"-$1"),o};u.Util.Names.notag=function(e){return e.replace(/^(?:<[^>]+>)*/,"")};u.Util.Names.mergetag=function(e,t,i){var n=t.match(/(?:-*<[^>]+>-*)/g);if(n)t=n.join("");else return i;return n=i.match(/^(.*[^\s])*(\s+)$/),n?(n[1]=n[1]?n[1]:"",i=n[1]+t+n[2]):i=i+t,i};u.Util.Names.tagonly=function(e,t){var i=t.match(/(?:<[^>]+>)+/);return i?i.join(""):t};u.Util.Names.doNormalize=function(e,t,i){var n,r;i=i||"";var a=[];for(n=0,r=t.length;n<r;n+=1)this.notag(t[n]).length>1&&this.notag(t[n]).slice(-1)==="."?(t[n]=t[n].replace(/^(.*)\.(.*)$/,"$1$2"),a.push(!0)):t[n].length===1&&t[n].toUpperCase()===t[n]?a.push(!0):a.push(!1);for(n=0,r=t.length;n<r;n+=2)a[n]&&(n<t.length-2&&(t[n+1]=this.tagonly(e,t[n+1]),a[n+2]||(t[n+1]=this.tagonly(e,t[n+1])+" "),t[n+2].length>1?t[n+1]=i.replace(/\ufeff$/,"")+t[n+1]:t[n+1]=this.mergetag(e,t[n+1],i)),n===t.length-1&&(t[n]=t[n]+i));return t.join("").replace(/[\u0009\u000a\u000b\u000c\u000d\u0020\ufeff\u00a0]+$/,"").replace(/\s*\-\s*/g,"-").replace(/[\u0009\u000a\u000b\u000c\u000d\u0020]+/g," ")};u.Util.Names.doInitialize=function(e,t,i){var n,r,a,o,l,c,f;for(n=0,r=t.length;n<r;n+=2)if(f=t[n],!!f)if(a=f.match(u.NAME_INITIAL_REGEXP),!a&&!f.match(u.STARTSWITH_ROMANESQUE_REGEXP)&&f.length>1&&i.match("%s")&&(a=f.match(/(.)(.*)/)),a&&a[2]&&a[3]&&(a[1]=a[1]+a[2],a[2]=""),a&&a[1].slice(0,1)===a[1].slice(0,1).toUpperCase()){var p="";if(a[2]){var m="";for(c=a[2].split(""),o=0,l=c.length;o<l;o+=1){var d=c[o];if(d===d.toUpperCase())m+=d;else break}m.length<a[2].length&&(p=u.toLocaleLowerCase.call(e,m))}t[n]=a[1]+p,n<r-1?i.match("%s")?t[n]=i.replace("%s",t[n]):t[n+1].indexOf("-")>-1?t[n+1]=this.mergetag(e,t[n+1].replace("-",""),i)+"-":t[n+1]=this.mergetag(e,t[n+1],i):i.match("%s")?t[n]=i.replace("%s",t[n]):t.push(i)}else f.match(u.ROMANESQUE_REGEXP)&&(!a||!a[3])&&(t[n]=" "+f);var h=t.join("");return h=h.replace(/[\u0009\u000a\u000b\u000c\u000d\u0020\ufeff\u00a0]+$/,"").replace(/\s*\-\s*/g,"-").replace(/[\u0009\u000a\u000b\u000c\u000d\u0020]+/g," "),h};u.Util.Names.getRawName=function(e){var t=[];return e.literal?t.push(e.literal):(e.given&&t.push(e.given),e.family&&t.push(e.family)),t.join(" ")};u.Util.Dates={};u.Util.Dates.year={};u.Util.Dates.year.long=function(e,t){return t||(typeof t=="boolean"?t="":t=0),t.toString()};u.Util.Dates.year.imperial=function(e,t,i){var n="";t||(typeof t=="boolean"?t="":t=0),i=i?"_end":"";var r=e.tmp.date_object["month"+i];for(r=r?""+r:"1";r.length<2;)r="0"+r;var a=e.tmp.date_object["day"+i];for(a=a?""+a:"1";a.length<2;)a="0"+a;var o=parseInt(t+r+a,10),l,c;if(o>=18680908&&o<19120730?(l="明治",c=1867):o>=19120730&&o<19261225?(l="大正",c=1911):o>=19261225&&o<19890108?(l="昭和",c=1925):o>=19890108&&(l="平成",c=1988),l&&c){var f=l;e.sys.normalizeAbbrevsKey&&(f=e.sys.normalizeAbbrevsKey("number",l)),e.transform.abbrevs.default.number[f]||e.transform.loadAbbreviation("default","number",f,null),e.transform.abbrevs.default.number[f]&&(l=e.transform.abbrevs.default.number[f]),n=l+(t-c)}return n};u.Util.Dates.year.short=function(e,t){if(t=t.toString(),t&&t.length===4)return t.substr(2)};u.Util.Dates.year.numeric=function(e,t){var n,i;t=""+t;var n=t.match(/([0-9]*)$/);for(n?(i=t.slice(0,n[1].length*-1),t=n[1]):(i=t,t="");t.length<4;)t="0"+t;return i+t};u.Util.Dates.normalizeMonth=function(e,t){var i;if(e||(e=0),e=""+e,e.match(/^[0-9]+$/)||(e=0),e=parseInt(e,10),t){var n={stub:"month-",num:e};if(n.num<1||n.num>24)n.num=0;else{for(;n.num>16;)n.num=n.num-4;n.num>12&&(n.stub="season-",n.num=n.num-12)}i=n}else(e<1||e>12)&&(e=0),i=e;return i};u.Util.Dates.month={};u.Util.Dates.month.numeric=function(e,i){var i=u.Util.Dates.normalizeMonth(i);return i||(i=""),i};u.Util.Dates.month["numeric-leading-zeros"]=function(e,i){var i=u.Util.Dates.normalizeMonth(i);if(!i)i="";else for(i=""+i;i.length<2;)i="0"+i;return i};u.Util.Dates.month.long=function(e,a,i,n){var r=u.Util.Dates.normalizeMonth(a,!0),a=r.num;if(!a)a="";else{for(a=""+a;a.length<2;)a="0"+a;a=e.getTerm(r.stub+a,"long",0,0,!1,n)}return a};u.Util.Dates.month.short=function(e,a,i,n){var r=u.Util.Dates.normalizeMonth(a,!0),a=r.num;if(!a)a="";else{for(a=""+a;a.length<2;)a="0"+a;a=e.getTerm(r.stub+a,"short",0,0,!1,n)}return a};u.Util.Dates.day={};u.Util.Dates.day.numeric=function(e,t){return t.toString()};u.Util.Dates.day.long=u.Util.Dates.day.numeric;u.Util.Dates.day["numeric-leading-zeros"]=function(e,t){for(t||(t=0),t=t.toString();t.length<2;)t="0"+t;return t.toString()};u.Util.Dates.day.ordinal=function(e,t,i){return e.fun.ordinalizer.format(t,i)};u.Util.Sort={};u.Util.Sort.strip_prepositions=function(e){var t;return typeof e=="string"&&(t=e.match(/^(([aA]|[aA][nN]|[tT][hH][eE])\s+)/)),t&&(e=e.substr(t[1].length)),e};u.Util.substituteStart=function(e,t){var i,n,r,a,o,l,c;a=function(f,p,m){for(var d=0,h=this.decorations.length;d<h;d+=1)if(this.decorations[d][0]==="@strip-periods"&&this.decorations[d][1]==="true"){f.tmp.strip_periods+=1;break}},this.execs.push(a),this.decorations&&e.opt.development_extensions.csl_reverse_lookup_support&&(this.decorations.reverse(),this.decorations.push(["@showid","true",this.cslid]),this.decorations.reverse()),c=["number","date","names"],(this.name==="text"&&!this.postponed_macro||c.indexOf(this.name)>-1)&&(i=function(f,p,m){f.tmp.element_trace.value()==="author"||this.name==="names"?(!f.tmp.just_looking&&m&&m["author-only"]&&f.tmp.area!=="intext"&&f.tmp.probably_rendered_something&&f.tmp.element_trace.push("suppress-me"),!f.tmp.just_looking&&m&&m["suppress-author"]&&(f.tmp.probably_rendered_something||f.tmp.element_trace.push("suppress-me"))):this.name==="date"?!f.tmp.just_looking&&m&&m["author-only"]&&f.tmp.area!=="intext"&&f.tmp.probably_rendered_something&&f.tmp.element_trace.push("suppress-me"):!f.tmp.just_looking&&m&&m["author-only"]&&f.tmp.area!=="intext"?!f.tmp.probably_rendered_something&&f.tmp.can_block_substitute||f.tmp.element_trace.push("suppress-me"):m&&m["suppress-author"]&&f.tmp.element_trace.push("do-not-suppress-me")},this.execs.push(i)),n=this.strings.cls,this.strings.cls=!1,e.build.render_nesting_level===0&&(e.build.area==="bibliography"&&e.bibliography.opt["second-field-align"]?(r=new u.Token("group",u.START),r.decorations=[["@display","left-margin"]],a=function(f,p){f.tmp.render_seen||(r.strings.first_blob=p.id,f.output.startTag("bib_first",r))},r.execs.push(a),t.push(r)):u.DISPLAY_CLASSES.indexOf(n)>-1&&(r=new u.Token("group",u.START),r.decorations=[["@display",n]],a=function(f,p){r.strings.first_blob=p.id,f.output.startTag("bib_first",r)},r.execs.push(a),t.push(r)),e.build.cls=n),e.build.render_nesting_level+=1,e.build.substitute_level.value()===1&&(o=new u.Token("choose",u.START),u.Node.choose.build.call(o,e,t),l=new u.Token("if",u.START),a=function(){return!!e.tmp.can_substitute.value()},l.tests||(l.tests=[]),l.tests.push(a),l.test=e.fun.match.any(this,e,l.tests),t.push(l)),e.sys.variableWrapper&&this.variables_real&&this.variables_real.length&&(a=function(f,p,m){if(!f.tmp.just_looking&&!f.tmp.suppress_decorations){var d=new u.Token("text",u.START);d.decorations=[["@showid","true"]],f.output.startTag("variable_entry",d);var h=null;m&&(h=m.position),h||(h=0);var v=["first","container-subsequent","subsequent","ibid","ibid-with-locator"],b=0;m&&m.noteIndex&&(b=m.noteIndex);var y=0;m&&m["first-reference-note-number"]&&(y=m["first-reference-note-number"]);var g=0;m&&m["first-container-reference-note-number"]&&(g=m["first-container-reference-note-number"]);var x=0;m&&m["citation-number"]&&(x=m["citation-number"]);var k=0;m&&m.index&&(k=m.index);var w={itemData:p,variableNames:this.variables,context:f.tmp.area,xclass:f.opt.xclass,position:v[h],"note-number":b,"first-reference-note-number":y,"first-container-reference-note-number":g,"citation-number":x,index:k,mode:f.opt.mode};f.output.current.value().params=w}},this.execs.push(a))};u.Util.substituteEnd=function(e,t){var i,n,r,a,o,l;if(e.sys.variableWrapper&&(this.hasVariable||this.variables_real&&this.variables_real.length)&&(i=function(f){!f.tmp.just_looking&&!f.tmp.suppress_decorations&&f.output.endTag("variable_entry")},this.execs.push(i)),i=function(f){for(var p=0,m=this.decorations.length;p<m;p+=1)if(this.decorations[p][0]==="@strip-periods"&&this.decorations[p][1]==="true"){f.tmp.strip_periods+=-1;break}},this.execs.push(i),e.build.render_nesting_level+=-1,e.build.render_nesting_level===0&&(e.build.cls?(i=function(f){f.output.endTag("bib_first")},this.execs.push(i),e.build.cls=!1):e.build.area==="bibliography"&&e.bibliography.opt["second-field-align"]&&(n=new u.Token("group",u.END),i=function(f){f.tmp.render_seen||f.output.endTag("bib_first")},n.execs.push(i),t.push(n),r=new u.Token("group",u.START),r.decorations=[["@display","right-inline"]],i=function(f){f.tmp.render_seen||(f.tmp.render_seen=!0,f.output.startTag("bib_other",r))},r.execs.push(i),t.push(r))),e.build.substitute_level.value()===1&&(a=new u.Token("if",u.END),t.push(a),o=new u.Token("choose",u.END),u.Node.choose.build.call(o,e,t)),this.name==="names"||this.name==="text"&&this.variables_real!=="title"){new u.Token("text",u.SINGLETON);var c=this.name;i=function(f,p){if(f.tmp.area==="bibliography"&&typeof f.bibliography.opt["subsequent-author-substitute"]=="string"&&!(this.variables_real&&!p[this.variables_real])&&!(this.variables_real&&c==="names")){var m=f.bibliography.opt["subsequent-author-substitute-rule"],d,h,v=!f.tmp.suppress_decorations;if(v&&f.tmp.subsequent_author_substitute_ok&&f.tmp.rendered_name){if(m==="partial-each"||m==="partial-first"){var b=!0,y=[];for(d=0,h=f.tmp.name_node.children.length;d<h;d+=1){var g=f.tmp.rendered_name[d];b&&f.tmp.last_rendered_name&&f.tmp.last_rendered_name.length>d-1&&g&&!g.localeCompare(f.tmp.last_rendered_name[d])?(l=new u.Blob(f[f.tmp.area].opt["subsequent-author-substitute"]),f.tmp.name_node.children[d].blobs=[l],m==="partial-first"&&(b=!1)):b=!1,y.push(g)}f.tmp.last_rendered_name=y}else if(m==="complete-each"){var y=f.tmp.rendered_name.join(",");if(y){if(f.tmp.last_rendered_name&&!y.localeCompare(f.tmp.last_rendered_name))for(d=0,h=f.tmp.name_node.children.length;d<h;d+=1)l=new u.Blob(f[f.tmp.area].opt["subsequent-author-substitute"]),f.tmp.name_node.children[d].blobs=[l];f.tmp.last_rendered_name=y}}else{var y=f.tmp.rendered_name.join(",");y&&(f.tmp.last_rendered_name&&!y.localeCompare(f.tmp.last_rendered_name)&&(l=new u.Blob(f[f.tmp.area].opt["subsequent-author-substitute"]),f.tmp.label_blob?f.tmp.name_node.top.blobs=[l,f.tmp.label_blob]:f.tmp.name_node.top.blobs.length?f.tmp.name_node.top.blobs[0].blobs=[l]:f.tmp.name_node.top.blobs=[l],f.tmp.substituted_variable=c),f.tmp.last_rendered_name=y)}f.tmp.subsequent_author_substitute_ok=!1}}},this.execs.push(i)}(this.name==="text"&&!this.postponed_macro||["number","date","names"].indexOf(this.name)>-1)&&(i=function(f,p){f.tmp.element_trace.mystack.length>1&&f.tmp.element_trace.pop()},this.execs.push(i))};u.Util.padding=function(e){var t=e.match(/\s*(-{0,1}[0-9]+)/);if(t)for(e=parseInt(t[1],10),e<0&&(e=1e20+e),e=""+e;e.length<20;)e="0"+e;return e};u.Util.LongOrdinalizer=function(){};u.Util.LongOrdinalizer.prototype.init=function(e){this.state=e};u.Util.LongOrdinalizer.prototype.format=function(e,t){e<10&&(e="0"+e);var i=u.Engine.getField(u.LOOSE,this.state.locale[this.state.opt.lang].terms,"long-ordinal-"+e,"long",0,t);return i||(i=this.state.fun.ordinalizer.format(e,t)),this.state.tmp.cite_renders_content=!0,i};u.Util.Ordinalizer=function(e){this.state=e,this.suffixes={}};u.Util.Ordinalizer.prototype.init=function(){if(!this.suffixes[this.state.opt.lang]){this.suffixes[this.state.opt.lang]={};for(var e=0,t=3;e<t;e+=1){var i=[void 0,"masculine","feminine"][e];this.suffixes[this.state.opt.lang][i]=[];for(var n=1;n<5;n+=1){var r=this.state.getTerm("ordinal-0"+n,"long",!1,i);if(typeof r>"u"){delete this.suffixes[this.state.opt.lang][i];break}this.suffixes[this.state.opt.lang][i].push(r)}}}};u.Util.Ordinalizer.prototype.format=function(e,t){var i;e=parseInt(e,10),i=""+e;var n="",r=[];if(t&&r.push(t),r.push("neuter"),this.state.locale[this.state.opt.lang].ord["1.0.1"]){n=this.state.getTerm("ordinal",!1,0,t);for(var a,o=0,l=r.length;o<l;o+=1){a=r[o];var c=this.state.locale[this.state.opt.lang].ord["1.0.1"];if(c["whole-number"][i]&&c["whole-number"][i][a]?n=this.state.getTerm(this.state.locale[this.state.opt.lang].ord["1.0.1"]["whole-number"][i][a],!1,0,t):c["last-two-digits"][i.slice(i.length-2)]&&c["last-two-digits"][i.slice(i.length-2)][a]?n=this.state.getTerm(this.state.locale[this.state.opt.lang].ord["1.0.1"]["last-two-digits"][i.slice(i.length-2)][a],!1,0,t):c["last-digit"][i.slice(i.length-1)]&&c["last-digit"][i.slice(i.length-1)][a]&&(n=this.state.getTerm(this.state.locale[this.state.opt.lang].ord["1.0.1"]["last-digit"][i.slice(i.length-1)][a],!1,0,t)),n)break}}else t||(t=void 0),this.state.fun.ordinalizer.init(),e/10%10===1||e>10&&e<20?n=this.suffixes[this.state.opt.lang][t][3]:e%10===1&&e%100!==11?n=this.suffixes[this.state.opt.lang][t][0]:e%10===2&&e%100!==12?n=this.suffixes[this.state.opt.lang][t][1]:e%10===3&&e%100!==13?n=this.suffixes[this.state.opt.lang][t][2]:n=this.suffixes[this.state.opt.lang][t][3];return i=i+=n,i};u.Util.Romanizer=function(){};u.Util.Romanizer.prototype.format=function(e){var t,i,n,r,a;if(t="",e<6e3)for(r=e.toString().split(""),r.reverse(),i=0,n=0,a=r.length,i=0;i<a;i+=1)n=parseInt(r[i],10),t=u.ROMAN_NUMERALS[i][n]+t;return t};u.Util.Suffixator=function(e){e||(e=u.SUFFIX_CHARS),this.slist=e.split(",")};u.Util.Suffixator.prototype.format=function(e){var t;e+=1;var i="";do{t=e%26===0?26:e%26;var i=this.slist[t-1]+i;e=(e-t)/26}while(e!==0);return i};u.Engine.prototype.processNumber=function(e,t,i){var n,r=this,a=i;i=i==="page-first"?"page":i;var o=",\\s+and\\s+|\\s+and\\s+";this.opt.lang.slice(0,2)!=="en"&&(o+="|,\\s+"+this.getTerm("and")+"\\s+|\\s+"+this.getTerm("and")+"\\s+");var l="\\s*&\\s*",c=new RegExp("^"+l+"$"),f=new RegExp("("+l+"|"+o+"|;\\s+|,\\s+|\\s*\\\\*[\\-\\u2013]+\\s*)","g"),p=new RegExp("(?:"+l+"|"+o+"|;\\s+|,\\s+|\\s*\\\\*[\\-\\u2013]+\\s*)"),m=this.getTerm("and"),d=this.getTerm("and","symbol");m===d&&(d="&");function h(O){O=O.trim();var R=O.match(/^([^ ]+)/);if(R&&!u.STATUTE_SUBDIV_STRINGS[R[1]]){var U=null;["locator","locator-extra","page"].indexOf(i)>-1?t.label?U=u.STATUTE_SUBDIV_STRINGS_REVERSE[t.label]:U="p.":U=u.STATUTE_SUBDIV_STRINGS_REVERSE[i],U&&(O=U+" "+O)}return O}function v(O,R,U,oe,ie){oe=oe||"";var ee={};if(!R&&!u.STATUTE_SUBDIV_STRINGS_REVERSE[i]&&(R="var:"+i),R){var te=R.match(/(\s*)([^\s]+)(\s*)/);a==="page"&&ie===0&&["p.","pp."].indexOf(te[2])===-1?(ee.gotosleepability=!0,ee.labelVisibility=!0):ee.labelVisibility=!1,ee.label=te[2],ee.origLabel=O,ee.labelSuffix=te[3]?te[3]:"",ee.plural=0}var te=U.match(/^([0-9]*[a-zA-Z]+0*)?([0-9]+(?:[a-zA-Z]*|[-,a-zA-Z]+))$/);return te?(ee.particle=te[1]?te[1]:"",ee.value=te[2]):(ee.particle="",ee.value=U),ee.joiningSuffix=oe.replace(/\s*-\s*/,"-"),ee}function b(O){for(var R=O.length-2;R>-1;R-=2)O[R]==="-"&&O[R-1].match(/^(?:(?:[a-z]|[a-z][a-z]|[a-z][a-z][a-z]|[a-z][a-z][a-z][a-z])\. *)*[0-9]+[,a-zA-Z]+$/)&&O[R+1].match(/^[,a-zA-Z]+$/)&&(O[R-1]=O.slice(R-1,R+2).join(""),O=O.slice(0,R).concat(O.slice(R+2)));return O}function y(O,R){R=R||"",O=h(O);var U,oe,ie;if(i==="page"&&O.indexOf("–")>-1&&(O=O.replace(/\u2013/g,"-")),O.indexOf("\\-")>-1){U=new RegExp(f.source.replace("\\-","")),oe=new RegExp(p.source.replace("\\-",""));for(var ee=O.split("\\-"),te=0,X=ee.length;te<X;te++)ee[te]=ee[te].replace(/\-/g,"–");ie=ee.join("\\-"),ie=ie.replace(/\\/g,"")}else U=f,oe=p,ie=O;var F=[],q=ie.match(U);if(q){for(var ee=ie.split(oe),te=0,X=q.length;te<X;te++)q[te].match(c)&&(ee[te].match(/[a-zA-Z]$/)&&ee[te].match(/^[a-zA-Z]/)?q[te]=d:q[te]=" "+d+" ");var ne=!1;for(var te in ee)if((""+ee[te]).replace(/^[a-z]\.\s+/,"").match(/[^\s0-9ivxlcmIVXLCM]/))break;if(ne)F=[ie];else{for(var te=0,X=ee.length-1;te<X;te++)F.push(ee[te]),F.push(q[te]);F.push(ee[ee.length-1]),F=b(F)}}else var F=[ie];for(var se=[],Se=R,Ae="",te=0,X=F.length;te<X;te+=2){var q=F[te].match(/((?:^| )(?:[a-z]|[a-z][a-z]|[a-z][a-z][a-z]|[a-z][a-z][a-z][a-z]|subpara|subch|amend|bibliog|annot|illus|princ|intro|sched|subdiv|subsec)(?:\.| ) *)/g);if(q){for(var ee=F[te].split(/(?:(?:^| )(?:[a-z]|[a-z][a-z]|[a-z][a-z][a-z]|[a-z][a-z][a-z][a-z]|subpara|subch|amend|bibliog|annot|illus|princ|intro|sched|subdiv|subsec)(?:\.| ) *)/),fe=ee.length-1;fe>0;fe--)ee[fe-1]&&(!ee[fe].match(/^[0-9]+([-;,:a-zA-Z]*)$/)||!ee[fe-1].match(/^[0-9]+([-;,:a-zA-Z]*)$/))&&(ee[fe-1]=ee[fe-1]+q[fe-1]+ee[fe],ee=ee.slice(0,fe).concat(ee.slice(fe+1)),q=q.slice(0,fe-1).concat(q.slice(fe)));if(q.length>0){var ke=q[0].trim(),G=!u.STATUTE_SUBDIV_STRINGS[ke]||typeof r.getTerm(u.STATUTE_SUBDIV_STRINGS[ke])>"u"||["locator","number","locator-extra","page"].indexOf(i)===-1&&u.STATUTE_SUBDIV_STRINGS[ke]!==i;G?te===0&&(q=q.slice(1),ee[0]=ee[0]+" "+ke+" "+ee[1],ee=ee.slice(0,1).concat(ee.slice(2))):Ae=ke}for(var fe=0,yt=ee.length;fe<yt;fe++)if(ee[fe]||fe===ee.length-1){var we;Se=q[fe-1]?q[fe-1]:Se,Ae===Se.trim()?we="":we=Ae,ie=ee[fe]?ee[fe].trim():"",fe===ee.length-1?se.push(v(we,Se,ie,F[te+1],te)):se.push(v(we,Se,ie,null,te))}}else{var we;Ae===Se.trim()?we="":we=Ae,se.push(v(we,Se,F[te],F[te+1]))}}return se}function g(O){for(var R=0,U=O.length-1;R<U;R++)!O[R].joiningSuffix&&O[R+1].label&&(O[R].joiningSuffix=" ")}function x(O,R,U){var oe=O[U.pos],ie=O[R].value,ee=oe.joiningSuffix==="\\-";ie.particle&&ie.particle!==oe.particle&&(U.collapsible=!1);var te=ie.match(/^[0-9]+([-,:a-zA-Z]*)$/),X=oe.value.match(/^(?:[0-9]+|[ixv]+)([-,:a-zA-Z]*|\-[\-0-9]+)$/);if((!ie||!te||!X||ee)&&(U.collapsible=!1,(!ie||!X)&&(U.numeric=!1),ee&&U.count--),(te&&te[1]||X&&X[1])&&(U.collapsible=!1),O[R].collapsible===void 0){for(var F=R,q=R+U.count;F<q;F++)isNaN(parseInt(O[F].value))&&!O[F].value.match(/^[ivxlcmIVXLCM]+$/)?O[F].collapsible=!1:O[F].collapsible=!0;U.collapsible=O[R].collapsible}for(var ne=U.collapsible,F=U.pos,q=U.pos+U.count;F<q;F++)U.count>1&&ne&&(O[F].plural=1),O[F].numeric=U.numeric,O[F].collapsible=U.collapsible}function k(O,R,U){U.label.slice(0,4)!=="var:"&&(U.pos===0?(["locator","number","locator-extra","page"].indexOf(i)>-1&&typeof r.getTerm(u.STATUTE_SUBDIV_STRINGS[U.label])>"u"&&(O[U.pos].labelVisibility=!0),["locator","number","locator-extra","page"].indexOf(i)===-1&&u.STATUTE_SUBDIV_STRINGS[U.label]!==i&&(O[0].labelVisibility=!0)):O[U.pos].labelVisibility=!0)}function w(O){if(O.length!==0){for(var R=0,U=1,oe=1,ie=O.length;oe<ie;oe++){var ee=O[oe-1],te=O[oe];if(ee.label===te.label&&ee.particle===ee.particle)U++;else{var X=JSON.parse(JSON.stringify(O[R]));X.pos=R,X.count=U,X.numeric=!0,x(O,R,X),ee.label!==te.label&&k(O,R,X),R=oe,U=1}}var X=JSON.parse(JSON.stringify(O[R]));X.pos=R,X.count=U,X.numeric=!0,x(O,R,X),k(O,R,X),O.length&&O[0].numeric&&i.slice(0,10)==="number-of-"&&parseInt(t[a],10)>1&&(O[0].plural=1)}}function C(O){return O.replace("\\-","-")}function E(O){var R=u.Util.cloneToken(e),U=new u.Token;r.tmp.just_looking||(U.decorations=R.decorations,R.decorations=[],U.strings.prefix=R.strings.prefix,R.strings.prefix="",U.strings.suffix=R.strings.suffix,R.strings.suffix="");var oe=O.length?O[0].label:null;if(O.length){for(var ie=0,ee=O.length;ie<ee;ie++){var te=O[ie],X=u.Util.cloneToken(R);X.gender=e.gender,oe===te.label&&(X.formatter=e.formatter),te.numeric&&(X.successor_prefix=te.successor_prefix),X.strings.suffix=X.strings.suffix+C(te.joiningSuffix),te.styling=X}r.tmp.just_looking||O[0].value.slice(0,1)==='"'&&O[O.length-1].value.slice(-1)==='"'&&(O[0].value=O[0].value.slice(1),O[O.length-1].value=O[O.length-1].value.slice(0,-1),U.decorations.push(["@quotes",!0]))}return U}function B(O,R){var U=!0;if(["locator","locator-extra","page"].indexOf(O)>-1){var oe;R.origLabel?oe=R.origLabel:oe=R.label,U=!!r.getTerm(u.STATUTE_SUBDIV_STRINGS[oe])}return U}function _(O,R){return O==="page"||["locator","locator-extra"].indexOf(O)>-1&&(["p."].indexOf(R.label)>-1||["p."].indexOf(R.origLabel)>-1)}function S(O,R,U,oe){var ie=_(O,R),ee=B(O,R);return ee&&U==="-"&&oe&&((ie||["locator","locator-extra","issue","volume","edition","number"].indexOf(O)>-1)&&(U=r.getTerm("page-range-delimiter"),U||(U="–")),O==="collection-number"&&(U=r.getTerm("year-range-delimiter"),U||(U="–"))),U}function T(O,R,U){if(!(R<1)&&U.count===2&&O[R-1].particle===O[R].particle){if(O[R-1].joiningSuffix!=="-"){U.count=1;return}if(!r.opt["page-range-format"]&&parseInt(O[R-1].value,10)>parseInt(O[R].value,10)){O[R-1].joiningSuffix=S(i,O[R],O[R-1].joiningSuffix,!0);return}var oe=O[R],ie=_(i,oe),ee;ie&&!isNaN(parseInt(O[R-1].value))&&!isNaN(parseInt(O[R].value))?(ee=O[R-1].particle+O[R-1].value+" - "+O[R].particle+O[R].value,ee=r.fun.page_mangler(ee)):((""+O[R-1].value).match(/^([0-9]+|[ivxlcmIVXLCM]+)$/)&&(""+O[R].value).match(/^([0-9]+|[ivxlcmIVXLCM]+)$/)&&(O[R-1].joiningSuffix=r.getTerm("page-range-delimiter")),ee=O[R-1].value+C(O[R-1].joiningSuffix)+O[R].value);var te=ee.match(/^((?:[0-9]*[a-zA-Z]+0*))?([0-9]+[a-z]*)(\s*[^0-9]+\s*)([-,a-zA-Z]?0*)([0-9]+[a-z]*)$/);if(te){var X=te[3];X=S(i,oe,X,O[R].numeric),O[R-1].particle=te[1],O[R-1].value=te[2],O[R-1].joiningSuffix=X,O[R].particle=te[4],O[R].value=te[5]}U.count=0}}function D(O){if(e&&["page","chapter-number","collection-number","edition","issue","number","number-of-pages","number-of-volumes","volume","locator","locator-extra"].indexOf(i)!==-1){for(var R={count:0,label:null},U=0,oe=O.length;U<oe;U++){var ie=O[U];if(ie.collapsible)R.label===ie.label&&ie.joiningSuffix==="-"?R.count=1:R.label===ie.label&&ie.joiningSuffix!=="-"?(R.count++,R.count===2&&T(O,U,R)):R.label!==ie.label?(R.label=ie.label,R.count=1):(R.count=1,R.label=ie.label);else{R.count=0,R.label=null;var ee=ie.numeric;ie.joiningSuffix=S(i,ie,ie.joiningSuffix,ee)}}R.count===2&&T(O,O.length-1,R)}}function H(O,R,U){var oe=O[R];U.length&&(oe.numeric=U[0].numeric,oe.collapsible=U[0].collapsible,oe.plural=U[0].plural,oe.label=u.STATUTE_SUBDIV_STRINGS[U[0].label],i==="number"&&oe.label==="issue"&&r.getTerm("number")&&(oe.label="number"))}if(e&&this.tmp.shadow_numbers[a]&&this.tmp.shadow_numbers[a].values.length){var V=this.tmp.shadow_numbers[a].values;D(V),this.tmp.shadow_numbers[a].masterStyling=E(V);return}if(this.tmp.shadow_numbers[a]||(this.tmp.shadow_numbers[a]={values:[]}),!!t){var M=u.LangPrefsMap[i];if(M){var $=this.opt["cite-lang-prefs"][M][0];n=this.transform.getTextSubField(t,a,"locale-"+$,!0),n=n.name}else n=t[a];if(n&&a==="number"&&t.type==="legal_case"&&(n=n.replace(/[\\]*-/g,"\\-")),n&&this.sys.getAbbreviation){if(this.sys.normalizeAbbrevsKey)var P=this.sys.normalizeAbbrevsKey(a,n);else var P=n;var W=this.transform.loadAbbreviation(t.jurisdiction,"number",P,t.language);this.transform.abbrevs[W].number&&(this.transform.abbrevs[W].number[P]?n=this.transform.abbrevs[W].number[P]:typeof this.transform.abbrevs[W].number[P]<"u"&&delete this.transform.abbrevs[W].number[P])}if(typeof n<"u"&&(typeof n=="string"||typeof n=="number")){typeof n=="number"&&(n=""+n);var L=u.STATUTE_SUBDIV_STRINGS_REVERSE[i];if(this.tmp.shadow_numbers[a].values.length===0){var V=y(n,L);g(V),w(V);for(var Q of V)Q.numeric||(Q.plural=0);this.tmp.shadow_numbers[a].values=V,e&&(D(V),this.tmp.shadow_numbers[a].masterStyling=E(V)),H(this.tmp.shadow_numbers,a,V)}var j=this.tmp.shadow_numbers[a];i==="number"&&j.values.length===1&&j.values[0].value.indexOf("|")>-1&&(j.values[0].value=j.values[0].value.replace(/\|/g,", "),j.values[0].numeric=!0,j.values[0].plural=1,j.values[0].collapsible=!1,j.numeric=!0,j.plural=1,j.collapsible=!1),j.values.length===1&&j.values[0].value.match(/^[0-9]+(?:\/[0-9]+)+$/)&&(j.values[0].numeric=!0,j.values[0].plural=0,j.values[0].collapsible=!1,j.numeric=!0,j.plural=0,j.collapsible=!1),i==="page"&&j.values.length>0&&j.values[0].gotosleepability&&(j.labelForm="short")}}};u.Util.outputNumericField=function(e,t,i){e.output.openLevel(e.tmp.shadow_numbers[t].masterStyling);var n=e.tmp.shadow_numbers[t].masterStyling,r=e.tmp.shadow_numbers[t].values,a=r.length?r[0].label:null,o=e.tmp.shadow_numbers[t].labelForm,l=e.tmp.group_context.tip.label_static,c;o?c=o:c="short";for(var f=e.tmp.shadow_numbers[t].labelCapitalizeIfFirst,p=e.tmp.shadow_numbers[t].labelDecorations,m=null,d=0,h=r.length;d<h;d++){var v=r[d],b="",y;v.label&&(v.label.slice(0,4)==="var:"?y=v.label.slice(4):y=u.STATUTE_SUBDIV_STRINGS[v.label],y&&(v.label===a?(l&&(b=e.getTerm(y,"static",v.plural),b.indexOf("%s")===-1&&(b="")),b||(b=e.getTerm(y,o,v.plural))):(l&&(b=e.getTerm(y,"static",v.plural),b.indexOf("%s")===-1&&(b="")),b||(b=e.getTerm(y,c,v.plural))),f&&(b=u.Output.Formatters["capitalize-first"](e,b))));var g=-1;b&&(g=b.indexOf("%s"));var x=u.Util.cloneToken(v.styling);if(x.formatter=v.styling.formatter,x.type=v.styling.type,x.num=v.styling.num,x.gender=v.styling.gender,g>0&&g<b.length-2)x.strings.prefix+=b.slice(0,g),x.strings.suffix=b.slice(g+2)+x.strings.suffix;else if(v.labelVisibility)if(b||(b=v.label,y=v.label),g>0){var k=new u.Token;k.decorations=p,e.output.append(b.slice(0,g),k)}else(g===b.length-2||g===-1)&&e.output.append(b+v.labelSuffix,"empty");if(u.UPDATE_GROUP_CONTEXT_CONDITION(e,n.strings.prefix,null,n,`${v.particle}${v.value}`),v.collapsible){var w;v.value.match(/^[1-9][0-9]*$/)&&Number.isSafeInteger(parseInt(v.value,10))?w=new u.NumericBlob(e,v.particle,parseInt(v.value,10),x,i):w=new u.NumericBlob(e,v.particle,v.value,x,i),typeof w.gender>"u"&&(w.gender=e.locale[e.opt.lang]["noun-genders"][t]),e.output.append(w,"literal")}else e.output.append(v.particle+v.value,x);if(g===0&&g<b.length-2&&(m===null&&(m=y),y!==m||d===r.length-1)){var C=new u.Token;C.decorations=p,e.output.append(b.slice(g+2),C)}m=y,e.tmp.term_predecessor=!0}e.output.closeLevel()};u.Util.PageRangeMangler={};u.Util.PageRangeMangler.getFunction=function(e,t){var i,n,r,a,o,l,c,f,p,m,d,h,v,b,y,g,x,k,w=e.getTerm(t+"-range-delimiter");i=/([0-9]*[a-zA-Z]+0*)?([0-9]+[a-z]*)\s*(?:\u2013|-)\s*([0-9]*[a-zA-Z]+0*)?([0-9]+[a-z]*)/,a=function(E){for(r=E.length,n=1;n<r;n+=2)typeof E[n]=="object"&&(E[n]=E[n].join(""));var B=E.join("");return B=B.replace(/([^\\])\-/g,"$1"+e.getTerm(t+"-range-delimiter")),B},o=function(E){var B,_,S,T="\\s+\\-\\s+",D=w==="-"?"":w,H=new RegExp("([^\\\\])[-"+D+"\\u2013]","g");E=E.replace(H,"$1 - ").replace(/\s+-\s+/g," - ");var V=new RegExp("((?:[0-9]*[a-zA-Z]+0*)?[0-9]+[a-z]*"+T+"(?:[0-9]*[a-zA-Z]+0*)?[0-9]+[a-z]*)","g"),M=new RegExp("(?:[0-9]*[a-zA-Z]+0*)?[0-9]+[a-z]*"+T+"(?:[0-9]*[a-zA-Z]+0*)?[0-9]+[a-z]*");if(B=E.match(V),_=E.split(M),_.length===0)S=B;else for(S=[_[0]],n=1,r=_.length;n<r;n+=1)S.push(B[n-1].replace(/\s*\-\s*/g,"-")),S.push(_[n]);return S},l=function(E){for(E=""+E,d=o(E),r=d.length,n=1;n<r;n+=2)h=d[n].match(i),h&&(!h[3]||h[1]===h[3])&&(h[4].length<h[2].length&&(h[4]=h[2].slice(0,h[2].length-h[4].length)+h[4]),parseInt(h[2],10)<parseInt(h[4],10)&&(h[3]=w+(h[1]?h[1]:""),d[n]=h.slice(1))),typeof d[n]=="string"&&(d[n]=d[n].replace(/\-/g,w));return d},c=function(E,B,_){r=E.length;for(var S=1,T=E.length;S<T;S+=2)typeof E[S]=="object"&&(E[S][3]=f(E[S][1],E[S][3],B,_),E[S][2].slice(1)===E[S][0]&&(E[S][2]=w));return a(E)},f=function(E,B,_,S){if(_||(_=0),v=(""+E).split(""),b=(""+B).split(""),y=b.slice(),y.reverse(),v.length===b.length)for(var T=0,D=v.length;T<D;T+=1)if(v[T]===b[T]&&y.length>_)y.pop();else{if(_&&S&&y.length===3){var H=v.slice(0,T);H.reverse(),y=y.concat(H)}break}return y.reverse(),y.join("")},p=function(E){for(r=E.length,n=1;n<r;n+=2)typeof E[n]=="object"&&(h=E[n],g=parseInt(h[1],10),x=parseInt(h[3],10),g>100&&g%100&&parseInt(g/100,10)===parseInt(x/100,10)?h[3]=""+x%100:g>=1e4&&(h[3]=""+x%1e3)),h[2].slice(1)===h[0]&&(h[2]=w);return a(E)},m=function(E){for(r=E.length,n=1;n<r;n+=2){if(typeof E[n]=="object"&&(h=E[n],g=parseInt(h[1],10),x=parseInt(h[3],10),b=""+x,g>100&&g%100))for(var B=2;B<b.length;B++){var _=Math.pow(10,B);if(Math.floor(g/_)===Math.floor(x/_)){h[3]=""+x%_;break}}h[2].slice(1)===h[0]&&(h[2]=w)}return a(E)};var C=function(E,B,_,S){var D;E=""+E;var T=l(E),D=B(T,_,S);return D};return e.opt[t+"-range-format"]?e.opt[t+"-range-format"]==="expanded"?k=function(E){return C(E,a)}:e.opt[t+"-range-format"]==="minimal"?k=function(E){return C(E,c)}:e.opt[t+"-range-format"]==="minimal-two"?k=function(E,B){return C(E,c,2,B)}:e.opt[t+"-range-format"]==="chicago"?k=function(E){return C(E,p)}:e.opt[t+"-range-format"]==="chicago-15"?k=function(E){return C(E,p)}:e.opt[t+"-range-format"]==="chicago-16"&&(k=function(E){return C(E,m)}):k=function(E){return C(E,a)},k};u.Util.FlipFlopper=function(e){var t=[],i={'<span class="nocase">':{type:"nocase",opener:'<span class="nocase">',closer:"</span>",attr:null,outer:null,flipflop:null},'<span class="nodecor">':{type:"nodecor",opener:'<span class="nodecor">',closer:"</span>",attr:"@class",outer:"nodecor",flipflop:{nodecor:"nodecor"}},'<span style="font-variant:small-caps;">':{type:"tag",opener:'<span style="font-variant:small-caps;">',closer:"</span>",attr:"@font-variant",outer:"small-caps",flipflop:{"small-caps":"normal",normal:"small-caps"}},"<sc>":{type:"tag",opener:"<sc>",closer:"</sc>",attr:"@font-variant",outer:"small-caps",flipflop:{"small-caps":"normal",normal:"small-caps"}},"<i>":{type:"tag",opener:"<i>",closer:"</i>",attr:"@font-style",outer:"italic",flipflop:{italic:"normal",normal:"italic"}},"<b>":{type:"tag",opener:"<b>",closer:"</b>",attr:"@font-weight",outer:"bold",flipflop:{bold:"normal",normal:"bold"}},"<sup>":{type:"tag",opener:"<sup>",closer:"</sup>",attr:"@vertical-align",outer:"sup",flipflop:{sub:"sup",sup:"sup"}},"<sub>":{type:"tag",opener:"<sub>",closer:"</sub>",attr:"@vertical-align",outer:"sub",flipflop:{sup:"sub",sub:"sub"}},' "':{type:"quote",opener:' "',closer:'"',attr:"@quotes",outer:"true",flipflop:{true:"inner",inner:"true",false:"true"}}," '":{type:"quote",opener:" '",closer:"'",attr:"@quotes",outer:"inner",flipflop:{true:"inner",inner:"true",false:"true"}}};i['("']=i[' "'],i["('"]=i[" '"];var n=e.getTerm("open-quote"),r=e.getTerm("close-quote"),a=e.getTerm("open-inner-quote"),o=e.getTerm("close-inner-quote");n&&r&&[' "'," '",'"',"'"].indexOf(n)===-1&&(i[n]=JSON.parse(JSON.stringify(i[' "'])),i[n].opener=n,i[n].closer=r),a&&o&&[' "'," '",'"',"'"].indexOf(a)===-1&&(i[a]=JSON.parse(JSON.stringify(i[" '"])),i[a].opener=a,i[a].closer=o);function l(x){var k={" '":' "',' "':" '",'("':"('","('":'("'};i[x].outer="true",i[k[x]].outer="inner"}function c(x){for(var k=[],w=Object.keys(i),C=0,E=w.length;C<E;C++){var B=w[C];(i[x].type!=="quote"||!i[x])&&k.push(B)}var _=i[x];return _.opener=new RegExp("^(?:"+k.map(function(S){return S.replace("(","\\(")}).join("|")+")"),_}var f=function(){for(var x={},k=Object.keys(i),w=0,C=k.length;w<C;w++){var E=k[w];x[E]=c(E)}return x}(),p=function(){var x=[],k=[],w={};for(var C in f)x.push(C),w[f[C].closer]=!0;for(var E=Object.keys(w),B=0,_=E.length;B<_;B++){var S=E[B];k.push(S)}var T=x.concat(k).map(function(D){return D.replace("(","\\(")}).join("|");return{matchAll:new RegExp("((?:"+T+"))","g"),splitAll:new RegExp("(?:"+T+")","g"),open:new RegExp("(^(?:"+x.map(function(D){return D.replace("(","\\(")}).join("|")+")$)"),close:new RegExp("(^(?:"+k.join("|")+")$)")}}();function m(x,k){var w=t[t.length-1];return!w||x.match(w.opener)?(t.push({type:f[x].type,opener:f[x].opener,closer:f[x].closer,pos:k}),!1):(t.pop(),t.push({type:f[x].type,opener:f[x].opener,closer:f[x].closer,pos:k}),{fixtag:w.pos})}function d(x,k){var w=t[t.length-1];return w&&x===w.closer?(t.pop(),w.type==="nocase"?{nocase:{open:w.pos,close:k}}:!1):w?{fixtag:w.pos}:{fixtag:k}}function h(x,k){return x.match(p.open)?m(x,k):d(x,k)}function v(x){var k=[];x=x.replace(/(<span)\s+(style=\"font-variant:)\s*(small-caps);?\"[^>]*(>)/g,'$1 $2$3;"$4'),x=x.replace(/(<span)\s+(class=\"no(?:case|decor)\")[^>]*(>)/g,"$1 $2$3");var w=x.match(p.matchAll);if(!w)return{tags:[],strings:[x],forcedSpaces:[]};for(var C=x.split(p.splitAll),E=0,B=w.length-1;E<B;E++)i[w[E]]&&(C[E+1]===""&&['"',"'"].indexOf(w[E+1])>-1?(w[E+1]=" "+w[E+1],k.push(!0)):k.push(!1));return{tags:w,strings:C,forcedSpaces:k}}var b=function(x){var k=[];this.set=function(w){for(var C=i[w].attr,E=null,B=k.length-1;B>-1;B--){var _=k[B];if(_[0]===C){E=_;break}}if(!E){var S=[e[e.tmp.area].opt.layout_decorations].concat(x.alldecor);e:for(var B=S.length-1;B>-1;B--){var T=S[B];if(T)for(var D=T.length-1;D>-1;D--){var _=T[D];if(_[0]===C){E=_;break e}}}}E?E=[C,i[w].flipflop[E[1]]]:E=[C,i[w].outer],k.push(E)},this.pair=function(){return k[k.length-1]},this.pop=function(){k.pop()}};function y(x,k){if(x==="'"){if(k&&k.match(/^[^\,\.\?\:\;\ ]/))return"’"}else if(x===" '"&&k&&k.match(/^[\ ]/))return" ’";return!1}function g(x,k,w){var C=!0,E=new b(x);x.blobs=[];function B(V){this.stack=[V],this.latest=V,this.addStyling=function(M,$){if(C&&(M.slice(0,1)===" "&&(M=M.slice(1)),M.slice(0,1)===" "&&(M=M.slice(1)),C=!1),this.latest=this.stack[this.stack.length-1],$){if(typeof this.latest.blobs=="string"){var P=new u.Blob;P.blobs=this.latest.blobs,P.alldecor=this.latest.alldecor.slice(),this.latest.blobs=[P]}var W=new u.Token,L=new u.Blob(null,W);if(L.alldecor=this.latest.alldecor.slice(),$[0]==="@class"&&$[1]==="nodecor"){for(var Q=[],j={},O=[e[e.tmp.area].opt.layout_decorations].concat(L.alldecor),R=O.length-1;R>-1;R--){var U=O[R];if(U)for(var oe=U.length-1;oe>-1;oe--){var ie=U[oe];["@font-weight","@font-style","@font-variant"].indexOf(ie[0])>-1&&!j[ie[0]]&&($[1]!=="normal"&&(L.decorations.push([ie[0],"normal"]),Q.push([ie[0],"normal"])),j[ie[0]]=!0)}}L.alldecor.push(Q)}else L.decorations.push($),L.alldecor.push([$]);if(this.latest.blobs.push(L),this.stack.push(L),this.latest=L,M){var W=new u.Token,L=new u.Blob(null,W);L.blobs=M,L.alldecor=this.latest.alldecor.slice(),this.latest.blobs.push(L)}}else if(M){var P=new u.Blob;P.blobs=M,P.alldecor=this.latest.alldecor.slice(),this.latest.blobs.push(P)}},this.popStyling=function(){this.stack.pop()}}var _=new B(x);if(k.strings.length){var S=k.strings[0];w&&(S=" "+S),_.addStyling(S)}for(var T=0,D=k.tags.length;T<D;T++){var H=k.tags[T],S=k.strings[T+1];H.match(p.open)?(E.set(H),_.addStyling(S,E.pair())):(E.pop(),_.popStyling(),_.addStyling(S))}}this.processTags=function(x){var C=x.blobs,k=!1;C.slice(0,1)===" "&&!C.match(/^\s+[\'\"]/)&&(k=!0);var w=new RegExp("("+u.ROMANESQUE_REGEXP.source+")’("+u.ROMANESQUE_REGEXP.source+")","g"),C=" "+C.replace(w,"$1'$2"),E=v(C);if(E.tags.length!==0){for(var B=!1,_=0,S=E.tags.length;_<S;_++){var T=E.tags[_],C=E.strings[_+1],D=y(T,C);if(D)E.strings[_+1]=D+E.strings[_+1],E.tags[_]="";else{for(var H;H=h(T,_),H;)if(Object.keys(H).indexOf("fixtag")>-1){if(T.match(p.close)&&T==="'")E.strings[_+1]="’"+E.strings[_+1],E.tags[_]="";else{var V=E.tags[H.fixtag];E.forcedSpaces[H.fixtag-1]&&(V=V.slice(1)),E.strings[H.fixtag+1]=V+E.strings[H.fixtag+1],E.tags[H.fixtag]=""}if(t.length>0)if(T!=="'")t.pop();else break;else break}else if(H.nocase){E.tags[H.nocase.open]="",E.tags[H.nocase.close]="";break}else break;H&&(H.fixtag||H.fixtag===0)&&(E.strings[_+1]=E.tags[_]+E.strings[_+1],E.tags[_]="")}}for(var _=t.length-1;_>-1;_--){var M=t[_].pos,T=E.tags[M];T===" '"||T==="'"?E.strings[M+1]=" ’"+E.strings[M+1]:E.strings[M+1]=E.tags[M]+E.strings[M+1],E.tags[M]="",t.pop()}for(var _=E.tags.length-1;_>-1;_--)E.tags[_]||(E.tags=E.tags.slice(0,_).concat(E.tags.slice(_+1)),E.strings[_]=E.strings[_]+E.strings[_+1],E.strings=E.strings.slice(0,_+1).concat(E.strings.slice(_+2)));for(var _=0,S=E.tags.length;_<S;_++){var T=E.tags[_],$=E.forcedSpaces[_-1];[' "'," '",'("',"('"].indexOf(T)>-1&&(B||(l(T),B=!0),$||(E.strings[_]+=T.slice(0,1)))}g(x,E,k)}}};u.Output.Formatters=function(){var e=`(?:‘|’|“|”| "| '|"|'|[-–—/.,;?!:]|\\[|\\]|\\(|\\)|<span style="font-variant: small-caps;">|<span class="no(?:case|decor)">|</span>|</?(?:i|sc|b|sub|sup)>)`,t=new u.Doppeler(e,function(b){return b.replace(/(<span)\s+(class=\"no(?:case|decor)\")[^>]*(>)/g,"$1 $2$3").replace(/(<span)\s+(style=\"font-variant:)\s*(small-caps);?(\")[^>]*(>)/g,"$1 $2 $3;$4$5")}),i='(?:[-\\s]*<\\/*(?:spans+class="no(?:case|decor)"|i|sc|b|sub|sup)>[-\\s]*|[-\\s]+)',n=new u.Doppeler(i),r=new u.Doppeler("(?:[    -​  ]+)"),a={'<span style="font-variant: small-caps;">':"</span>",'<span class="nocase">':"</span>",'<span class="nodecor">':"</span>","<sc>":"</sc>","<sub>":"</sub>","<sup>":"</sup>"};function o(b){var y=b.match(/(^\s*)((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))(.*)/);return y&&!(y[2].match(/^[\u0370-\u03FF]$/)&&!y[3])?y[1]+u.toLocaleUpperCase.call(this,y[2])+y[3]:b}function l(b,y){if(!y)return"";b.doppel=t.split(y);var g={' "':{opener:" '",closer:'"'}," '":{opener:' "',closer:"'"},"‘":{opener:"‘",closer:"’"},"“":{opener:"“",closer:"”"}};function x(M,$){if(b.quoteState.length===0||M===b.quoteState[b.quoteState.length-1].opener)return b.quoteState.push({opener:g[M].opener,closer:g[M].closer,pos:$}),!1;var P=b.quoteState[b.quoteState.length-1].pos;return b.quoteState.pop(),b.quoteState.push({opener:g[M].opener,closer:g[M].closer,positions:$}),P}function k(M,$){if(b.quoteState.length>0&&M===b.quoteState[b.quoteState.length-1].closer)b.quoteState.pop();else return $}function w(M,$){var P=["“","‘",' "'," '"].indexOf(M)>-1;return P?x(M,$):k(M,$)}function C(M,$){var P=M.match(/(^(?:\u2018|\u2019|\u201C|\u201D|\"|\')|(?: \"| \')$)/);if(P)return w(P[1],$)}b.doppel.strings.length&&b.doppel.strings[0].trim()&&(b.doppel.strings[0]=b.capitaliseWords(b.doppel.strings[0],0,b.doppel.tags[0]));for(var E=0,B=b.doppel.tags.length;E<B;E++){var _=b.doppel.tags[E],S=b.doppel.strings[E+1];if(b.tagState!==null&&(a[_]?b.tagState.push(a[_]):b.tagState.length&&_===b.tagState[b.tagState.length-1]&&b.tagState.pop()),b.afterPunct!==null&&_.match(/[\!\?\:]$/)&&(b.afterPunct=!0),b.tagState.length===0?b.doppel.strings[E+1]=b.capitaliseWords(S,E+1,b.doppel,b.doppel.tags[E+1]):b.doppel.strings[E+1].trim()&&(b.lastWordPos=null),b.quoteState!==null){var T=C(_,E);if(T||T===0){var D=b.doppel.origStrings[T+1].slice(0,1);b.doppel.strings[T+1]=D+b.doppel.strings[T+1].slice(1),b.lastWordPos=null}}b.isFirst&&S.trim()&&(b.isFirst=!1),b.afterPunct&&S.trim()&&(b.afterPunct=!1)}if(b.quoteState)for(var E=0,B=b.quoteState.length;E<B;E++){var T=b.quoteState[E].pos;if(typeof T<"u"){var D=b.doppel.origStrings[T+1].slice(0,1);b.doppel.strings[T+1]=D+b.doppel.strings[T+1].slice(1)}}if(b.lastWordPos){var H=r.split(b.doppel.strings[b.lastWordPos.strings]),V=H.strings[b.lastWordPos.words];V.length>1&&u.toLocaleLowerCase.call(this,V).match(b.skipWordsRex)&&(V=o.call(this,V),H.strings[b.lastWordPos.words]=V),b.doppel.strings[b.lastWordPos.strings]=r.join(H)}return t.join(b.doppel)}function c(b,y){return y}function f(b,y){var g={quoteState:null,capitaliseWords:function(x){for(var k=x.split(" "),w=0,C=k.length;w<C;w++){var E=k[w];E&&(k[w]=u.toLocaleLowerCase.call(b,E))}return k.join(" ")},skipWordsRex:null,tagState:[],afterPunct:null,isFirst:null};return l.call(b,g,y)}function p(b,y){var g={quoteState:null,capitaliseWords:function(x){for(var k=x.split(" "),w=0,C=k.length;w<C;w++){var E=k[w];E&&(k[w]=u.toLocaleUpperCase.call(b,E))}return k.join(" ")},skipWordsRex:null,tagState:[],afterPunct:null,isFirst:null};return l.call(b,g,y)}function m(b,y){var g={quoteState:[],capitaliseWords:function(x){for(var k=x.split(" "),w=0,C=k.length;w<C;w++){var E=k[w];E&&(g.isFirst?(k[w]=o.call(b,E),g.isFirst=!1):k[w]=u.toLocaleLowerCase.call(b,E))}return k.join(" ")},skipWordsRex:null,tagState:[],afterPunct:null,isFirst:!0};return l.call(b,g,y)}function d(b,y){var g={quoteState:[],capitaliseWords:function(x,k,w){if(x.trim()){for(var C=r.split(x),E=C.strings,B=0,_=E.length;B<_;B++){var S=E[B];if(!S)continue;let T=u.toLocaleLowerCase.call(b,S),D=!1;(S.length>1&&!T.match(g.skipWordsRex)||B===E.length-1&&w==="-"||g.isFirst||g.afterPunct)&&(D=!0),D&&S===T&&(E[B]=o.call(b,S)),g.afterPunct=!1,g.isFirst=!1,g.lastWordPos={strings:k,words:B}}x=r.join(C)}return x},skipWordsRex:b.locale[b.opt.lang].opts["skip-words-regexp"],tagState:[],afterPunct:!1,isFirst:!0};return l.call(b,g,y)}function h(b,y){var g={quoteState:[],capitaliseWords:function(x){for(var k=r.split(x),w=k.strings,C=0,E=w.length;C<E;C++){var B=w[C];if(B&&g.isFirst){B===u.toLocaleLowerCase.call(b,B)&&(w[C]=o.call(b,B)),g.isFirst=!1;break}}return r.join(k)},skipWordsRex:null,tagState:[],afterPunct:null,isFirst:!0};return l.call(b,g,y)}function v(b,y){var g={quoteState:[],capitaliseWords:function(x){for(var k=r.split(x),w=k.strings,C=0,E=w.length;C<E;C++){var B=w[C];B&&B===u.toLocaleLowerCase.call(b,B)&&(w[C]=o.call(b,B))}return r.join(k)},skipWordsRex:null,tagState:[],afterPunct:null,isFirst:null};return l.call(b,g,y)}return{nameDoppel:n,passthrough:c,lowercase:f,uppercase:p,sentence:m,title:d,"capitalize-first":h,"capitalize-all":v}}();u.Output.Formats=function(){};u.Output.Formats.prototype.html={text_escape:function(e){return e||(e=""),e.replace(/&/g,"&#38;").replace(/</g,"&#60;").replace(/>/g,"&#62;").replace(/\s\s/g,"  ").replace(u.SUPERSCRIPTS_REGEXP,function(t){return"<sup>"+u.SUPERSCRIPTS[t]+"</sup>"})},bibstart:`<div class="csl-bib-body">
453
+ `).trim()}},checkPrefixSpaceAppend:function(e,a){a||(a="");var i="",n=a.replace(/<[^>]+>/g,"").replace(/["'\u201d\u2019\u00bb\u202f\u00a0 ]+$/g,""),r=n.slice(-1);(n.match(u.ENDSWITH_ROMANESQUE_REGEXP)||u.TERMINAL_PUNCTUATION.slice(0,-1).indexOf(r)>-1||r.match(/[\)\],0-9]/))&&(i=" ");var a=(a+i).replace(/\s+/g," ");return a},checkIgnorePredecessor:function(e,t){var i=t.replace(/<[^>]+>/g,"").replace(/["'\u201d\u2019\u00bb\u202f\u00a0 ]+$/g,""),n=i.slice(-1);return u.TERMINAL_PUNCTUATION.slice(0,-1).indexOf(n)>-1&&t.trim().indexOf(" ")>-1?(e.tmp.term_predecessor=!1,!0):!1},checkSuffixSpacePrepend:function(e,t){return t?((t.match(u.STARTSWITH_ROMANESQUE_REGEXP)||["[","("].indexOf(t.slice(0,1))>-1)&&(t=" "+t),t):""},GENDERS:["masculine","feminine"],ERROR_NO_RENDERED_FORM:1,PREVIEW:"Just for laughs.",ASSUME_ALL_ITEMS_REGISTERED:2,START:0,END:1,SINGLETON:2,SEEN:6,SUCCESSOR:3,SUCCESSOR_OF_SUCCESSOR:4,SUPPRESS:5,SINGULAR:0,PLURAL:1,LITERAL:!0,BEFORE:1,AFTER:2,DESCENDING:1,ASCENDING:2,PRIMARY:1,SECONDARY:2,POSITION_FIRST:0,POSITION_SUBSEQUENT:1,POSITION_IBID:2,POSITION_IBID_WITH_LOCATOR:3,POSITION_CONTAINER_SUBSEQUENT:4,POSITION_MAP:{0:0,4:1,1:2,2:3,3:4},POSITION_TEST_VARS:["position","first-reference-note-number","near-note"],AREAS:["citation","citation_sort","bibliography","bibliography_sort","intext"],CITE_FIELDS:["first-reference-note-number","first-container-reference-note-number","locator","locator-extra"],SWAPPING_PUNCTUATION:[".","!","?",":",","],TERMINAL_PUNCTUATION:[":",".",";","!","?"," "],NONE:0,NUMERIC:1,POSITION:2,TRIGRAPH:3,DATE_PARTS:["year","month","day"],DATE_PARTS_ALL:["year","month","day","season"],DATE_PARTS_INTERNAL:["year","month","day","year_end","month_end","day_end"],NAME_PARTS:["non-dropping-particle","family","given","dropping-particle","suffix","literal"],DISAMBIGUATE_OPTIONS:["disambiguate-add-names","disambiguate-add-givenname","disambiguate-add-year-suffix"],GIVENNAME_DISAMBIGUATION_RULES:["all-names","all-names-with-initials","primary-name","primary-name-with-initials","by-cite"],NAME_ATTRIBUTES:["and","delimiter-precedes-last","delimiter-precedes-et-al","initialize-with","initialize","name-as-sort-order","sort-separator","et-al-min","et-al-use-first","et-al-subsequent-min","et-al-subsequent-use-first","form","prefix","suffix","delimiter"],LOOSE:0,STRICT:1,TOLERANT:2,PREFIX_PUNCTUATION:/[.;:]\s*$/,SUFFIX_PUNCTUATION:/^\s*[.;:,\(\)]/,NUMBER_REGEXP:/(?:^\d+|\d+$)/,NAME_INITIAL_REGEXP:/^([A-Z\u0e01-\u0e5b\u00c0-\u017f\u0400-\u042f\u0590-\u05d4\u05d6-\u05ff\u0600-\u06ff\u0370\u0372\u0376\u0386\u0388-\u03ab\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7\u03fd-\u03ff])([a-zA-Z\u0e01-\u0e5b\u00c0-\u017f\u0400-\u052f\u0600-\u06ff\u0370-\u03ff\u1f00-\u1fff]*|)(\.)*/,ROMANESQUE_REGEXP:/[-0-9a-zA-Z\u0e01-\u0e5b\u00c0-\u017f\u0370-\u03ff\u0400-\u052f\u0590-\u05d4\u05d6-\u05ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]/,ROMANESQUE_NOT_REGEXP:/[^a-zA-Z\u0e01-\u0e5b\u00c0-\u017f\u0370-\u03ff\u0400-\u052f\u0590-\u05d4\u05d6-\u05ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]/g,STARTSWITH_ROMANESQUE_REGEXP:/^[&a-zA-Z\u0e01-\u0e5b\u00c0-\u017f\u0370-\u03ff\u0400-\u052f\u0590-\u05d4\u05d6-\u05ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]/,ENDSWITH_ROMANESQUE_REGEXP:/[.;:&a-zA-Z\u0e01-\u0e5b\u00c0-\u017f\u0370-\u03ff\u0400-\u052f\u0590-\u05d4\u05d6-\u05ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]$/,ALL_ROMANESQUE_REGEXP:/^[a-zA-Z\u0e01-\u0e5b\u00c0-\u017f\u0370-\u03ff\u0400-\u052f\u0590-\u05d4\u05d6-\u05ff\u1f00-\u1fff\u0600-\u06ff\u200c\u200d\u200e\u0218\u0219\u021a\u021b\u202a-\u202e]+$/,VIETNAMESE_SPECIALS:/[\u00c0-\u00c3\u00c8-\u00ca\u00cc\u00cd\u00d2-\u00d5\u00d9\u00da\u00dd\u00e0-\u00e3\u00e8-\u00ea\u00ec\u00ed\u00f2-\u00f5\u00f9\u00fa\u00fd\u0101\u0103\u0110\u0111\u0128\u0129\u0168\u0169\u01a0\u01a1\u01af\u01b0\u1ea0-\u1ef9]/,VIETNAMESE_NAMES:/^(?:(?:[.AaBbCcDdEeGgHhIiKkLlMmNnOoPpQqRrSsTtUuVvXxYy \u00c0-\u00c3\u00c8-\u00ca\u00cc\u00cd\u00d2-\u00d5\u00d9\u00da\u00dd\u00e0-\u00e3\u00e8-\u00ea\u00ec\u00ed\u00f2-\u00f5\u00f9\u00fa\u00fd\u0101\u0103\u0110\u0111\u0128\u0129\u0168\u0169\u01a0\u01a1\u01af\u01b0\u1ea0-\u1ef9]{2,6})(\s+|$))+$/,NOTE_FIELDS_REGEXP:/\{:(?:[\-_a-z]+|[A-Z]+):[^\}]+\}/g,NOTE_FIELD_REGEXP:/^([\-_a-z]+|[A-Z]+):\s*([^\}]+)$/,PARTICLE_GIVEN_REGEXP:/^([^ ]+(?:\u02bb |\u2019 | |\' ) *)(.+)$/,PARTICLE_FAMILY_REGEXP:/^([^ ]+(?:\-|\u02bb|\u2019| |\') *)(.+)$/,DISPLAY_CLASSES:["block","left-margin","right-inline","indent"],NAME_VARIABLES:["author","chair","collection-editor","compiler","composer","container-author","contributor","curator","director","editor","editor-translator","editorial-director","executive-producer","guest","host","illustrator","interviewer","narrator","organizer","original-author","performer","producer","recipient","reviewed-author","script-writer","series-creator","translator","commenter"],CREATORS:["author","chair","collection-editor","compiler","composer","container-author","contributor","curator","director","editor","editor-translator","editorial-director","executive-producer","guest","host","illustrator","interviewer","narrator","organizer","original-author","performer","producer","recipient","reviewed-author","script-writer","series-creator","translator","commenter"],NUMERIC_VARIABLES:["call-number","chapter-number","collection-number","division","edition","page","issue","locator","locator-extra","number","number-of-pages","number-of-volumes","part-number","printing-number","section","supplement-number","version","volume","supplement","citation-number"],DATE_VARIABLES:["locator-date","issued","event-date","accessed","original-date","publication-date","available-date","submitted","alt-issued","alt-event"],VARIABLES_WITH_SHORT_FORM:["title","container-title"],TITLE_FIELD_SPLITS:function(e){for(var t=["title","short","main","sub","subjoin"],i={},n=0,r=t.length;n<r;n++)i[t[n]]=e+"title"+(t[n]==="title"?"":"-"+t[n]);return i},demoteNoiseWords:function(e,t,i){var n=e.locale[e.opt.lang].opts["leading-noise-words"];if(t&&i){t=t.split(/\s+/),t.reverse();for(var r=[],a=t.length-1;a>-1&&n.indexOf(t[a].toLowerCase())>-1;a+=-1)r.push(t.pop());t.reverse();var o=t.join(" "),l=r.join(" ");i==="drop"||!l?t=o:i==="demote"&&(t=[o,l].join(", "))}return t},extractTitleAndSubtitle:function(e,t){var i=t?" ":"",n=[""];this.opt.development_extensions.split_container_title&&n.push("container-");for(var r=0,a=n.length;r<a;r++){var o=n[r],l=u.TITLE_FIELD_SPLITS(o),c=[!1];if(e.multi)for(var f in e.multi._keys[l.short])c.push(f);for(var p=0,m=c.length;p<m;p++){var f=c[p],d={};f?(e.multi._keys[l.title]&&(d[l.title]=e.multi._keys[l.title][f]),e.multi._keys[l.short]&&(d[l.short]=e.multi._keys[l.short][f])):(d[l.title]=e[l.title],d[l.short]=e[l.short]),d[l.main]=d[l.title],d[l.sub]=!1;var h=d[l.short];if(d[l.title]){if(h&&h.toLowerCase()===d[l.title].toLowerCase())d[l.main]=d[l.title],d[l.subjoin]="",d[l.sub]="";else if(h){var v=d[l.title].slice(h.replace(/[\?\!]+$/,"").length),b=d[l.title].replace(v.replace(/^[\?\!]+/,""),"").trim(),y=u.TITLE_SPLIT_REGEXP.matchfirst.exec(v);if(y&&b.toLowerCase()===h.toLowerCase())d[l.main]=b,d[l.subjoin]=y[1].replace(/[\?\!]+(\s*)$/,"$1"),d[l.sub]=v.replace(u.TITLE_SPLIT_REGEXP.matchfirst,""),this.opt.development_extensions.force_short_title_casing_alignment&&(d[l.short]=d[l.main]);else{var g=u.TITLE_SPLIT(d[l.title]);g.length==3?(d[l.main]=g[0],d[l.subjoin]=g[1],d[l.sub]=g[2]):(d[l.main]=d[l.title],d[l.subjoin]="",d[l.sub]="")}}else{var g=u.TITLE_SPLIT(d[l.title]);if(g.length==3){if(d[l.main]=g[0],d[l.subjoin]=g[1],d[l.sub]=g[2],this.opt.development_extensions.implicit_short_title&&e.type!=="legal_case"&&!e[l.short]&&!d[l.main].match(/^[\-\.[0-9]+$/)){var x=d[l.subjoin].trim();["?","!"].indexOf(x)===-1&&(x=""),d[l.short]=d[l.main]+x}}else d[l.main]=d[l.title],d[l.subjoin]="",d[l.sub]=""}if(d[l.subjoin]&&d[l.subjoin].match(/([\?\!])/)){var y=d[l.subjoin].match(/(\s*)$/);d[l.main]=d[l.main]+i+d[l.subjoin].trim(),d[l.subjoin]=y[1]}}if(d[l.subjoin]&&(d[l.subjoin].indexOf(":")>-1&&(d[l.subjoin]=i+": "),(d[l.subjoin].indexOf("-")>-1||d[l.subjoin].indexOf("—")>-1)&&(d[l.subjoin]="—")),f)for(var k in d)e.multi._keys[k]||(e.multi._keys[k]={}),e.multi._keys[k][f]=d[k];else for(var k in d)e[k]=d[k]}}},titlecaseSentenceOrNormal:function(e,t,i,n,r){var a=u.TITLE_FIELD_SPLITS(i),o={};if(n&&t.multi?(t.multi._keys[a.title]&&(o[a.title]=t.multi._keys[a.title][n]),t.multi._keys[a.main]&&(o[a.main]=t.multi._keys[a.main][n]),t.multi._keys[a.sub]&&(o[a.sub]=t.multi._keys[a.sub][n]),t.multi._keys[a.subjoin]&&(o[a.subjoin]=t.multi._keys[a.subjoin][n])):(o[a.title]=t[a.title],o[a.main]=t[a.main],o[a.sub]=t[a.sub],o[a.subjoin]=t[a.subjoin]),o[a.main]&&o[a.sub]){var l=o[a.main],c=o[a.subjoin],f=o[a.sub];return r?(l=u.Output.Formatters.sentence(e,l),f=u.Output.Formatters.sentence(e,f)):e.opt.development_extensions.uppercase_subtitles&&(f=u.Output.Formatters["capitalize-first"](e,f)),[l,c,f].join("")}else if(o[a.title]){if(r)return u.Output.Formatters.sentence(e,o[a.title]);if(e.opt.development_extensions.uppercase_subtitles){for(var p=u.TITLE_SPLIT(o[a.title]),m=0,d=p.length;m<d;m+=2)p[m]=u.Output.Formatters["capitalize-first"](e,p[m]);for(var m=1,d=p.length-1;m<d;m+=2){var h=p[m].match(/([:\?\!] )/);if(h){var v=e.opt["default-locale"][0].slice(0,2).toLowerCase()==="fr"?" ":"";p[m]=v+h[1]}(p[m].indexOf("-")>-1||p[m].indexOf("—")>-1)&&(p[m]="—")}return o[a.title]=p.join(""),o[a.title]}else return o[a.title]}else return""},getSafeEscape:function(e){if(["bibliography","citation"].indexOf(e.tmp.area)>-1){var t=[];return e.opt.development_extensions.thin_non_breaking_space_html_hack&&e.opt.mode==="html"&&t.push(function(i){return i.replace(/\u202f/g,'<span style="white-space:nowrap">&thinsp;</span>')}),t.length?function(i){for(var n=0,r=t.length;n<r;n+=1)i=t[n](i);return u.Output.Formats[e.opt.mode].text_escape(i)}:u.Output.Formats[e.opt.mode].text_escape}else return function(i){return i}},SKIP_WORDS:["about","above","across","afore","after","against","al","along","alongside","amid","amidst","among","amongst","anenst","apropos","apud","around","as","aside","astride","at","athwart","atop","barring","before","behind","below","beneath","beside","besides","between","beyond","but","by","circa","despite","down","during","et","except","for","forenenst","from","given","in","inside","into","lest","like","modulo","near","next","notwithstanding","of","off","on","onto","out","over","per","plus","pro","qua","sans","since","than","through"," thru","throughout","thruout","till","to","toward","towards","under","underneath","until","unto","up","upon","versus","vs.","v.","vs","v","via","vis-à-vis","with","within","without","according to","ahead of","apart from","as for","as of","as per","as regards","aside from","back to","because of","close to","due to","except for","far from","inside of","instead of","near to","next to","on to","out from","out of","outside of","prior to","pursuant to","rather than","regardless of","such as","that of","up to","where as","or","yet","so","for","and","nor","a","an","the","de","d'","von","van","c","ca"],FORMAT_KEY_SEQUENCE:["@strip-periods","@font-style","@font-variant","@font-weight","@text-decoration","@vertical-align","@quotes"],INSTITUTION_KEYS:["font-style","font-variant","font-weight","text-decoration","text-case"],SUFFIX_CHARS:"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z",ROMAN_NUMERALS:[["","i","ii","iii","iv","v","vi","vii","viii","ix"],["","x","xx","xxx","xl","l","lx","lxx","lxxx","xc"],["","c","cc","ccc","cd","d","dc","dcc","dccc","cm"],["","m","mm","mmm","mmmm","mmmmm"]],LANGS:{"af-ZA":"Afrikaans",ar:"Arabic","bg-BG":"Bulgarian","ca-AD":"Catalan","cs-CZ":"Czech","da-DK":"Danish","de-AT":"Austrian","de-CH":"German (CH)","de-DE":"German (DE)","el-GR":"Greek","en-GB":"English (GB)","en-US":"English (US)","es-ES":"Spanish","et-EE":"Estonian",eu:"European","fa-IR":"Persian","fi-FI":"Finnish","fr-CA":"French (CA)","fr-FR":"French (FR)","he-IL":"Hebrew","hr-HR":"Croatian","hu-HU":"Hungarian","is-IS":"Icelandic","it-IT":"Italian","ja-JP":"Japanese","km-KH":"Khmer","ko-KR":"Korean","lt-LT":"Lithuanian","lv-LV":"Latvian","mn-MN":"Mongolian","nb-NO":"Norwegian (Bokmål)","nl-NL":"Dutch","nn-NO":"Norwegian (Nynorsk)","pl-PL":"Polish","pt-BR":"Portuguese (BR)","pt-PT":"Portuguese (PT)","ro-RO":"Romanian","ru-RU":"Russian","sk-SK":"Slovak","sl-SI":"Slovenian","sr-RS":"Serbian","sv-SE":"Swedish","th-TH":"Thai","tr-TR":"Turkish","uk-UA":"Ukrainian","vi-VN":"Vietnamese","zh-CN":"Chinese (CN)","zh-TW":"Chinese (TW)"},LANG_BASES:{af:"af_ZA",ar:"ar",bg:"bg_BG",ca:"ca_AD",cs:"cs_CZ",da:"da_DK",de:"de_DE",el:"el_GR",en:"en_US",es:"es_ES",et:"et_EE",eu:"eu",fa:"fa_IR",fi:"fi_FI",fr:"fr_FR",he:"he_IL",hr:"hr-HR",hu:"hu_HU",is:"is_IS",it:"it_IT",ja:"ja_JP",km:"km_KH",ko:"ko_KR",lt:"lt_LT",lv:"lv-LV",mn:"mn_MN",nb:"nb_NO",nl:"nl_NL",nn:"nn-NO",pl:"pl_PL",pt:"pt_PT",ro:"ro_RO",ru:"ru_RU",sk:"sk_SK",sl:"sl_SI",sr:"sr_RS",sv:"sv_SE",th:"th_TH",tr:"tr_TR",uk:"uk_UA",vi:"vi_VN",zh:"zh_CN"},SUPERSCRIPTS:{ª:"a","²":"2","³":"3","¹":"1",º:"o",ʰ:"h",ʱ:"ɦ",ʲ:"j",ʳ:"r",ʴ:"ɹ",ʵ:"ɻ",ʶ:"ʁ",ʷ:"w",ʸ:"y",ˠ:"ɣ",ˡ:"l",ˢ:"s",ˣ:"x",ˤ:"ʕ","ᴬ":"A","ᴭ":"Æ","ᴮ":"B","ᴰ":"D","ᴱ":"E","ᴲ":"Ǝ","ᴳ":"G","ᴴ":"H","ᴵ":"I","ᴶ":"J","ᴷ":"K","ᴸ":"L","ᴹ":"M","ᴺ":"N","ᴼ":"O","ᴽ":"Ȣ","ᴾ":"P","ᴿ":"R","ᵀ":"T","ᵁ":"U","ᵂ":"W","ᵃ":"a","ᵄ":"ɐ","ᵅ":"ɑ","ᵆ":"ᴂ","ᵇ":"b","ᵈ":"d","ᵉ":"e","ᵊ":"ə","ᵋ":"ɛ","ᵌ":"ɜ","ᵍ":"g","ᵏ":"k","ᵐ":"m","ᵑ":"ŋ","ᵒ":"o","ᵓ":"ɔ","ᵔ":"ᴖ","ᵕ":"ᴗ","ᵖ":"p","ᵗ":"t","ᵘ":"u","ᵙ":"ᴝ","ᵚ":"ɯ","ᵛ":"v","ᵜ":"ᴥ","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"φ","ᵡ":"χ","⁰":"0","ⁱ":"i","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","⁺":"+","⁻":"−","⁼":"=","⁽":"(","⁾":")",ⁿ:"n","℠":"SM","™":"TM","㆒":"一","㆓":"二","㆔":"三","㆕":"四","㆖":"上","㆗":"中","㆘":"下","㆙":"甲","㆚":"乙","㆛":"丙","㆜":"丁","㆝":"天","㆞":"地","㆟":"人",ˀ:"ʔ",ˁ:"ʕ",ۥ:"و",ۦ:"ي"},SUPERSCRIPTS_REGEXP:new RegExp("[ª²³¹ºʰʱʲʳʴʵʶʷʸˠˡˢˣˤᴬᴭᴮᴰᴱᴲᴳᴴᴵᴶᴷᴸᴹᴺᴼᴽᴾᴿᵀᵁᵂᵃᵄᵅᵆᵇᵈᵉᵊᵋᵌᵍᵏᵐᵑᵒᵓᵔᵕᵖᵗᵘᵙᵚᵛᵜᵝᵞᵟᵠᵡ⁰ⁱ⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿ℠™㆒㆓㆔㆕㆖㆗㆘㆙㆚㆛㆜㆝㆞㆟ˀˁۥۦ]","g"),UPDATE_GROUP_CONTEXT_CONDITION:function(e,t,i,n,r){if(e.opt.use_context_condition){var a=e.tmp.group_context.tip;a.condition?(a.condition.termtxt||(a.condition.termtxt=t,a.condition.valueTerm=i),!a.value_seen&&a.condition.test==="comma-safe-numbers-only"&&r&&(a.value_seen=!0,r.match(/^[0-9]/)||(e.tmp.just_did_number=!1))):n&&n.decorations.filter(o=>o[0]==="@vertical-align").length>0||n&&n.strings.suffix?e.tmp.just_did_number=!1:t&&(t.match(/[0-9]$/)?e.tmp.just_did_number=!0:e.tmp.just_did_number=!1)}},EVALUATE_GROUP_CONDITION:function(e,t){if(e.opt.use_context_condition){var i,n=t.condition.test==="comma-safe-numbers-only";if(t.condition.test==="empty-label")i=!t.condition.termtxt;else if(t.condition.test==="empty-label-no-decor")i=!t.condition.termtxt||t.condition.termtxt.indexOf("%s")>-1;else if(["comma-safe","comma-safe-numbers-only"].indexOf(t.condition.test)>-1){var r=t.condition.termtxt,a=!1;t.condition.termtxt&&(a=t.condition.termtxt.slice(0,1).match(u.ALL_ROMANESQUE_REGEXP));var o=e.tmp.just_did_number;o?t.condition.valueTerm?i=!n:r?a?i=!n:["always","after-number"].indexOf(e.opt.require_comma_on_symbol)>-1?i=!0:i=!1:i=!0:t.condition.valueTerm?i=!1:r?a?i=!n:e.opt.require_comma_on_symbol==="always"?i=!0:i=!1:i=!1}if(i)var l=!1;else var l=!0;return t.condition.not&&(l=!l),l}},SYS_OPTIONS:["prioritize_disambiguate_condition","csl_reverse_lookup_support","main_title_from_short_title","uppercase_subtitles","force_short_title_casing_alignment","implicit_short_title","split_container_title"],TITLE_SPLIT_REGEXP:function(){var e=["\\.\\s+","\\!\\s+","\\?\\s+","\\s*::*\\s+","\\s*—\\s*","\\s+\\-\\s+","\\s*\\-\\-\\-*\\s*"];return{match:new RegExp("("+e.join("|")+")","g"),matchfirst:new RegExp("^("+e.join("|")+")"),split:new RegExp("(?:"+e.join("|")+")")}}(),TITLE_SPLIT:function(e){if(!e)return e;for(var t=e.match(u.TITLE_SPLIT_REGEXP.match),i=e.split(u.TITLE_SPLIT_REGEXP.split),n=i.length-2;n>-1;n--)i[n]=i[n].trim(),i[n]&&i[n].slice(-1).toLowerCase()!==i[n].slice(-1)?(i[n]=i[n]+t[n]+i[n+1],i=i.slice(0,n+1).concat(i.slice(n+2))):i=i.slice(0,n+1).concat([t[n]]).concat(i.slice(n+1));return i},GET_COURT_CLASS:function(e,t,i){var n="",r=null,a=t.jurisdiction?t.jurisdiction.split(":")[0]:null,o="court_condition_classes";return i&&(o="court_key_classes"),a&&t.authority&&(typeof t.authority=="string"?r=t.authority:t.authority[0]&&t.authority[0].literal&&(r=t.authority[0].literal)),r&&(this.lang&&e.locale[this.lang].opts[o]&&e.locale[this.lang].opts[o][a]&&e.locale[this.lang].opts[o][a][r]?n=e.locale[this.lang].opts[o][a][r]:e.locale[e.opt["default-locale"][0]].opts[o]&&e.locale[e.opt["default-locale"][0]].opts[o][a]&&e.locale[e.opt["default-locale"][0]].opts[o][a][r]&&(n=e.locale[e.opt["default-locale"][0]].opts[o][a][r])),n},SET_COURT_CLASSES:function(e,t,i,n){for(var r=i.getNodesByName(n,"court-class"),a=0,o=i.numberofnodes(r);a<o;a+=1){var l=r[a],c=i.attributes(l),f=c["@name"],p=c["@country"],m=c["@courts"],d="court_key_classes";if(e.registry&&(d="court_condition_classes"),f&&p&&m){m=m.trim().split(/\s+/),e.locale[t].opts[d]||(e.locale[t].opts[d]={}),e.locale[t].opts[d][p]||(e.locale[t].opts[d][p]={});for(var h=0,v=m.length;h<v;h++)e.locale[t].opts[d][p][m[h]]=f}}},INIT_JURISDICTION_MACROS:function(e,t,i,n){if(t["best-jurisdiction"])return!0;if(!e.sys.retrieveStyleModule||!u.MODULE_MACROS[n]||!t.jurisdiction)return!1;var l=e.getJurisdictionList(t.jurisdiction);if(!e.opt.jurisdictions_seen[l[0]]){var r=e.retrieveAllStyleModules(l);for(var a in r){var o=e.loadStyleModule(a,r[a]);o&&(r[o]||(Object.assign(r,e.retrieveAllStyleModules([o])),e.loadStyleModule(o,r[o],!0)))}}var l=e.getJurisdictionList(t.jurisdiction);e.opt.parallel.enable&&(e.parallel||(e.parallel=new u.Parallel(e)));for(var c=0,f=l.length;c<f;c++){var a=l[c];if(i&&e.juris[a]&&!i["best-jurisdiction"]&&e.juris[a].types.locator&&(t["best-jurisdiction"]=a),e.juris[a]&&e.juris[a].types[t.type])return t["best-jurisdiction"]=a,!0}return!1}};u.XmlJSON=function(e){this.dataObj=e,this.institution={name:"institution",attrs:{"institution-parts":"long",delimiter:", "},children:[{name:"institution-part",attrs:{name:"long"},children:[]}]}};u.XmlJSON.prototype.clean=function(e){return e};u.XmlJSON.prototype.getStyleId=function(e,t){var i="id";t&&(i="title");for(var n="",r=e.children,a=0,o=r.length;a<o;a++)if(r[a].name==="info")for(var l=r[a].children,c=0,f=l.length;c<f;c++)l[c].name===i&&(n=l[c].children[0]);return n};u.XmlJSON.prototype.children=function(e){return e&&e.children.length?e.children.slice():!1};u.XmlJSON.prototype.nodename=function(e){return e?e.name:null};u.XmlJSON.prototype.attributes=function(e){var t={};for(var i in e.attrs)t["@"+i]=e.attrs[i];return t};u.XmlJSON.prototype.content=function(e){var t="";if(!e||!e.children)return t;for(var i=0,n=e.children.length;i<n;i+=1)typeof e.children[i]=="string"&&(t+=e.children[i]);return t};u.XmlJSON.prototype.namespace={};u.XmlJSON.prototype.numberofnodes=function(e){return e&&typeof e.length=="number"?e.length:0};u.XmlJSON.prototype.getAttributeValue=function(e,t,i){var n="";return i&&(t=i+":"+t),e&&e.attrs&&(e.attrs[t]?n=e.attrs[t]:n=""),n};u.XmlJSON.prototype.getNodeValue=function(e,t){var i="";if(t)for(var n=0,r=e.children.length;n<r;n+=1)e.children[n].name===t&&(e.children[n].children.length?i=e.children[n]:i="");else e&&(i=e);return i&&i.children&&i.children.length==1&&typeof i.children[0]=="string"&&(i=i.children[0]),i};u.XmlJSON.prototype.setAttributeOnNodeIdentifiedByNameAttribute=function(e,t,i,n,r){n.slice(0,1)==="@"&&(n=n.slice(1));for(var a=0,o=e.children.length;a<o;a+=1)e.children[a].name===t&&e.children[a].attrs.name===i&&(e.children[a].attrs[n]=r)};u.XmlJSON.prototype.deleteNodeByNameAttribute=function(e,t){var i,n;for(i=0,n=e.children.length;i<n;i+=1)!e.children[i]||typeof e.children[i]=="string"||e.children[i].attrs.name==t&&(e.children=e.children.slice(0,i).concat(e.children.slice(i+1)))};u.XmlJSON.prototype.deleteAttribute=function(e,t){typeof e.attrs[t]<"u"&&e.attrs.pop(t)};u.XmlJSON.prototype.setAttribute=function(e,t,i){return e.attrs[t]=i,!1};u.XmlJSON.prototype.nodeCopy=function(e,t){if(!t)var t={};if(typeof t=="object"&&typeof t.length>"u")for(var i in e)typeof e[i]=="string"?t[i]=e[i]:typeof e[i]=="object"&&(typeof e[i].length>"u"?t[i]=this.nodeCopy(e[i],{}):t[i]=this.nodeCopy(e[i],[]));else for(var n=0,r=e.length;n<r;n+=1)typeof e[n]=="string"?t[n]=e[n]:t[n]=this.nodeCopy(e[n],{});return t};u.XmlJSON.prototype.getNodesByName=function(e,t,i,n){if(!n)var n=[];if(!e||!e.children)return n;t===e.name&&(i?i===e.attrs.name&&n.push(e):n.push(e));for(var r=0,a=e.children.length;r<a;r+=1)typeof e.children[r]=="object"&&this.getNodesByName(e.children[r],t,i,n);return n};u.XmlJSON.prototype.nodeNameIs=function(e,t){return typeof e>"u"?!1:t==e.name};u.XmlJSON.prototype.makeXml=function(e){return typeof e=="string"&&(e.slice(0,1)==="<"?e=this.jsonStringWalker.walkToObject(e):e=JSON.parse(e)),e};u.XmlJSON.prototype.insertChildNodeAfter=function(e,t,i,n){for(var r=0,a=e.children.length;r<a;r+=1)if(t===e.children[r]){e.children=e.children.slice(0,r).concat([n]).concat(e.children.slice(r+1));break}return e};u.XmlJSON.prototype.insertPublisherAndPlace=function(e){if(e.name==="group"){for(var t=!0,i=["publisher","publisher-place"],n=0,r=e.children.length;n<r;n+=1){var a=i.indexOf(e.children[n].attrs.variable),o=e.children[n].name==="text";if(o&&a>-1&&!e.children[n].attrs.prefix&&!e.children[n].attrs.suffix)i=i.slice(0,a).concat(i.slice(a+1));else{t=!1;break}}t&&!i.length&&(e.attrs["has-publisher-and-publisher-place"]=!0)}for(var n=0,r=e.children.length;n<r;n+=1)typeof e.children[n]=="object"&&this.insertPublisherAndPlace(e.children[n])};u.XmlJSON.prototype.isChildOfSubstitute=function(e){if(e.length>0){var t=e.slice(),i=t.pop();return i==="substitute"?!0:this.isChildOfSubstitute(t)}return!1};u.XmlJSON.prototype.addMissingNameNodes=function(e,t){if(t||(t=[]),e.name==="names"&&!this.isChildOfSubstitute(t)){for(var i=!0,n=0,r=e.children.length;n<r;n++)if(e.children[n].name==="name"){i=!1;break}i&&(e.children=[{name:"name",attrs:{},children:[]}].concat(e.children))}t.push(e.name);for(var n=0,r=e.children.length;n<r;n+=1)typeof e.children[n]=="object"&&this.addMissingNameNodes(e.children[n],t);t.pop()};u.XmlJSON.prototype.addInstitutionNodes=function(e){var t;if(e.name==="names"){for(var i={},n=-1,r=0,a=e.children.length;r<a;r+=1){if(e.children[r].name=="name"){for(var o in e.children[r].attrs)i[o]=e.children[r].attrs[o];i.delimiter=e.children[r].attrs.delimiter,i.and=e.children[r].attrs.and,n=r;for(var l=0,c=e.children[r].children.length;l<c;l+=1)if(e.children[r].children[l].attrs.name==="family")for(var o in e.children[r].children[l].attrs)i[o]=e.children[r].children[l].attrs[o]}if(e.children[r].name=="institution"){n=-1;break}}if(n>-1){for(var t=this.nodeCopy(this.institution),r=0,a=u.INSTITUTION_KEYS.length;r<a;r+=1){var f=u.INSTITUTION_KEYS[r];typeof i[f]<"u"&&(t.children[0].attrs[f]=i[f]),i.delimiter&&(t.attrs.delimiter=i.delimiter),i.and&&(t.attrs.and=i.and)}e.children=e.children.slice(0,n+1).concat([t]).concat(e.children.slice(n+1))}}for(var r=0,a=e.children.length;r<a;r+=1)typeof e.children[r]!="string"&&this.addInstitutionNodes(e.children[r])};u.XmlJSON.prototype.flagDateMacros=function(e){for(var t=0,i=e.children.length;t<i;t+=1)e.children[t].name==="macro"&&this.inspectDateMacros(e.children[t])&&(e.children[t].attrs["macro-has-date"]="true")};u.XmlJSON.prototype.inspectDateMacros=function(e){if(!e||!e.children)return!1;if(e.name==="date")return!0;for(var t=0,i=e.children.length;t<i;t+=1)if(this.inspectDateMacros(e.children[t]))return!0;return!1};u.stripXmlProcessingInstruction=function(e){return e&&(e=e.replace(/^<\?[^?]+\?>/,""),e=e.replace(/<!--[^>]+-->/g,""),e=e.replace(/^\s+/g,""),e=e.replace(/\s+$/g,""),e)};u.parseXml=function(e){var t={children:[]},i=[t.children];function n(g){g=g.split(/(?:\r\n|\n|\r)/).join(" ").replace(/>[ ]+</g,"><").replace(/<\!--.*?-->/g,"");for(var x=g.split("><"),k=null,w=0,C=x.length;w<C;w++)w>0&&(x[w]="<"+x[w]),w<x.length-1&&(x[w]=x[w]+">"),typeof k!="number"&&(x[w].slice(0,7)==="<style "||x[w].slice(0,8)=="<locale ")&&(k=w);x=x.slice(k);for(var w=x.length-2;w>-1;w--)if(x[w].slice(1).indexOf("<")===-1){var E=x[w].slice(0,5);x[w].slice(-2)!=="/>"&&(E==="<term"?x[w+1].slice(0,6)==="</term"&&(x[w]=x[w]+x[w+1],x=x.slice(0,w+1).concat(x.slice(w+2))):["<sing","<mult"].indexOf(E)>-1&&x[w].slice(-2)!=="/>"&&x[w+1].slice(0,1)==="<"&&(x[w]=x[w]+x[w+1],x=x.slice(0,w+1).concat(x.slice(w+2))))}return x}function r(g){return g.split("&amp;").join("&").split("&quot;").join('"').split("&gt;").join(">").split("&lt;").join("<").replace(/&#([0-9]{1,6});/gi,function(x,k){var w=parseInt(k,10);return String.fromCharCode(w)}).replace(/&#x([a-f0-9]{1,6});/gi,function(x,k){var w=parseInt(k,16);return String.fromCharCode(w)})}function a(g){var x=g.match(/([^\'\"= ]+)=(?:\"[^\"]*\"|\'[^\']*\')/g);if(x)for(var k=0,w=x.length;k<w;k++)x[k]=x[k].replace(/=.*/,"");return x}function o(g,x){var k=RegExp("^.*[ ]+"+x+`=("(?:[^"]*)"|'(?:[^']*)').*$`),w=g.match(k);return w?w[1].slice(1,-1):null}function l(g){var x=RegExp("^<([^ />]+)"),k=g.match(x);return k?k[1]:null}function c(g){var x={};x.name=l(g),x.attrs={};var k=a(g);if(k)for(var w=0,C=k.length;w<C;w++){var E={name:k[w],value:o(g,k[w])};x.attrs[E.name]=r(E.value)}return x.children=[],x}function f(g){var x=g.match(/^.*>([^<]*)<.*$/);return r(x[1])}function p(g){i.slice(-1)[0].push(g)}function m(g){i.push(g.children)}function d(g){var x;if(g.slice(1).indexOf("<")>-1){var k=g.slice(0,g.indexOf(">")+1);x=c(k),x.children=[f(g)],p(x)}else g.slice(-2)==="/>"?(x=c(g),l(g)==="term"&&x.children.push(""),p(x)):g.slice(0,2)==="</"?i.pop():(x=c(g),p(x),m(x))}for(var h=n(e),v=0,b=h.length;v<b;v++){var y=h[v];d(y)}return t.children[0]};u.XmlDOM=function(e){this.dataObj=e,typeof DOMParser>"u"?(DOMParser=function(){},DOMParser.prototype.parseFromString=function(a,o){if(typeof ActiveXObject<"u"){var l=new ActiveXObject("MSXML.DomDocument");return l.async=!1,l.loadXML(a),l}else if(typeof XMLHttpRequest<"u"){var l=new XMLHttpRequest;return o||(o="text/xml"),l.open("GET","data:"+o+";charset=utf-8,"+encodeURIComponent(a),!1),l.overrideMimeType&&l.overrideMimeType(o),l.send(null),l.responseXML}else if(typeof marknote<"u"){var c=new marknote.Parser;return c.parse(a)}},this.hasAttributes=function(a){var o;return a.attributes&&a.attributes.length?o=!0:o=!1,o}):this.hasAttributes=function(a){var o;return a.attributes&&a.attributes.length?o=!0:o=!1,o},this.importNode=function(a,o){var l;return typeof a.importNode>"u"?l=this._importNode(a,o,!0):l=a.importNode(o,!0),l},this._importNode=function(a,o,l){switch(o.nodeType){case 1:var c=a.createElement(o.nodeName);if(o.attributes&&o.attributes.length>0)for(var f=0,p=o.attributes.length;f<p;)c.setAttribute(o.attributes[f].nodeName,o.getAttribute(o.attributes[f++].nodeName));if(l&&o.childNodes&&o.childNodes.length>0)for(var f=0,p=o.childNodes.length;f<p;)c.appendChild(this._importNode(a,o.childNodes[f++],l));return c}},this.parser=new DOMParser;var t='<docco><institution institution-parts="long" delimiter=", " substitute-use-first="1" use-last="1"><institution-part name="long"/></institution></docco>',i=this.parser.parseFromString(t,"text/xml"),n=i.getElementsByTagName("institution");this.institution=n.item(0);var r=i.getElementsByTagName("institution-part");this.institutionpart=r.item(0),this.ns="http://purl.org/net/xbiblio/csl"};u.XmlDOM.prototype.clean=function(e){return e=e.replace(/<\?[^?]+\?>/g,""),e=e.replace(/<![^>]+>/g,""),e=e.replace(/^\s+/,""),e=e.replace(/\s+$/,""),e=e.replace(/^\n*/,""),e};u.XmlDOM.prototype.getStyleId=function(e,t){var i="",n="id";t&&(n="title");var r=e.getElementsByTagName(n);return r&&r.length&&(r=r.item(0)),r&&(i=r.textContent),i||(i=r.innerText),i||(i=r.innerHTML),i};u.XmlDOM.prototype.children=function(e){var t,i,n,r;if(e){for(r=[],t=e.childNodes,i=0,n=t.length;i<n;i+=1)t[i].nodeName!="#text"&&r.push(t[i]);return r}else return[]};u.XmlDOM.prototype.nodename=function(e){var t=e.nodeName;return t};u.XmlDOM.prototype.attributes=function(e){var t,i,n,r,a;if(t=new Object,e&&this.hasAttributes(e))for(i=e.attributes,r=0,a=i.length;r<a;r+=1)n=i[r],t["@"+n.name]=n.value;return t};u.XmlDOM.prototype.content=function(e){var t;return typeof e.textContent<"u"?t=e.textContent:typeof e.innerText<"u"?t=e.innerText:t=e.txt,t};u.XmlDOM.prototype.namespace={xml:"http://www.w3.org/XML/1998/namespace"};u.XmlDOM.prototype.numberofnodes=function(e){return e?e.length:0};u.XmlDOM.prototype.getAttributeName=function(e){var t=e.name;return t};u.XmlDOM.prototype.getAttributeValue=function(e,t,i){var n="";return i&&(t=i+":"+t),e&&this.hasAttributes(e)&&e.getAttribute(t)&&(n=e.getAttribute(t)),n};u.XmlDOM.prototype.getNodeValue=function(e,t){var i=null;if(t){var n=e.getElementsByTagName(t);n.length>0&&(typeof n[0].textContent<"u"?i=n[0].textContent:typeof n[0].innerText<"u"?i=n[0].innerText:i=n[0].text)}return i===null&&e&&e.childNodes&&(e.childNodes.length==0||e.childNodes.length==1&&e.firstChild.nodeName=="#text")&&(typeof e.textContent<"u"?i=e.textContent:typeof e.innerText<"u"?i=e.innerText:i=e.text),i===null&&(i=e),i};u.XmlDOM.prototype.setAttributeOnNodeIdentifiedByNameAttribute=function(e,t,i,n,r){var a,o,l,c;for(n.slice(0,1)==="@"&&(n=n.slice(1)),l=e.getElementsByTagName(t),a=0,o=l.length;a<o;a+=1)c=l[a],c.getAttribute("name")==i&&c.setAttribute(n,r)};u.XmlDOM.prototype.deleteNodeByNameAttribute=function(e,t){var i,n,r,a;for(a=e.childNodes,i=0,n=a.length;i<n;i+=1)r=a[i],!(!r||r.nodeType==r.TEXT_NODE)&&this.hasAttributes(r)&&r.getAttribute("name")==t&&e.removeChild(a[i])};u.XmlDOM.prototype.deleteAttribute=function(e,t){e.removeAttribute(t)};u.XmlDOM.prototype.setAttribute=function(e,t,i){return e.ownerDocument||(e=e.firstChild),["function","unknown"].indexOf(typeof e.setAttribute)>-1&&e.setAttribute(t,i),!1};u.XmlDOM.prototype.nodeCopy=function(e){var t=e.cloneNode(!0);return t};u.XmlDOM.prototype.getNodesByName=function(e,t,i){var n,r,a,o,l;for(n=[],r=e.getElementsByTagName(t),o=0,l=r.length;o<l;o+=1)a=r.item(o),!(i&&!(this.hasAttributes(a)&&a.getAttribute("name")==i))&&n.push(a);return n};u.XmlDOM.prototype.nodeNameIs=function(e,t){return t==e.nodeName};u.XmlDOM.prototype.makeXml=function(e){e||(e="<docco><bogus/></docco>"),e=e.replace(/\s*<\?[^>]*\?>\s*\n*/g,"");var t=this.parser.parseFromString(e,"application/xml");return t.firstChild};u.XmlDOM.prototype.insertChildNodeAfter=function(e,t,i,n){var r;return r=this.importNode(t.ownerDocument,n),e.replaceChild(r,t),e};u.XmlDOM.prototype.insertPublisherAndPlace=function(e){for(var t=e.getElementsByTagName("group"),i=0,n=t.length;i<n;i+=1){for(var r=t.item(i),a=[],o=0,l=r.childNodes.length;o<l;o+=1)r.childNodes.item(o).nodeType!==1&&a.push(o);if(r.childNodes.length-a.length===2){for(var c=[],o=0,l=2;o<l;o+=1)if(!(a.indexOf(o)>-1)){for(var f=r.childNodes.item(o),p=[],m=0,d=f.childNodes.length;m<d;m+=1)f.childNodes.item(m).nodeType!==1&&p.push(m);if(f.childNodes.length-p.length===0&&(c.push(f.getAttribute("variable")),f.getAttribute("suffix")||f.getAttribute("prefix"))){c=[];break}}c.indexOf("publisher")>-1&&c.indexOf("publisher-place")>-1&&r.setAttribute("has-publisher-and-publisher-place",!0)}}};u.XmlDOM.prototype.isChildOfSubstitute=function(e){return e.parentNode?e.parentNode.tagName.toLowerCase()==="substitute"?!0:this.isChildOfSubstitute(e.parentNode):!1};u.XmlDOM.prototype.addMissingNameNodes=function(e){for(var t=e.getElementsByTagName("names"),i=0,n=t.length;i<n;i+=1){var r=t.item(i),a=r.getElementsByTagName("name");if((!a||a.length===0)&&!this.isChildOfSubstitute(r)){var o=r.ownerDocument,l=o.createElement("name");r.appendChild(l)}}};u.XmlDOM.prototype.addInstitutionNodes=function(e){var t,i,n,r,a,o,l,c,f;for(t=e.getElementsByTagName("names"),c=0,f=t.length;c<f;c+=1)if(i=t.item(c),o=i.getElementsByTagName("name"),o.length!=0&&(n=i.getElementsByTagName("institution"),n.length==0)){r=this.importNode(e.ownerDocument,this.institution),a=r.getElementsByTagName("institution-part").item(0),l=o.item(0),i.insertBefore(r,l.nextSibling);for(var p=0,m=u.INSTITUTION_KEYS.length;p<m;p+=1){var d=u.INSTITUTION_KEYS[p],h=l.getAttribute(d);h&&a.setAttribute(d,h)}for(var v=l.getElementsByTagName("name-part"),p=0,m=v.length;p<m;p+=1)if(v[p].getAttribute("name")==="family")for(var b=0,y=u.INSTITUTION_KEYS.length;b<y;b+=1){var d=u.INSTITUTION_KEYS[b],h=v[p].getAttribute(d);h&&a.setAttribute(d,h)}}};u.XmlDOM.prototype.flagDateMacros=function(e){var t,i,n,r,a=e.getElementsByTagName("macro");for(t=0,i=a.length;t<i;t+=1)n=a.item(t),r=n.getElementsByTagName("date"),r.length&&n.setAttribute("macro-has-date","true")};u.setupXml=function(e){var t={},i=null;return typeof e<"u"?typeof e=="string"?(e=e.replace("^\uFEFF","").replace(/^\s+/,""),e.slice(0,1)==="<"?t=u.parseXml(e):t=JSON.parse(e),i=new u.XmlJSON(t)):typeof e.getAttribute<"u"?i=new u.XmlDOM(e):typeof e.toXMLString<"u"?i=new u.XmlE4X(e):i=new u.XmlJSON(e):u.error("unable to parse XML input"),i||u.error("citeproc-js error: unable to parse CSL style or locale object"),i};u.getSortCompare=function(e){if(u.stringCompare)return u.stringCompare;var t=this,i,n={sensitivity:"base",ignorePunctuation:!0,numeric:!0};e||(e="en-US"),i=function(c,f){return u.toLocaleLowerCase.call(t,c).localeCompare(u.toLocaleLowerCase.call(t,f),e,n)};var r=function(c){return c.replace(/^[\[\]\'\"]*/g,"")},a=function(){return i("[x","x")?function(c,f){return i(r(c),r(f))}:!1},o=a(),l=function(c,f){return o?o(c,f):i(c,f)};return l};u.ambigConfigDiff=function(e,t){var i,n,r,a;if(e.names.length!==t.names.length)return 1;for(i=0,n=e.names.length;i<n;i+=1){if(e.names[i]!==t.names[i])return 1;for(r=0,a=e.givens[i];r<a;r+=1)if(e.givens[i][r]!==t.givens[i][r])return 1}return e.disambiguate!=t.disambiguate||e.year_suffix!==t.year_suffix?1:0};u.cloneAmbigConfig=function(e,t){var i,n,r,a,o,l={};for(l.names=[],l.givens=[],l.year_suffix=!1,l.disambiguate=!1,i=0,n=e.names.length;i<n;i+=1)o=e.names[i],l.names[i]=o;for(i=0,n=e.givens.length;i<n;i+=1){for(o=[],r=0,a=e.givens[i].length;r<a;r+=1)o.push(e.givens[i][r]);l.givens.push(o)}return t?(l.year_suffix=t.year_suffix,l.disambiguate=t.disambiguate):(l.year_suffix=e.year_suffix,l.disambiguate=e.disambiguate),l};u.getAmbigConfig=function(){var e,t;e=this.tmp.disambig_request,e||(e=this.tmp.disambig_settings);var t=u.cloneAmbigConfig(e);return t};u.getMaxVals=function(){return this.tmp.names_max.mystack.slice()};u.getMinVal=function(){return this.tmp["et-al-min"]};u.tokenExec=function(e,t,i){var n,r,a,o;o=!1,n=e.next,r=!1;var l=function(p){return p?(this.tmp.jump.replace("succeed"),e.succeed):(this.tmp.jump.replace("fail"),e.fail)};e.test&&(n=l.call(this,e.test(t,i)));for(var c=0,f=e.execs.length;c<f;c++)a=e.execs[c],r=a.call(e,this,t,i),r&&(n=r);return o&&u.debug(e.name+" ("+e.tokentype+") ---> done"),n};u.expandMacro=function(e,t){var i,n,r,a;i=e.postponed_macro;var o=e.strings.sort_direction;e=new u.Token("group",u.START);var l=!1,c=!1;n=this.cslXml.getNodesByName(this.cslXml.dataObj,"macro",i),n.length&&(c=this.cslXml.getAttributeValue(n[0],"cslid"),l=this.cslXml.getAttributeValue(n[0],"macro-has-date")),l&&(i=i+"@"+this.build.current_default_locale,a=function(m){m.tmp.extension&&(m.tmp["doing-macro-with-date"]=!0)},e.execs.push(a)),this.build.macro_stack.indexOf(i)>-1?u.error('CSL processor error: call to macro "'+i+'" would cause an infinite loop'):this.build.macro_stack.push(i),e.cslid=c,u.MODULE_MACROS[i]&&(e.juris=i,this.opt.update_mode=u.POSITION),u.Node.group.build.call(e,this,t,!0),this.cslXml.getNodeValue(n)||u.error('CSL style error: undefined macro "'+i+'"');var f=u.getMacroTarget.call(this,i);if(f&&(u.buildMacro.call(this,f,n),u.configureMacro.call(this,f)),!this.build.extension){var a=function(d){return function(h,v,b){for(var y=0;y<h.macros[d].length;)y=u.tokenExec.call(h,h.macros[d][y],v,b)}}(i),p=new u.Token("text",u.SINGLETON);p.execs.push(a),t.push(p)}r=new u.Token("group",u.END),r.strings.sort_direction=o,l&&(a=function(m){m.tmp.extension&&(m.tmp["doing-macro-with-date"]=!1)},r.execs.push(a)),e.juris&&(r.juris=i),u.Node.group.build.call(r,this,t,!0),this.build.macro_stack.pop()};u.getMacroTarget=function(e){var t=!1;return this.build.extension?t=this[this.build.root+this.build.extension].tokens:this.macros[e]||(t=[],this.macros[e]=t),t};u.buildMacro=function(e,t){var i=u.makeBuilder(this,e),n;typeof t.length>"u"?n=t:n=t[0],i(n)};u.configureMacro=function(e){this.build.extension||this.configureTokenList(e)};u.XmlToToken=function(e,t,i,n){var r,a,o,l,c,f,p;if(r=e.cslXml.nodename(this),!(e.build.skip&&e.build.skip!==r)){if(!r){a=e.cslXml.content(this),a&&(e.build.text=a);return}if(u.Node[e.cslXml.nodename(this)]||u.error('Undefined node name "'+r+'".'),o=e.cslXml.attributes(this),l=u.setDecorations.call(this,e,o),c=new u.Token(r,t),t!==u.END||r==="if"||r==="else-if"||r==="layout"){for(var f in o)if(o.hasOwnProperty(f)){if(t===u.END&&f!=="@language"&&f!=="@locale")continue;if(o.hasOwnProperty(f))if(u.Attributes[f])try{u.Attributes[f].call(c,e,""+o[f])}catch(d){u.error(f+" attribute: "+d)}else u.debug('warning: undefined attribute "'+f+'" in style')}c.decorations=l,u.DATE_VARIABLES.indexOf(o["@variable"])>-1&&n.push(c.variables)}else t===u.END&&o["@variable"]&&(c.hasVariable=!0,u.DATE_VARIABLES.indexOf(o["@variable"])>-1&&(c.variables=n.pop()));i?p=i:p=e[e.build.area].tokens,u.Node[r].build.call(c,e,p,!0)}};u.DateParser=function(){for(var e=[["明治",1867],["大正",1911],["昭和",1925],["平成",1988]],t=0,i=e.length;t<i;t++){e[t][0];var n=e[t][1]}for(var r=[],a={},t=0,i=e.length;t<i;t++){var o=e[t],n=o[0];r.push(n),a[o[0]]=o[1]}var l=r.join("|"),c=new RegExp("(?:"+l+")(?:[0-9]+)"),f=new RegExp("(?:"+l+")(?:[0-9]+)","g"),p=/(\u6708|\u5E74)/g,m=/\u65E5/g,d=/\u301c/g,h="(?:[?0-9]{1,2}%%NUMD%%){0,2}[?0-9]{4}(?![0-9])",v="[?0-9]{4}(?:%%NUMD%%[?0-9]{1,2}){0,2}(?![0-9])",b="[?0-9]{1,3}",y="[%%DATED%%]",g="[?~]",x="[^-/~?0-9]+",k="("+v+"|"+h+"|"+b+"|"+y+"|"+g+"|"+x+")",w=new RegExp(k.replace(/%%NUMD%%/g,"-").replace(/%%DATED%%/g,"-")),C=new RegExp(k.replace(/%%NUMD%%/g,"-").replace(/%%DATED%%/g,"/")),E=new RegExp(k.replace(/%%NUMD%%/g,"/").replace(/%%DATED%%/g,"-")),B="january february march april may june july august september october november december spring summer fall winter spring summer";this.monthStrings=B.split(" "),this.setOrderDayMonth=function(){this.monthGuess=1,this.dayGuess=0},this.setOrderMonthDay=function(){this.monthGuess=0,this.dayGuess=1},this.resetDateParserMonths=function(){this.monthSets=[];for(var _=0,S=this.monthStrings.length;_<S;_++)this.monthSets.push([this.monthStrings[_]]);this.monthAbbrevs=[];for(var _=0,S=this.monthSets.length;_<S;_++){this.monthAbbrevs.push([]);for(var T=0,D=this.monthSets[_].length;T<D;T++)this.monthAbbrevs[_].push(this.monthSets[_][0].slice(0,3))}this.monthRexes=[];for(var _=0,S=this.monthAbbrevs.length;_<S;_++)this.monthRexes.push(new RegExp("(?:"+this.monthAbbrevs[_].join("|")+")"))},this.addDateParserMonths=function(_){if(typeof _=="string"&&(_=_.split(/\s+/)),_.length!==12&&_.length!==16){u.debug("month [+season] list of "+_.length+", expected 12 or 16. Ignoring.");return}for(var S=0,T=_.length;S<T;S++){for(var D=null,H=!1,V=3,M={},$=0,P=this.monthAbbrevs.length;$<P;$++){if(M[$]={},$===S){for(var W=0,L=this.monthAbbrevs[S].length;W<L;W++)if(this.monthAbbrevs[S][W]===_[S].slice(0,this.monthAbbrevs[S][W].length)){H=!0;break}}else for(var W=0,L=this.monthAbbrevs[$].length;W<L;W++)if(D=this.monthAbbrevs[$][W].length,this.monthAbbrevs[$][W]===_[S].slice(0,D)){for(;this.monthSets[$][W].slice(0,D)===_[S].slice(0,D);)if(D>_[S].length||D>this.monthSets[$][W].length){u.debug("unable to disambiguate month string in date parser: "+_[S]);break}else D+=1;V=D,M[$][W]=D}for(var Q in M)for(var j in M[Q])D=M[Q][j],Q=parseInt(Q,10),j=parseInt(j,10),this.monthAbbrevs[Q][j]=this.monthSets[Q][j].slice(0,D)}H||(this.monthSets[S].push(_[S]),this.monthAbbrevs[S].push(_[S].slice(0,V)))}this.monthRexes=[],this.monthRexStrs=[];for(var S=0,T=this.monthAbbrevs.length;S<T;S++)this.monthRexes.push(new RegExp("^(?:"+this.monthAbbrevs[S].join("|")+")")),this.monthRexStrs.push("^(?:"+this.monthAbbrevs[S].join("|")+")");if(this.monthAbbrevs.length===18)for(var S=12,T=14;S<T;S++)this.monthRexes[S+4]=new RegExp("^(?:"+this.monthAbbrevs[S].join("|")+")"),this.monthRexStrs[S+4]="^(?:"+this.monthAbbrevs[S].join("|")+")"},this.convertDateObjectToArray=function(_){_["date-parts"]=[],_["date-parts"].push([]);for(var S=0,T,D=0,H=3;D<H&&(T=["year","month","day"][D],!!_[T]);D++)S+=1,_["date-parts"][0].push(_[T]),delete _[T];_["date-parts"].push([]);for(var D=0,H=S;D<H&&(T=["year_end","month_end","day_end"][D],!!_[T]);D++)_["date-parts"][1].push(_[T]),delete _[T];return _["date-parts"][0].length!==_["date-parts"][1].length&&_["date-parts"].pop(),_},this.convertDateObjectToString=function(_){for(var S=[],T=0,D=3;T<D&&_[u.DATE_PARTS_ALL[T]];T+=1)S.push(_[u.DATE_PARTS_ALL[T]]);return S.join("-")},this._parseNumericDate=function(_,S,T,D){T||(T="");for(var H=D.split(S),V=0,M=H.length;V<M;V++)if(H[V].length===4){_["year"+T]=H[V].replace(/^0*/,""),V?H=H.slice(0,V):H=H.slice(1);break}for(var V=0,M=H.length;V<M;V++)H[V]=parseInt(H[V],10);if(H.length===1||H.length===2&&!H[1]){var $=H[0];$&&(_["month"+T]=""+H[0])}else if(H.length===2)if(H[this.monthGuess]>12){var $=H[this.dayGuess],P=H[this.monthGuess];$&&(_["month"+T]=""+$,P&&(_["day"+T]=""+P))}else{var $=H[this.monthGuess],P=H[this.dayGuess];$&&(_["month"+T]=""+$,P&&(_["day"+T]=""+P))}},this.parseDateToObject=function(_){var S=_,T=-1,D=-1,H=!1,V;if(_){if(_=_.replace(/^(.*[0-9])T[0-9].*/,"$1"),_.slice(0,1)==="-"&&(H=!0,_=_.slice(1)),_.match(/^[0-9]{1,3}$/))for(;_.length<4;)_="0"+_;_=""+_,_=_.replace(/\s*[0-9]{2}:[0-9]{2}(?::[0-9]+)/,"");var M=_.match(p);if(M){_=_.replace(/\s+/g,""),_=_.replace(m,""),_=_.replace(p,"-"),_=_.replace(d,"/"),_=_.replace(/\-\//g,"/"),_=_.replace(/-$/g,"");var $=_.split(c);V=[];var P=_.match(f);if(P){for(var W=[],L=0,Q=P.length;L<Q;L++)W=W.concat(P[L].match(/([^0-9]+)([0-9]+)/).slice(1));for(var L=0,Q=$.length;L<Q;L++)if(V.push($[L]),L!==Q-1){var j=L*2;V.push(W[j]),V.push(W[j+1])}}else V=$;for(var L=1,Q=V.length;L<Q;L+=3)V[L+1]=a[V[L]]+parseInt(V[L+1],10),V[L]="";_=V.join(""),_=_.replace(/\s*-\s*$/,"").replace(/\s*-\s*\//,"/"),_=_.replace(/\.\s*$/,""),_=_.replace(/\.(?! )/,""),T=_.indexOf("/"),D=_.indexOf("-")}}_=_.replace(/([A-Za-z])\./g,"$1");var O="",R="",U={},oe,ie;if(_.slice(0,1)==='"'&&_.slice(-1)==='"')return U.literal=_.slice(1,-1),U;if(T>-1&&D>-1){var ee=_.split("/");ee.length>3?(oe="-",_=_.replace(/\_/g,"-"),ie="/",V=_.split(E)):(oe="/",_=_.replace(/\_/g,"/"),ie="-",V=_.split(C))}else _=_.replace(/\//g,"-"),_=_.replace(/\_/g,"-"),oe="-",ie="-",V=_.split(w);for(var te=[],L=0,Q=V.length;L<Q;L++){var M=V[L].match(/^\s*([\-\/]|[^\-\/\~\?0-9]+|[\-~?0-9]+)\s*$/);M&&te.push(M[1])}var X=te.indexOf(oe),F=[],q=!1;X>-1?(F.push([0,X]),F.push([X+1,te.length]),q=!0):F.push([0,te.length]);for(var ne="",L=0,Q=F.length;L<Q;L++){var se=F[L],Se=te.slice(se[0],se[1]);e:for(var Ae=0,fe=Se.length;Ae<fe;Ae++){var ke=Se[Ae];if(ke.indexOf(ie)>-1){this._parseNumericDate(U,ie,ne,ke);continue}if(ke.match(/[0-9]{4}/)){U["year"+ne]=ke.replace(/^0*/,"");continue}(ke==="~"||ke==="?"||ke==="c"||ke.match(/^cir/))&&(U.circa=!0);for(var G=0,yt=this.monthRexes.length;G<yt;G++)if(ke.toLocaleLowerCase().match(this.monthRexes[G])){U["month"+ne]=""+(parseInt(G,10)+1);continue e}if(ke.match(/^[0-9]+$/)&&(O=ke),ke.toLocaleLowerCase().match(/^bc/)&&O){U["year"+ne]=""+O*-1,O="";continue}if(ke.toLocaleLowerCase().match(/^ad/)&&O){U["year"+ne]=""+O,O="";continue}if(ke.toLocaleLowerCase().match(/(?:mic|tri|hil|eas)/)&&!U["season"+ne]){R=ke;continue}}O&&(U["day"+ne]=O,O=""),R&&!U["season"+ne]&&(U["season"+ne]=R.trim(),R=""),ne="_end"}if(q)for(var Ae=0,fe=u.DATE_PARTS_ALL.length;Ae<fe;Ae++){var we=u.DATE_PARTS_ALL[Ae];U[we]&&!U[we+"_end"]?U[we+"_end"]=U[we]:!U[we]&&U[we+"_end"]&&(U[we]=U[we+"_end"])}(!U.year||U.year&&U.day&&!U.month)&&(U={literal:S});for(var At=["year","month","day","year_end","month_end","day_end"],L=0,Q=At.length;L<Q;L++){var K=At[L];typeof U[K]=="string"&&U[K].match(/^[0-9]+$/)&&(U[K]=parseInt(U[K],10))}return H&&Object.keys(U).indexOf("year")>-1&&(U.year=U.year*-1),U},this.parseDateToArray=function(_){return this.convertDateObjectToArray(this.parseDateToObject(_))},this.parseDateToString=function(_){return this.convertDateObjectToString(this.parseDateToObject(_))},this.parse=function(_){return this.parseDateToObject(_)},this.setOrderMonthDay(),this.resetDateParserMonths()};u.DateParser=new u.DateParser;u.Engine=function(e,t,i,n){var r,a;this.processor_version=u.PROCESSOR_VERSION,this.csl_version="1.0",this.sys=e,typeof Object.assign!="function"&&Object.defineProperty(Object,"assign",{value:function(m){if(m==null)throw new TypeError("Cannot convert undefined or null to object");for(var d=Object(m),h=1;h<arguments.length;h++){var v=arguments[h];if(v!=null)for(var b in v)Object.prototype.hasOwnProperty.call(v,b)&&(d[b]=v[b])}return d},writable:!0,configurable:!0}),e.variableWrapper&&(u.VARIABLE_WRAPPER_PREPUNCT_REX=new RegExp("^(["+[" "].concat(u.SWAPPING_PUNCTUATION).join("")+"]*)(.*)")),u.retrieveStyleModule&&(this.sys.retrieveStyleModule=u.retrieveStyleModule),u.getAbbreviation&&(this.sys.getAbbreviation=u.getAbbreviation),this.sys.stringCompare&&(u.stringCompare=this.sys.stringCompare),this.sys.AbbreviationSegments=u.AbbreviationSegments,this.transform=new u.Transform(this),this.setParseNames=function(p){this.opt["parse-names"]=p},this.opt=new u.Engine.Opt,this.tmp=new u.Engine.Tmp,this.build=new u.Engine.Build,this.fun=new u.Engine.Fun(this),this.configure=new u.Engine.Configure,this.citation_sort=new u.Engine.CitationSort,this.bibliography_sort=new u.Engine.BibliographySort,this.citation=new u.Engine.Citation(this),this.bibliography=new u.Engine.Bibliography,this.intext=new u.Engine.InText,this.output=new u.Output.Queue(this),this.dateput=new u.Output.Queue(this),this.cslXml=u.setupXml(t);for(var o in u.SYS_OPTIONS){var l=u.SYS_OPTIONS[o];typeof this.sys[l]=="boolean"&&(this.opt.development_extensions[l]=this.sys[l])}(this.opt.development_extensions.uppercase_subtitles||this.opt.development_extensions.implicit_short_title)&&(this.opt.development_extensions.main_title_from_short_title=!0),this.opt.development_extensions.csl_reverse_lookup_support&&(this.build.cslNodeId=0,this.setCslNodeIds=function(p,m){var d=this.cslXml.children(p);this.cslXml.setAttribute(p,"cslid",this.build.cslNodeId),this.opt.nodenames.push(m),this.build.cslNodeId+=1;for(var h=0,v=this.cslXml.numberofnodes(d);h<v;h+=1)m=this.cslXml.nodename(d[h]),m&&this.setCslNodeIds(d[h],m)},this.setCslNodeIds(this.cslXml.dataObj,"style")),this.cslXml.addMissingNameNodes(this.cslXml.dataObj),this.cslXml.addInstitutionNodes(this.cslXml.dataObj),this.cslXml.insertPublisherAndPlace(this.cslXml.dataObj),this.cslXml.flagDateMacros(this.cslXml.dataObj),r=this.cslXml.attributes(this.cslXml.dataObj),typeof r["@sort-separator"]>"u"&&this.cslXml.setAttribute(this.cslXml.dataObj,"sort-separator",", "),this.opt["initialize-with-hyphen"]=!0,this.setStyleAttributes(),this.opt.xclass=this.cslXml.getAttributeValue(this.cslXml.dataObj,"class"),this.opt.class=this.opt.xclass,this.opt.styleID=this.cslXml.getStyleId(this.cslXml.dataObj),this.opt.styleName=this.cslXml.getStyleId(this.cslXml.dataObj,!0),this.opt.version.slice(0,4)==="1.1m"&&(this.opt.development_extensions.consolidate_legal_items=!0,this.opt.development_extensions.consolidate_container_items=!0,this.opt.development_extensions.main_title_from_short_title=!0,this.opt.development_extensions.expect_and_symbol_form=!0,this.opt.development_extensions.require_explicit_legal_case_title_short=!0,this.opt.development_extensions.force_jurisdiction=!0,this.opt.development_extensions.force_title_abbrev_fallback=!0),i&&(i=i.replace("_","-"),i=u.normalizeLocaleStr(i)),this.opt["default-locale"][0]&&(this.opt["default-locale"][0]=this.opt["default-locale"][0].replace("_","-"),this.opt["default-locale"][0]=u.normalizeLocaleStr(this.opt["default-locale"][0])),i&&n&&(this.opt["default-locale"]=[i]),i&&!n&&this.opt["default-locale"][0]&&(i=this.opt["default-locale"][0]),this.opt["default-locale"].length===0&&(i||(i="en-US"),this.opt["default-locale"].push("en-US")),i||(i=this.opt["default-locale"][0]),a=u.localeResolve(i),this.opt.lang=a.best,this.opt["default-locale"][0]=a.best,this.locale={},this.opt["default-locale-sort"]||(this.opt["default-locale-sort"]=this.opt["default-locale"][0]),"dale|".localeCompare("daleb",this.opt["default-locale-sort"])>-1?this.opt.sort_sep="@":this.opt.sort_sep="|",this.localeConfigure(a);function c(m){var m=m.slice(),d=new RegExp("(?:(?:[?!:]*\\s+|-|^)(?:"+m.join("|")+")(?=[!?:]*\\s+|-|$))","g");return d}this.locale[this.opt.lang].opts["skip-words-regexp"]=c(this.locale[this.opt.lang].opts["skip-words"]),this.output.adjust=new u.Output.Queue.adjust(this.getOpt("punctuation-in-quote")),this.registry=new u.Registry(this),this.macros={},this.build.area="citation";var f=this.cslXml.getNodesByName(this.cslXml.dataObj,this.build.area);this.buildTokenLists(f,this[this.build.area].tokens),this.build.area="bibliography";var f=this.cslXml.getNodesByName(this.cslXml.dataObj,this.build.area);this.buildTokenLists(f,this[this.build.area].tokens),this.build.area="intext";var f=this.cslXml.getNodesByName(this.cslXml.dataObj,this.build.area);this.buildTokenLists(f,this[this.build.area].tokens),this.opt.parallel.enable&&(this.parallel=new u.Parallel(this)),this.juris={},this.configureTokenLists(),this.disambiguate=new u.Disambiguation(this),this.splice_delimiter=!1,this.fun.dateparser=u.DateParser,this.fun.flipflopper=new u.Util.FlipFlopper(this),this.setCloseQuotesArray(),this.fun.ordinalizer.init(this),this.fun.long_ordinalizer.init(this),this.fun.page_mangler=u.Util.PageRangeMangler.getFunction(this,"page"),this.fun.year_mangler=u.Util.PageRangeMangler.getFunction(this,"year"),this.setOutputFormat("html")};u.Engine.prototype.setCloseQuotesArray=function(){var e;e=[],e.push(this.getTerm("close-quote")),e.push(this.getTerm("close-inner-quote")),e.push('"'),e.push("'"),this.opt.close_quotes_array=e};u.makeBuilder=function(e,t){var i=[],n=[];function r(c){n.push(c),u.XmlToToken.call(c,e,u.START,t,i)}function a(){var c=n.pop();u.XmlToToken.call(c,e,u.END,t,i)}function o(c){u.XmlToToken.call(c,e,u.SINGLETON,t,i)}function l(c,f,p){c||(c=[]),typeof c.length>"u"&&(c=[c]);for(var m=0;m<c.length;m++){var d=c[m];e.cslXml.nodename(d)!==null&&(f&&e.cslXml.nodename(d)==="date"&&(u.Util.fixDateNode.call(e,f,m,d),d=e.cslXml.children(f)[m]),e.cslXml.numberofnodes(e.cslXml.children(d))?(r(d),l(e.cslXml.children(d),d),a()):o(d))}}return l};u.Engine.prototype.buildTokenLists=function(e,t){if(this.cslXml.getNodeValue(e)){var i=u.makeBuilder(this,t),n;typeof e.length>"u"?n=e:n=e[0],i(n)}};u.Engine.prototype.setStyleAttributes=function(){var i,e,t,i={};i.name=this.cslXml.nodename(this.cslXml.dataObj),e=this.cslXml.attributes(this.cslXml.dataObj);for(t in e)e.hasOwnProperty(t)&&u.Attributes[t].call(i,this,e[t])};u.Engine.prototype.getTerm=function(e,t,i,n,r,a){e&&e.match(/[A-Z]/)&&e===e.toUpperCase()&&(u.debug("Warning: term key is in uppercase form: "+e),e=e.toLowerCase());var o;a?o=this.opt["default-locale"][0]:o=this.opt.lang;var l=u.Engine.getField(u.LOOSE,this.locale[o].terms,e,t,i,n);return!l&&e==="range-delimiter"&&(l="–"),typeof l>"u"&&(r===u.STRICT?u.error('Error in getTerm: term "'+e+'" does not exist.'):r===u.TOLERANT&&(l="")),l&&(this.tmp.cite_renders_content=!0),l};u.Engine.prototype.getDate=function(e,t){var i;return t?i=this.opt["default-locale"]:i=this.opt.lang,this.locale[i].dates[e]?this.locale[i].dates[e]:!1};u.Engine.prototype.getOpt=function(e){return typeof this.locale[this.opt.lang].opts[e]<"u"?this.locale[this.opt.lang].opts[e]:!1};u.Engine.prototype.getVariable=function(e,t,i,n){return u.Engine.getField(u.LOOSE,e,t,i,n)};u.Engine.prototype.getDateNum=function(e,t){return typeof e>"u"?0:e[t]};u.Engine.getField=function(e,t,i,n,r,a){var o,l,c,f,p,m;if(o="",typeof t[i]>"u")if(e===u.STRICT)u.error('Error in getField: term "'+i+'" does not exist.');else return;for(a&&t[i][a]?m=t[i][a]:m=t[i],l=[],n==="symbol"?l=["symbol","short"]:n==="verb-short"?l=["verb-short","verb"]:n!=="long"&&(l=[n]),l=l.concat(["long"]),p=l.length,f=0;f<p;f+=1)if(c=l[f],typeof m=="string"||typeof m=="number")o=m;else if(typeof m[c]<"u"){typeof m[c]=="string"||typeof m[c]=="number"?o=m[c]:typeof r=="number"?o=m[c][r]:o=m[c][0];break}return o};u.Engine.prototype.configureTokenLists=function(){var e,t,i;for(i=u.AREAS.length,t=0;t<i;t+=1){e=u.AREAS[t];var n=this[e].tokens;this.configureTokenList(n)}return this.version=u.version,this.state};u.Engine.prototype.configureTokenList=function(e){var t,i,n,r,a,o,l,c;for(t=["year","month","day"],l=e.length-1,a=l;a>-1;a+=-1){if(i=e[a],i.name==="date"&&u.END===i.tokentype&&(n=[]),i.name==="date-part"&&i.strings.name)for(c=t.length,o=0;o<c;o+=1)r=t[o],r===i.strings.name&&n.push(i.strings.name);i.name==="date"&&u.START===i.tokentype&&(n.reverse(),i.dateparts=n),i.next=a+1,i.name&&u.Node[i.name].configure&&u.Node[i.name].configure.call(i,this,a)}};u.Engine.prototype.refetchItems=function(e){for(var t=[],i=0,n=e.length;i<n;i+=1)t.push(this.refetchItem(""+e[i]));return t};u.ITERATION=0;u.Engine.prototype.retrieveItem=function(e){var t,i,n;if(!this.tmp.loadedItemIDs[e])this.tmp.loadedItemIDs[e]=!0;else return this.registry.refhash[e];if(this.opt.development_extensions.normalize_lang_keys_to_lowercase&&typeof this.opt.development_extensions.normalize_lang_keys_to_lowercase=="boolean"){for(var n=0,r=this.opt["default-locale"].length;n<r;n+=1)this.opt["default-locale"][n]=this.opt["default-locale"][n].toLowerCase();for(var n=0,r=this.opt["locale-translit"].length;n<r;n+=1)this.opt["locale-translit"][n]=this.opt["locale-translit"][n].toLowerCase();for(var n=0,r=this.opt["locale-translat"].length;n<r;n+=1)this.opt["locale-translat"][n]=this.opt["locale-translat"][n].toLowerCase();this.opt.development_extensions.normalize_lang_keys_to_lowercase=100}if(u.ITERATION+=1,t=JSON.parse(JSON.stringify(this.sys.retrieveItem(""+e))),this.opt.development_extensions.normalize_lang_keys_to_lowercase){if(t.multi){if(t.multi._keys)for(var a in t.multi._keys)for(var o in t.multi._keys[a])o!==o.toLowerCase()&&(t.multi._keys[a][o.toLowerCase()]=t.multi._keys[a][o],delete t.multi._keys[a][o]);if(t.multi.main)for(var a in t.multi.main)t.multi.main[a]=t.multi.main[a].toLowerCase()}for(var n=0,r=u.NAME_VARIABLES.length;n>r;n+=1){var l=u.NAME_VARIABLES[n];if(t[l]&&t[l].multi)for(var c=0,f=t[l].length;c<f;c+=1){var p=t[l][c];if(p.multi){if(p.multi._key)for(var o in p.multi._key)o!==o.toLowerCase()&&(p.multi._key[o.toLowerCase()]=p.multi._key[o],delete p.multi._key[o]);p.multi.main&&(p.multi.main=p.multi.main.toLowerCase())}}}}if(t.language&&t.language.match(/[><]/)){var i=t.language.match(/(.*?)([<>])(.*)/);i[2]==="<"?(t["language-name"]=i[1],t["language-name-original"]=i[3]):(t["language-name"]=i[3],t["language-name-original"]=i[1]),this.opt.multi_layout?t["language-name-original"]&&(t.language=t["language-name-original"]):t["language-name"]&&(t.language=t["language-name"])}if(t.page){t["page-first"]=t.page;var m=""+t.page,i=m.split(/\s*(?:&|, |-|\u2013)\s*/);i[0].slice(-1)!=="\\"&&(t["page-first"]=i[0])}this.opt.development_extensions.field_hack&&t.note&&u.parseNoteFieldHacks(t,!1,this.opt.development_extensions.allow_field_hack_date_override);for(var o in t)if(u.DATE_VARIABLES.indexOf(o.replace(/^alt-/,""))>-1){var d=t[o];d&&(this.opt.development_extensions.raw_date_parsing&&d.raw&&(!d["date-parts"]||d["date-parts"].length===0)&&(d=this.fun.dateparser.parseDateToObject(d.raw)),t[o]=this.dateParseArray(d))}if(this.opt.development_extensions.consolidate_legal_items&&t.type&&["bill","gazette","legislation","regulation","treaty"].indexOf(t.type)>-1){for(var h,v=["type","title","jurisdiction","genre","volume","container-title"],b=[],n=0,r=v.length;n<r;n+=1)h=v[n],t[h]&&b.push(t[h]);v=["original-date","issued"];for(var n=0,r=v.length;n<r;n+=1)if(h=v[n],t[h]&&t[h].year){var y=t[h].year;b.push(y);break}t.legislation_id=b.join("::")}if(this.bibliography.opt.track_container_items&&this.bibliography.opt.track_container_items.indexOf(t.type)>-1){for(var h,v=["type","container-title","publisher","edition"],g=[],n=0,r=v.length;n<r;n+=1)h=v[n],t[h]&&g.push(t[h]);t.container_id=g.join("::")}if(this.opt.development_extensions.force_jurisdiction&&typeof t.authority=="string"&&(t.authority=[{literal:t.authority,multi:{_key:{}}}],t.multi&&t.multi._keys&&t.multi._keys.authority)){t.authority[0].multi._key={};for(var o in t.multi._keys.authority)t.authority[0].multi._key[o]={literal:t.multi._keys.authority[o]}}if(t["title-short"]||(t["title-short"]=t.shortTitle),this.opt.development_extensions.main_title_from_short_title){var x=this.opt["default-locale"][0].slice(0,2).toLowerCase()==="fr";u.extractTitleAndSubtitle.call(this,t,x)}var k=["bill","legal_case","legislation","gazette","regulation"].indexOf(t.type)>-1;this.opt.development_extensions.force_jurisdiction&&k&&(t.jurisdiction||(t.jurisdiction="us"));var w;if(!k&&t.title&&this.sys.getAbbreviation){t.jurisdiction,this.sys.normalizeAbbrevsKey?w=this.sys.normalizeAbbrevsKey("title",t.title):w=t.title;var C=this.transform.loadAbbreviation(t.jurisdiction,"title",w,t.language);this.transform.abbrevs[C].title&&this.transform.abbrevs[C].title[w]&&(t["title-short"]=this.transform.abbrevs[C].title[w])}if(t["container-title-short"]||(t["container-title-short"]=t.journalAbbreviation),t["container-title"]&&this.sys.getAbbreviation){this.sys.normalizeAbbrevsKey?w=this.sys.normalizeAbbrevsKey(t["container-title"]):w=t["container-title"];var C=this.transform.loadAbbreviation(t.jurisdiction,"container-title",w,t.language);this.transform.abbrevs[C]["container-title"]&&this.transform.abbrevs[C]["container-title"][w]&&(t["container-title-short"]=this.transform.abbrevs[C]["container-title"][w])}if(t.jurisdiction&&(t.country=t.jurisdiction.split(":")[0]),this.registry.refhash[e]){if(JSON.stringify(this.registry.refhash[e])!=JSON.stringify(t)){for(var o in this.registry.refhash[e])delete this.registry.refhash[e][o];this.tmp.taintedItemIDs[t.id]=!0,Object.assign(this.registry.refhash[e],t)}}else this.registry.refhash[e]=t;return this.registry.refhash[e]};u.Engine.prototype.refetchItem=function(e){return this.registry.refhash[e]};u.Engine.prototype.setOpt=function(e,t,i){e.name==="style"||e.name==="cslstyle"?(this.opt.inheritedAttributes[t]=i,this.citation.opt.inheritedAttributes[t]=i,this.bibliography.opt.inheritedAttributes[t]=i):["citation","bibliography"].indexOf(e.name)>-1?this[e.name].opt.inheritedAttributes[t]=i:e.strings[t]=i};u.Engine.prototype.inheritOpt=function(e,t,i,n){if(typeof e.strings[t]<"u")return e.strings[t];var r=this[this.tmp.root].opt.inheritedAttributes[i||t];return typeof r<"u"?r:n};u.Engine.prototype.remapSectionVariable=function(e){for(var t=0,i=e.length;t<i;t+=1){var n=e[t][0],r=e[t][1];if(["bill","gazette","legislation","regulation","treaty"].indexOf(n.type)>-1){if(r.locator){r.locator=r.locator.trim();var a=r.locator.match(u.STATUTE_SUBDIV_PLAIN_REGEX_FRONT);a||(r.label?r.locator=u.STATUTE_SUBDIV_STRINGS_REVERSE[r.label]+" "+r.locator:r.locator="p. "+r.locator)}var o=null;if(n.section){n.section=n.section.trim();var a=n.section.match(u.STATUTE_SUBDIV_PLAIN_REGEX_FRONT);a?o=a[0].trim():(n.section="sec. "+n.section,o="sec.")}if(n.section)if(!r.locator)r.locator=n.section;else{var a=r.locator.match(/^([^ ]*)\s*(.*)/),l=" ";a?(a[1]==="p."&&o!=="p."&&(r.locator=a[2]),["[","(",".",",",";",":","?"].indexOf(r.locator.slice(0,1))>-1&&(l="")):l="",r.locator=n.section+l+r.locator}r.label=""}}};u.Engine.prototype.setNumberLabels=function(e){if(e.number&&["bill","gazette","legislation","regulation","treaty"].indexOf(e.type)>-1&&this.opt.development_extensions.consolidate_legal_items&&!this.tmp.shadow_numbers.number){this.tmp.shadow_numbers.number={},this.tmp.shadow_numbers.number.values=[],this.tmp.shadow_numbers.number.plural=0,this.tmp.shadow_numbers.number.numeric=!1,this.tmp.shadow_numbers.number.label=!1;var t=""+e.number;t=t.split("\\").join("");var i=t.split(/\s+/)[0],n=u.STATUTE_SUBDIV_STRINGS[i];if(n){var r=t.split(u.STATUTE_SUBDIV_PLAIN_REGEX);if(r.length>1){for(var a=[],o=1,l=r.length;o<l;o+=1)a.push(r[o].replace(/\s*$/,"").replace(/^\s*/,""));t=a.join(" ")}else t=r[0];this.tmp.shadow_numbers.number.label=n,this.tmp.shadow_numbers.number.values.push(["Blob",t,!1]),this.tmp.shadow_numbers.number.numeric=!1}else this.tmp.shadow_numbers.number.values.push(["Blob",t,!1]),this.tmp.shadow_numbers.number.numeric=!0}};u.substituteOne=function(e){return function(t,i){return i?e.replace("%%STRING%%",i):""}};u.substituteTwo=function(e){return function(t){var i=e.replace("%%PARAM%%",t);return function(n,r){return r?i.replace("%%STRING%%",r):""}}};u.Mode=function(e){var t,i,n,r,a,o;t={},i=u.Output.Formats[e];for(n in i){if(n.slice(0,1)!=="@"){t[n]=i[n];continue}r=!1,a=i[n],o=n.split("/"),typeof a=="string"&&a.indexOf("%%STRING%%")>-1?a.indexOf("%%PARAM%%")>-1?r=u.substituteTwo(a):r=u.substituteOne(a):typeof a=="boolean"&&!a?r=u.Output.Formatters.passthrough:typeof a=="function"?r=a:u.error("Bad "+e+" config entry for "+n+": "+a),o.length===1?t[o[0]]=r:o.length===2&&(t[o[0]]||(t[o[0]]={}),t[o[0]][o[1]]=r)}return t};u.setDecorations=function(e,t){var i,n,r;i=[];for(r in u.FORMAT_KEY_SEQUENCE){var n=u.FORMAT_KEY_SEQUENCE[r];t[n]&&(i.push([n,t[n]]),delete t[n])}return i};u.Doppeler=function(e,t){var i=new RegExp("("+e+")","g"),n=new RegExp(e,"g");this.split=function(r){t&&(r=t(r));var a=r.match(i);if(!a)return{tags:[],strings:[r]};for(var o=r.split(n),l=a.length-1;l>-1;l--){typeof a[l]=="number"&&(a[l]="");var c=a[l];c==="'"&&o[l+1].length>0&&(o[l+1]=a[l]+o[l+1],a[l]="")}return{tags:a,strings:o,origStrings:o.slice()}},this.join=function(r){for(var a=r.strings.slice(-1),o=r.tags.length-1;o>-1;o--)a.push(r.tags[o]),a.push(r.strings[o]);return a.reverse(),a.join("")}};u.Engine.prototype.normalDecorIsOrphan=function(e,t){if(t[1]==="normal"){var i=!1,n;this.tmp.area==="citation"?n=[this.citation.opt.layout_decorations].concat(e.alldecor):n=e.alldecor;for(var r=n.length-1;r>-1;r+=-1)for(var a=n[r].length-1;a>-1;a+=-1)n[r][a][0]===t[0]&&n[r][a][1]!=="normal"&&(i=!0);if(!i)return!0}return!1};u.Engine.prototype.getCitationLabel=function(e){var t="",i=this.getTrigraphParams(),n=i[0],r=this.getTerm("reference","short",0);typeof r>"u"&&(r="reference"),r=r.replace(".",""),r=r.slice(0,1).toUpperCase()+r.slice(1);for(var a=0,o=u.NAME_VARIABLES.length;a<o;a+=1){var l=u.NAME_VARIABLES[a];if(e[l]){var c=e[l];c.length>i.length?n=i[i.length-1]:n=i[c.length-1];for(var f=0,p=c.length;f<p&&f!==n.authors.length;f+=1){var m=this.nameOutput.getName(c[f],"locale-translit",!0),d=m.name;d&&d.family?(r=d.family,r=r.replace(/^([ \'\u2019a-z]+\s+)/,"")):d&&d.literal&&(r=d.literal);var h=r.toLowerCase().match(/^(a\s+|the\s+|an\s+)/);if(h&&(r=r.slice(h[1].length)),r=r.replace(u.ROMANESQUE_NOT_REGEXP,""),!r)break;r=r.slice(0,n.authors[f]),r.length>1?r=r.slice(0,1).toUpperCase()+r.slice(1).toLowerCase():r.length===1&&(r=r.toUpperCase()),t+=r}break}}if(!t&&e.title){for(var v=this.locale[this.opt.lang].opts["skip-words"],b=e.title.split(/\s+/),a=b.length-1;a>-1;a--)v.indexOf(b[a])>-1&&(b=b.slice(0,a).concat(b.slice(a+1)));var y=b.join("");y=y.slice(0,i[0].authors[0]),y.length>1?y=y.slice(0,1).toUpperCase()+y.slice(1).toLowerCase():y.length===1&&(y=y.toUpperCase()),t=y}var g="0000";return e.issued&&e.issued.year&&(g=""+e.issued.year),g=g.slice(n.year*-1),t=t+g,t};u.Engine.prototype.getTrigraphParams=function(){var e=[],t=this.opt.trigraph.split(":");(!this.opt.trigraph||this.opt.trigraph.slice(0,1)!=="A")&&u.error("Bad trigraph definition: "+this.opt.trigraph);for(var i=0,n=t.length;i<n;i+=1){for(var r=t[i],a={authors:[],year:0},o=0,l=r.length;o<l;o+=1)switch(r.slice(o,o+1)){case"A":a.authors.push(1);break;case"a":a.authors[a.authors.length-1]+=1;break;case"0":a.year+=1;break;default:u.error("Invalid character in trigraph definition: "+this.opt.trigraph)}e.push(a)}return e};u.Engine.prototype.setOutputFormat=function(e){this.opt.mode=e,this.fun.decorate=u.Mode(e),this.output[e]||(this.output[e]={},this.output[e].tmp={})};u.Engine.prototype.getSortFunc=function(){return function(e,t){return e=e.split("-"),t=t.split("-"),e.length<t.length?1:e.length>t.length?-1:(e=e.slice(-1)[0],t=t.slice(-1)[0],e.length<t.length?1:e.length>t.length?-1:0)}};u.Engine.prototype.setLangTagsForCslSort=function(e){var t,i;if(e)for(this.opt["locale-sort"]=[],t=0,i=e.length;t<i;t+=1)this.opt["locale-sort"].push(e[t]);this.opt["locale-sort"].sort(this.getSortFunc())};u.Engine.prototype.setLangTagsForCslTransliteration=function(e){var t,i;if(this.opt["locale-translit"]=[],e)for(t=0,i=e.length;t<i;t+=1)this.opt["locale-translit"].push(e[t]);this.opt["locale-translit"].sort(this.getSortFunc())};u.Engine.prototype.setLangTagsForCslTranslation=function(e){var t,i;if(this.opt["locale-translat"]=[],e)for(t=0,i=e.length;t<i;t+=1)this.opt["locale-translat"].push(e[t]);this.opt["locale-translat"].sort(this.getSortFunc())};u.Engine.prototype.setLangPrefsForCites=function(e,t){var i=this.opt["cite-lang-prefs"];t||(t=function(h){return h.toLowerCase()});for(var n=["Persons","Institutions","Titles","Journals","Publishers","Places"],r=0,a=n.length;r<a;r+=1){var o=t(n[r]),l=n[r].toLowerCase();if(e[o]){for(var c=[];e[o].length>1;)c.push(e[o].pop());var f={orig:1,translit:2,translat:3};for(c.length===2&&f[c[0]]<f[c[1]]&&c.reverse();c.length;)e[o].push(c.pop());for(var p=i[l];p.length;)p.pop();for(var m=0,d=e[o].length;m<d;m+=1)p.push(e[o][m])}}};u.Engine.prototype.setLangPrefsForCiteAffixes=function(e){if(e&&e.length===48){for(var t=this.opt.citeAffixes,i=0,n=["persons","institutions","titles","journals","publishers","places"],r=["translit","orig","translit","translat"],a,o=0,l=n.length;o<l;o+=1)for(var c=0,f=r.length;c<f;c+=1)a="",i%8===4?!t[n[o]]["locale-"+r[c]].prefix&&!t[n[o]]["locale-"+r[c]].suffix&&(a=e[i]?e[i]:"",t[n[o]]["locale-"+r[c]].prefix=a,a=e[i]?e[i+1]:"",t[n[o]]["locale-"+r[c]].suffix=a):(a=e[i]?e[i]:"",t[n[o]]["locale-"+r[c]].prefix=a,a=e[i]?e[i+1]:"",t[n[o]]["locale-"+r[c]].suffix=a),i+=2;this.opt.citeAffixes=t}};u.Engine.prototype.setAutoVietnameseNamesOption=function(e){e?this.opt["auto-vietnamese-names"]=!0:this.opt["auto-vietnamese-names"]=!1};u.Engine.prototype.setAbbreviations=function(e){this.sys.setAbbreviations&&this.sys.setAbbreviations(e)};u.Engine.prototype.setSuppressTrailingPunctuation=function(e){this.citation.opt.suppressTrailingPunctuation=!!e};u.Output={};u.Output.Queue=function(e){this.levelname=["top"],this.state=e,this.queue=[],this.empty=new u.Token("empty");var t={};t.empty=this.empty,this.formats=new u.Stack(t),this.current=new u.Stack(this.queue)};u.Output.Queue.prototype.pop=function(){var e=this.current.value();return e.length?e.pop():e.blobs.pop()};u.Output.Queue.prototype.getToken=function(e){var t=this.formats.value()[e];return t};u.Output.Queue.prototype.mergeTokenStrings=function(e,t){var i,n,r,a;if(i=this.formats.value()[e],n=this.formats.value()[t],r=i,n){i||(i=new u.Token(e,u.SINGLETON),i.decorations=[]),r=new u.Token(e,u.SINGLETON);var a="";for(var a in i.strings)i.strings.hasOwnProperty(a)&&(r.strings[a]=i.strings[a]);for(var a in n.strings)n.strings.hasOwnProperty(a)&&(r.strings[a]=n.strings[a]);r.decorations=i.decorations.concat(n.decorations)}return r};u.Output.Queue.prototype.addToken=function(e,t,i){var n,r;if(n=new u.Token("output"),typeof i=="string"&&(i=this.formats.value()[i]),i&&i.strings){for(r in i.strings)i.strings.hasOwnProperty(r)&&(n.strings[r]=i.strings[r]);n.decorations=i.decorations}typeof t=="string"&&(n.strings.delimiter=t),this.formats.value()[e]=n};u.Output.Queue.prototype.pushFormats=function(e){e||(e={}),e.empty=this.empty,this.formats.push(e)};u.Output.Queue.prototype.popFormats=function(){this.formats.pop()};u.Output.Queue.prototype.startTag=function(e,t){var i={};this.state.tmp["doing-macro-with-date"]&&this.state.tmp.extension&&(t=this.empty,e="empty"),i[e]=t,this.pushFormats(i),this.openLevel(e)};u.Output.Queue.prototype.endTag=function(e){this.closeLevel(e),this.popFormats()};u.Output.Queue.prototype.openLevel=function(e){var t,i;typeof e=="object"?t=new u.Blob(void 0,e):typeof e>"u"?t=new u.Blob(void 0,this.formats.value().empty,"empty"):((!this.formats.value()||!this.formats.value()[e])&&u.error('CSL processor error: call to nonexistent format token "'+e+'"'),t=new u.Blob(void 0,this.formats.value()[e],e)),i=this.current.value(),!this.state.tmp.just_looking&&this.checkNestedBrace&&(t.strings.prefix=this.checkNestedBrace.update(t.strings.prefix)),i.push(t),this.current.push(t)};u.Output.Queue.prototype.closeLevel=function(e){e&&e!==this.current.value().levelname&&u.error("Level mismatch error: wanted "+e+" but found "+this.current.value().levelname);var t=this.current.pop();!this.state.tmp.just_looking&&this.checkNestedBrace&&(t.strings.suffix=this.checkNestedBrace.update(t.strings.suffix))};u.Output.Queue.prototype.append=function(e,t,i,n,r){var a,o,l,c=!0;if(i&&(n=!0),this.state.tmp["doing-macro-with-date"]&&!i){if(t!=="macro-with-date")return!1;t==="macro-with-date"&&(t="empty")}if(typeof e>"u"||(typeof e=="number"&&(e=""+e),!i&&this.state.tmp.element_trace&&this.state.tmp.element_trace.value()==="suppress-me"))return!1;if(o=!1,t?t==="literal"?(a=!0,c=!1):typeof t=="string"?a=this.formats.value()[t]:a=t:a=this.formats.value().empty,a||u.error("CSL processor error: unknown format token name: "+t),a.strings&&typeof a.strings.delimiter>"u"&&(a.strings.delimiter=""),typeof e=="string"&&e.length&&(e=e.replace(/ ([:;?!\u00bb])/g," $1").replace(/\u00ab /g,"« "),this.last_char_rendered=e.slice(-1),e=e.replace(/\s+'/g," '"),i||(e=e.replace(/^'/g," '")),n?i&&(this.state.tmp.term_predecessor_name=!0):(this.state.tmp.term_predecessor=!0,this.state.tmp.in_cite_predecessor=!0)),o=new u.Blob(e,a),l=this.current.value(),typeof l>"u"&&this.current.mystack.length===0&&(this.current.mystack.push([]),l=this.current.value()),typeof o.blobs=="string"&&(n?i&&(this.state.tmp.term_predecessor_name=!0):(this.state.tmp.term_predecessor=!0,this.state.tmp.in_cite_predecessor=!0)),typeof e=="string"){if(typeof o.blobs=="string"&&o.blobs.slice(0,1)!==" "){for(var f="",p=o.blobs;u.TERMINAL_PUNCTUATION.indexOf(p.slice(0,1))>-1;)f=f+p.slice(0,1),p=p.slice(1);p&&f&&(o.strings.prefix=o.strings.prefix+f,o.blobs=p)}o.strings["text-case"]&&(o.blobs=u.Output.Formatters[o.strings["text-case"]](this.state,e)),this.state.tmp.strip_periods&&!r&&(o.blobs=o.blobs.replace(/\.([^a-z]|$)/g,"$1"));for(var m=o.decorations.length-1;m>-1;m+=-1)o.decorations[m][0]==="@quotes"&&o.decorations[m][1]!=="false"&&(o.punctuation_in_quote=this.state.getOpt("punctuation-in-quote")),o.blobs.match(u.ROMANESQUE_REGEXP)||o.decorations[m][0]==="@font-style"&&(o.decorations=o.decorations.slice(0,m).concat(o.decorations.slice(m+1)));l.push(o),this.state.fun.flipflopper.processTags(o)}else c?l.push(o):l.push(e);return!0};u.Output.Queue.prototype.string=function(e,t,i){var n,r,a,o,l,c=u.getSafeEscape(this.state),f=t.slice(),p=[];if(f.length===0)return p;var m="";i?m=i.strings.delimiter:(e.tmp.count_offset_characters=!1,e.tmp.offset_characters=0),i&&i.new_locale&&(i.old_locale=e.opt.lang,e.opt.lang=i.new_locale);for(var d,h,v,b,n=0,r=f.length;n<r;n+=1){if(d=f[n],d.strings.first_blob&&(e.tmp.count_offset_characters=d.strings.first_blob),typeof d.blobs=="string"){if(typeof d.num=="number")p.push(d);else if(d.blobs){d.particle&&(d.blobs=d.particle+d.blobs,d.particle=""),l=c(d.blobs);var y=l.length;if(!e.tmp.suppress_decorations)for(a=0,o=d.decorations.length;a<o;a+=1)b=d.decorations[a],b[0]!=="@showid"&&(e.normalDecorIsOrphan(d,b)||(l=e.fun.decorate[b[0]][b[1]].call(d,e,l,b[2])));if(l&&l.length){if(l=c(d.strings.prefix)+l+c(d.strings.suffix),e.opt.development_extensions.csl_reverse_lookup_support&&!e.tmp.suppress_decorations)for(a=0,o=d.decorations.length;a<o;a+=1)b=d.decorations[a],b[0]==="@showid"&&(l=e.fun.decorate[b[0]][b[1]].call(d,e,l,b[2]));p.push(l),e.tmp.count_offset_characters&&(e.tmp.offset_characters+=y+d.strings.suffix.length+d.strings.prefix.length)}}}else if(d.blobs.length){var g=e.output.string(e,d.blobs,d);if(i&&g!=="string"&&g.length>1&&d.strings.delimiter)for(var x=!1,a=0,o=g.length;a<o;a++)typeof g[a]!="string"?x=!0:x&&(g[a]=d.strings.delimiter+g[a]);p=p.concat(g)}d.strings.first_blob&&e.registry.registry[d.strings.first_blob]&&(e.registry.registry[d.strings.first_blob].offset=e.tmp.offset_characters,e.tmp.count_offset_characters=!1)}for(n=0,r=p.length-1;n<r;n+=1)typeof p[n].num=="number"&&typeof p[n+1].num=="number"&&!p[n+1].UGLY_DELIMITER_SUPPRESS_HACK&&(p[n].strings.suffix=p[n].strings.suffix+(m||""),p[n+1].successor_prefix="",p[n+1].UGLY_DELIMITER_SUPPRESS_HACK=!0);for(var k=0,n=0,r=p.length;n<r;n+=1)typeof p[n]=="string"&&(k=parseInt(n,10)+1,n<p.length-1&&typeof p[n+1]=="object"&&(m&&!p[n+1].UGLY_DELIMITER_SUPPRESS_HACK&&(p[n]+=c(m)),p[n+1].UGLY_DELIMITER_SUPPRESS_HACK=!0));if(i&&(i.decorations.length||i.strings.suffix))k=p.length;else if(i&&i.strings.prefix){for(var n=0,r=p.length;n<r;n++)if(typeof p[n].num<"u"){k=n,n===0&&(p[n].strings.prefix=i.strings.prefix+p[n].strings.prefix);break}}var w=e.output.renderBlobs(p.slice(0,k),m,!1,i);if(w&&i&&(i.decorations.length||i.strings.suffix||i.strings.prefix)){if(!e.tmp.suppress_decorations)for(var n=0,r=i.decorations.length;n<r;n+=1)b=i.decorations[n],!(["@cite","@bibliography","@display","@showid"].indexOf(b[0])>-1)&&(e.normalDecorIsOrphan(d,b)||b[0]&&typeof w=="string"&&(w=e.fun.decorate[b[0]][b[1]].call(i,e,w,b[2])));if(l=w,h=i.strings.suffix,l&&l.length&&(v=i.strings.prefix,l=c(v)+l+c(h),e.tmp.count_offset_characters&&(e.tmp.offset_characters+=v.length+h.length)),w=l,!e.tmp.suppress_decorations)for(var n=0,r=i.decorations.length;n<r;n+=1)b=i.decorations[n],["@cite","@bibliography","@display","@showid"].indexOf(b[0])!==-1&&typeof w=="string"&&(w=e.fun.decorate[b[0]][b[1]].call(i,e,w,b[2]))}var C=p.slice(k,p.length);return!C.length&&w?p=[w]:C.length&&!w?p=C:w&&C.length&&(p=[w].concat(C)),typeof i>"u"?(this.queue=[],this.current.mystack=[],this.current.mystack.push(this.queue),e.tmp.suppress_decorations&&(p=e.output.renderBlobs(p,void 0,!1))):typeof i=="boolean"&&(p=e.output.renderBlobs(p,void 0,!0)),i&&i.new_locale&&(e.opt.lang=i.old_locale),p};u.Output.Queue.prototype.clearlevel=function(){var e,t,i;for(e=this.current.value(),i=e.blobs.length,t=0;t<i;t+=1)e.blobs.pop()};u.Output.Queue.prototype.renderBlobs=function(e,t,i,n){var r,a,o,l,c,f,p,m,d,h,v;if(v=u.getSafeEscape(this.state),t||(t=""),r=this.state,a="",o="",f=e.length,this.state.tmp.area==="citation"&&!this.state.tmp.just_looking&&f===1&&typeof e[0]=="object"&&n)return e[0].strings.prefix=n.strings.prefix+e[0].strings.prefix,e[0].strings.suffix=e[0].strings.suffix+n.strings.suffix,e[0].decorations=e[0].decorations.concat(n.decorations),e[0].params=n.params,e[0];var b=!0;for(c=0;c<f;c+=1)e[c].checkNext?(e[c].checkNext(e[c+1],b),b=!1):e[c+1]&&e[c+1].splice_prefix?b=!1:b=!0;var y=!0;for(c=e.length-1;c>0;c+=-1)e[c].checkLast?y&&e[c].checkLast(e[c-1])&&(y=!1):y=!0;for(f=e.length,c=0;c<f;c+=1)if(l=e[c],a&&(o=t),typeof l=="string")a+=v(o),a+=l,r.tmp.count_offset_characters&&(r.tmp.offset_characters+=o.length);else if(i)a?a=[a,l]:a=[l];else if(l.status!==u.SUPPRESS){l.particle?d=l.particle+l.num:d=l.formatter.format(l.num,l.gender);var g=d.replace(/<[^>]*>/g,"").length;this.append(d,"empty",!0);var x=this.pop(),k=r.tmp.count_offset_characters;if(d=this.string(r,[x],!1),r.tmp.count_offset_characters=k,l.strings["text-case"]&&(d=u.Output.Formatters[l.strings["text-case"]](this.state,d)),d&&this.state.tmp.strip_periods&&(d=d.replace(/\.([^a-z]|$)/g,"$1")),!r.tmp.suppress_decorations)for(m=l.decorations.length,p=0;p<m;p+=1)h=l.decorations[p],!r.normalDecorIsOrphan(l,h)&&(d=r.fun.decorate[h[0]][h[1]].call(l,r,d,h[2]));d=v(l.strings.prefix)+d+v(l.strings.suffix);var w="";l.status===u.END?w=v(l.range_prefix):l.status===u.SUCCESSOR?w=v(l.successor_prefix):l.status===u.START?c>0&&!l.suppress_splice_prefix?w=v(l.splice_prefix):w="":l.status===u.SEEN&&(w=v(l.splice_prefix)),a+=w,a+=d,r.tmp.count_offset_characters&&(r.tmp.offset_characters+=w.length+l.strings.prefix.length+g+l.strings.suffix.length)}return a};u.Output.Queue.purgeEmptyBlobs=function(e){if(!(typeof e!="object"||typeof e.blobs!="object"||!e.blobs.length))for(var t=e.blobs.length-1;t>-1;t--){u.Output.Queue.purgeEmptyBlobs(e.blobs[t]);var i=e.blobs[t];if(!i||!i.blobs||!i.blobs.length){for(var n=[];e.blobs.length-1>t;)n.push(e.blobs.pop());for(e.blobs.pop();n.length;)e.blobs.push(n.pop())}}};u.Output.Queue.adjust=function(e){var t={";":!0,":":!0},i={".":!0,"!":!0,"?":!0},n={"!":{".":"!","?":"!?",":":"!",",":"!,",";":"!;"},"?":{"!":"?!",".":"?",":":"?",",":"?,",";":"?;"},".":{"!":".!","?":".?",":":".:",",":".,",";":".;"},":":{"!":"!","?":"?",".":":",",":":,",";":":;"},",":{"!":",!","?":",?",":":",:",".":",.",";":",;"},";":{"!":"!","?":"?",":":";",",":";,",".":";"}},r={},a={},o={},l={};for(var c in n)o[c]=!0,l[c]=!0,t[c]||(r[c]=!0),i[c]||(a[c]=!0);l[" "]=!0,l[" "]=!0;var f={};for(var c in n)for(var p in n[c])f[p]||(f[p]={}),f[p][c]=n[c][p];function m(_){return typeof _.num=="number"||_.blobs&&_.blobs.length===1&&typeof _.blobs[0].num=="number"}function d(_){if(typeof _.num=="number")return!0;if(!_.blobs||typeof _.blobs!="object")return!1;if(d(_.blobs[_.blobs.length-1]))return!0}function h(_,S){var T=!1,D=["@font-style","@font-variant","@font-weight","@text-decoration","@vertical-align"];if(S&&D.push("@quotes"),_.decorations){for(var H=0,V=_.decorations.length;H<V;H++)if(D.indexOf(_.decorations[H][0])>-1){T=!0;break}}return T}function v(_){if(_.decorations){for(var S=0,T=_.decorations.length;S<T;S++)if(_.decorations[S][0]==="@quotes"&&_.decorations[S][1]!=="false")return!0}return typeof _.blobs!="object"?!1:v(_.blobs[_.blobs.length-1])}function b(_,S){var T=S.strings.suffix.slice(-1);!T&&typeof S.blobs=="string"&&(T=S.blobs.slice(-1));var D=f[_][T];return D&&D.length===1?!0:typeof S.blobs!="object"?!1:!!b(_,S.blobs[S.blobs.length-1])}function y(_,S){if(!o[S])return!1;if(typeof _.blobs=="string")return _.blobs.slice(-1)===S;var T=_.blobs[_.blobs.length-1];if(T){var D=T.strings.suffix.slice(-1);return D?T.strings.suffix.slice(-1)==S:y(T,S)}else return!1}function g(_,S,T,D,H){var V=S==="blobs"?_:_.strings,M=D==="blobs"?T:T.strings,$=V[S].slice(-1),P=M[D].slice(0,1);function W(){M[D]=M[D].slice(1)}function L(){V[S]=V[S].slice(0,-1)}function Q(F){M[D]=F+M[D]}function j(F){V[S]+=F}var O=H?L:W;function R(){return f[P]}function U(){return n[$]}var oe=H?U:R;function ie(){var F=n[$][P];typeof F=="string"?(L(),W(),Q(F)):(Q($),L())}function ee(){var F=f[P][$];typeof F=="string"?(L(),W(),j(F)):(j(P),W())}var te=H?ie:ee,X=$===P;X?O():oe()&&te()}function x(_){if(_.blobs&&typeof _.blobs=="string"){o[_.strings.suffix.slice(0,1)]&&_.strings.suffix.slice(0,1)===_.blobs.slice(-1)&&(_.strings.suffix=_.strings.suffix.slice(1));return}else if(typeof _!="object"||typeof _.blobs!="object"||!_.blobs.length)return;for(var S=h(_,!0),T=_.blobs.length-1;T>-1;T--){this.upward(_.blobs[T]);var D=_.strings,H=_.blobs[T].strings;if(T===0){D.prefix.slice(-1)===" "&&H.prefix.slice(0,1)===" "&&(H.prefix=H.prefix.slice(1));var V=H.prefix.slice(0,1);!S&&l[V]&&!D.prefix&&(D.prefix+=V,H.prefix=H.prefix.slice(1))}if(T===_.blobs.length-1){var V=H.suffix.slice(-1);!S&&[" "].indexOf(V)>-1&&(D.suffix.slice(0,1)!==V&&(D.suffix=V+D.suffix),H.suffix=H.suffix.slice(0,-1))}D.delimiter&&T>0&&l[D.delimiter.slice(-1)]&&D.delimiter.slice(-1)===H.prefix.slice(0,1)&&(H.prefix=H.prefix.slice(1))}}function k(_){if(!(typeof _!="object"||typeof _.blobs!="object"||!_.blobs.length)){for(var S=_.blobs.length-1;S>-1;S--)if(this.leftward(_.blobs[S]),S<_.blobs.length-1&&!_.strings.delimiter){var T=_.blobs[S],D=T.strings.suffix.slice(-1),H=_.blobs[S+1],V=H.strings.prefix.slice(0,1),M=h(T)||h(H),$=typeof D=="number"||typeof V=="number";if(!M&&!$&&o[V]&&!$){var P=V===T.strings.suffix.slice(-1),W=!T.strings.suffix&&typeof T.blobs=="string"&&T.blobs.slice(-1)===V;!P&&!W?g(T,"suffix",H,"prefix"):H.strings.prefix=H.strings.prefix.slice(1)}}}}function w(_){if(_.blobs&&typeof _.blobs=="string"){o[_.strings.suffix.slice(0,1)]&&_.strings.suffix.slice(0,1)===_.blobs.slice(-1)&&(_.strings.suffix=_.strings.suffix.slice(1));return}else if(typeof _!="object"||typeof _.blobs!="object"||!_.blobs.length)return;for(var S=_.strings,T=0,D=_.blobs.length;T<D&&!m(_.blobs[T]);T++);if(S.delimiter&&o[S.delimiter.slice(0,1)]){for(var H=S.delimiter.slice(0,1),T=_.blobs.length-2;T>-1;T--){var V=_.blobs[T].strings;V.suffix.slice(-1)!==H&&(V.suffix+=H)}S.delimiter=S.delimiter.slice(1)}for(var T=_.blobs.length-1;T>-1;T--){var M=_.blobs[T],V=_.blobs[T].strings,$=h(M,!0),P=m(M);if(T===_.blobs.length-1){{var W=S.suffix.slice(0,1),L=!1;o[W]&&(L=b(W,M),!L&&e&&(L=v(M))),L&&o[W]&&(d(M)||(typeof M.blobs=="string"?g(M,"blobs",_,"suffix"):g(M,"suffix",_,"suffix"),S.suffix.slice(0,1)==="."&&(V.suffix+=S.suffix.slice(0,1),S.suffix=S.suffix.slice(1)))),V.suffix.slice(-1)===" "&&S.suffix.slice(0,1)===" "&&(S.suffix=S.suffix.slice(1)),l[V.suffix.slice(0,1)]&&(typeof M.blobs=="string"&&M.blobs.slice(-1)===V.suffix.slice(0,1)&&(V.suffix=V.suffix.slice(1)),V.suffix.slice(-1)===S.suffix.slice(0,1)&&(S.suffix=S.suffix.slice(0,-1)))}y(_,_.strings.suffix.slice(0,1))&&(_.strings.suffix=_.strings.suffix.slice(1))}else if(S.delimiter)l[S.delimiter.slice(0,1)]&&S.delimiter.slice(0,1)===V.suffix.slice(-1)&&(_.blobs[T].strings.suffix=_.blobs[T].strings.suffix.slice(0,-1));else{var Q=_.blobs[T+1].strings;!m(M)&&!$&&l[V.suffix.slice(-1)]&&V.suffix.slice(-1)===Q.prefix.slice(0,1)&&(Q.prefix=Q.prefix.slice(1))}!P&&!$&&o[V.suffix.slice(0,1)]&&typeof M.blobs=="string"&&g(M,"blobs",M,"suffix"),this.downward(_.blobs[T])}}function C(_){var S=_.strings.suffix.slice(0,1);if(typeof _.blobs=="string")for(;r[S];)g(_,"blobs",_,"suffix"),S=_.strings.suffix.slice(0,1);else for(;r[S];)g(_.blobs[_.blobs.length-1],"suffix",_,"suffix"),S=_.strings.suffix.slice(0,1)}function E(_){if(typeof _.blobs=="string")for(var S=_.blobs.slice(-1);a[S];)g(_,"blobs",_,"suffix",!0),S=_.blobs.slice(-1);else for(var S=_.blobs[_.blobs.length-1].strings.suffix.slice(-1);a[S];)g(_.blobs[_.blobs.length-1],"suffix",_,"suffix",!0),S=_.blobs[_.blobs.length-1].strings.suffix.slice(-1)}function B(_){if(!(typeof _!="object"||typeof _.blobs!="object"||!_.blobs.length)){for(var S,T=0,D=_.blobs.length;T<D;T++){for(var H=_.blobs[T],V=!1,M=0,$=H.decorations.length;M<$;M++){var P=H.decorations[M];P[0]==="@quotes"&&P[1]!=="false"&&(V=!0)}V&&(e?C(H):E(H)),S=this.fix(_.blobs[T]),H.blobs&&typeof H.blobs=="string"&&(S=H.blobs.slice(-1))}return S}}this.upward=x,this.leftward=k,this.downward=w,this.fix=B};u.Engine.Opt=function(){this.parallel={enable:!1},this.has_disambiguate=!1,this.mode="html",this.dates={},this.jurisdictions_seen={},this.suppressedJurisdictions={},this.inheritedAttributes={},this["locale-sort"]=[],this["locale-translit"]=[],this["locale-translat"]=[],this.citeAffixes={persons:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}},institutions:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}},titles:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}},journals:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}},publishers:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}},places:{"locale-orig":{prefix:"",suffix:""},"locale-translit":{prefix:"",suffix:""},"locale-translat":{prefix:"",suffix:""}}},this["default-locale"]=[],this.update_mode=u.NONE,this.bib_mode=u.NONE,this.sort_citations=!1,this["et-al-min"]=0,this["et-al-use-first"]=1,this["et-al-use-last"]=!1,this["et-al-subsequent-min"]=!1,this["et-al-subsequent-use-first"]=!1,this["demote-non-dropping-particle"]="display-and-sort",this["parse-names"]=!0,this.citation_number_slug=!1,this.trigraph="Aaaa00:AaAa00:AaAA00:AAAA00",this.nodenames=[],this.gender={},this["cite-lang-prefs"]={persons:["orig"],institutions:["orig"],titles:["orig"],journals:["orig"],publishers:["orig"],places:["orig"],number:["orig"]},this.has_layout_locale=!1,this.disable_duplicate_year_suppression=[],this.use_context_condition=!1,this.jurisdiction_fallbacks={},this.development_extensions={},this.development_extensions.field_hack=!0,this.development_extensions.allow_field_hack_date_override=!0,this.development_extensions.locator_date_and_revision=!0,this.development_extensions.locator_label_parse=!0,this.development_extensions.raw_date_parsing=!0,this.development_extensions.clean_up_csl_flaws=!0,this.development_extensions.consolidate_legal_items=!1,this.development_extensions.csl_reverse_lookup_support=!1,this.development_extensions.wrap_url_and_doi=!1,this.development_extensions.thin_non_breaking_space_html_hack=!1,this.development_extensions.apply_citation_wrapper=!1,this.development_extensions.main_title_from_short_title=!1,this.development_extensions.uppercase_subtitles=!1,this.development_extensions.normalize_lang_keys_to_lowercase=!1,this.development_extensions.strict_text_case_locales=!1,this.development_extensions.expect_and_symbol_form=!1,this.development_extensions.require_explicit_legal_case_title_short=!1,this.development_extensions.spoof_institutional_affiliations=!1,this.development_extensions.force_jurisdiction=!1,this.development_extensions.parse_names=!0,this.development_extensions.hanging_indent_legacy_number=!1,this.development_extensions.throw_on_empty=!1,this.development_extensions.strict_inputs=!0,this.development_extensions.prioritize_disambiguate_condition=!1,this.development_extensions.force_short_title_casing_alignment=!0,this.development_extensions.implicit_short_title=!1,this.development_extensions.force_title_abbrev_fallback=!1,this.development_extensions.split_container_title=!1,this.development_extensions.legacy_institution_name_ordering=!1,this.development_extensions.etal_min_etal_usefirst_hack=!1};u.Engine.Tmp=function(){this.names_max=new u.Stack,this.names_base=new u.Stack,this.givens_base=new u.Stack,this.value=[],this.namepart_decorations={},this.namepart_type=!1,this.area="citation",this.root="citation",this.extension="",this.can_substitute=new u.Stack(0,u.LITERAL),this.element_rendered_ok=!1,this.element_trace=new u.Stack("style"),this.nameset_counter=0,this.group_context=new u.Stack({term_intended:!1,variable_attempt:!1,variable_success:!1,output_tip:void 0,label_form:void 0,parallel_first:void 0,parallel_last:void 0,parallel_delimiter_override:void 0,condition:!1,force_suppress:!1,done_vars:[]}),this.term_predecessor=!1,this.in_cite_predecessor=!1,this.jump=new u.Stack(0,u.LITERAL),this.decorations=new u.Stack,this.tokenstore_stack=new u.Stack,this.last_suffix_used="",this.last_names_used=[],this.last_years_used=[],this.years_used=[],this.names_used=[],this.taintedItemIDs={},this.taintedCitationIDs={},this.initialize_with=new u.Stack,this.disambig_request=!1,this["name-as-sort-order"]=!1,this.suppress_decorations=!1,this.disambig_settings=new u.AmbigConfig,this.bib_sort_keys=[],this.prefix=new u.Stack("",u.LITERAL),this.suffix=new u.Stack("",u.LITERAL),this.delimiter=new u.Stack("",u.LITERAL),this.cite_locales=[],this.cite_affixes={citation:!1,bibliography:!1,citation_sort:!1,bibliography_sort:!1},this.strip_periods=0,this.shadow_numbers={},this.authority_stop_last=0,this.loadedItemIDs={},this.condition_counter=0,this.condition_lang_val_arr=[],this.condition_lang_counter_arr=[]};u.Engine.Fun=function(e){this.match=new u.Util.Match,this.suffixator=new u.Util.Suffixator(u.SUFFIX_CHARS),this.romanizer=new u.Util.Romanizer,this.ordinalizer=new u.Util.Ordinalizer(e),this.long_ordinalizer=new u.Util.LongOrdinalizer};u.Engine.Build=function(){this["alternate-term"]=!1,this.in_bibliography=!1,this.in_style=!1,this.skip=!1,this.postponed_macro=!1,this.layout_flag=!1,this.name=!1,this.names_variables=[[]],this.name_label=[{}],this.form=!1,this.term=!1,this.macro={},this.macro_stack=[],this.text=!1,this.lang=!1,this.area="citation",this.root="citation",this.extension="",this.substitute_level=new u.Stack(0,u.LITERAL),this.names_level=0,this.render_nesting_level=0,this.render_seen=!1,this.bibliography_key_pos=0};u.Engine.Configure=function(){this.tests=[],this.fail=[],this.succeed=[]};u.Engine.Citation=function(e){this.opt={inheritedAttributes:{}},this.tokens=[],this.srt=new u.Registry.Comparifier(e,"citation_sort"),this.opt.collapse=[],this.opt["disambiguate-add-names"]=!1,this.opt["disambiguate-add-givenname"]=!1,this.opt["disambiguate-add-year-suffix"]=!1,this.opt["givenname-disambiguation-rule"]="by-cite",this.opt["near-note-distance"]=5,this.opt.topdecor=[],this.opt.layout_decorations=[],this.opt.layout_prefix="",this.opt.layout_suffix="",this.opt.layout_delimiter="",this.opt.sort_locales=[],this.opt.max_number_of_names=0,this.root="citation"};u.Engine.Bibliography=function(){this.opt={inheritedAttributes:{}},this.tokens=[],this.opt.collapse=[],this.opt.topdecor=[],this.opt.layout_decorations=[],this.opt.layout_prefix="",this.opt.layout_suffix="",this.opt.layout_delimiter="",this.opt["line-spacing"]=1,this.opt["entry-spacing"]=1,this.opt.sort_locales=[],this.opt.max_number_of_names=0,this.root="bibliography"};u.Engine.BibliographySort=function(){this.tokens=[],this.opt={},this.opt.sort_directions=[],this.opt.topdecor=[],this.opt.citation_number_sort_direction=u.ASCENDING,this.opt.citation_number_secondary=!1,this.tmp={},this.keys=[],this.root="bibliography"};u.Engine.CitationSort=function(){this.tokens=[],this.opt={},this.opt.sort_directions=[],this.keys=[],this.opt.topdecor=[],this.root="citation"};u.Engine.InText=function(){this.opt={inheritedAttributes:{}},this.tokens=[],this.opt.collapse=[],this.opt["disambiguate-add-names"]=!1,this.opt["disambiguate-add-givenname"]=!1,this.opt["disambiguate-add-year-suffix"]=!1,this.opt["givenname-disambiguation-rule"]="by-cite",this.opt["near-note-distance"]=5,this.opt.topdecor=[],this.opt.layout_decorations=[],this.opt.layout_prefix="",this.opt.layout_suffix="",this.opt.layout_delimiter="",this.opt.sort_locales=[],this.opt.max_number_of_names=0,this.root="intext"};u.Engine.prototype.previewCitationCluster=function(e,t,i,n){var r=this.opt.mode;this.setOutputFormat(n),e.citationID&&delete e.citationID;var a=this.processCitationCluster(e,t,i,u.PREVIEW);return this.setOutputFormat(r),a[1]};u.Engine.prototype.appendCitationCluster=function(e){for(var t=[],i=this.registry.citationreg.citationByIndex.length,n=0;n<i;n+=1){var r=this.registry.citationreg.citationByIndex[n];t.push([""+r.citationID,r.properties.noteIndex])}return this.processCitationCluster(e,t,[])[1]};u.Engine.prototype.processCitationCluster=function(e,t,i,n){var r,a,o,l,c,f,p,m,d,h,v,b,y,g,x,k,w,C;this.debug=!1,this.tmp.loadedItemIDs={},this.tmp.citation_errors=[],this.registry.return_data={bibchange:!1},this.setCitationId(e);var E,B,_;if(n===u.PREVIEW){this.debug&&u.debug("****** start state save *********"),E=this.registry.citationreg.citationByIndex.slice(),B=this.registry.reflist.slice();for(var S=t.concat(i),T={},D=[],l=0,c=S.length;l<c;l+=1)for(r=this.registry.citationreg.citationById[S[l][0]],f=0,p=r.citationItems.length;f<p;f+=1)T[r.citationItems[f].id]=!0,D.push(""+r.citationItems[f].id);for(f=0,p=e.citationItems.length;f<p;f+=1)T[e.citationItems[f].id]=!0,D.push(""+e.citationItems[f].id);_={};for(var l=0,c=B.length;l<c;l+=1)if(!T[B[l].id]){var H=this.registry.registry[B[l].id].ambig,V=this.registry.ambigcites[H];if(V)for(f=0,p=V.length;f<p;f+=1)_[V[f]]=u.cloneAmbigConfig(this.registry.registry[V[f]].disambig)}this.debug&&u.debug("****** end state save *********")}this.tmp.taintedCitationIDs={};for(var M=[],$={},l=0,c=e.citationItems.length;l<c;l+=1){g={};for(var b in e.citationItems[l])g[b]=e.citationItems[l][b];if(y=this.retrieveItem(""+g.id),y.id&&this.transform.loadAbbreviation("default","hereinafter",y.id,y.language),g=u.parseLocator.call(this,g),this.opt.development_extensions.consolidate_legal_items&&this.remapSectionVariable([[y,g]]),this.opt.development_extensions.locator_label_parse&&g.locator&&["bill","gazette","legislation","regulation","treaty"].indexOf(y.type)===-1&&(!g.label||g.label==="page")){var w=u.LOCATOR_LABELS_REGEXP.exec(g.locator);if(w){var P=u.LOCATOR_LABELS_MAP[w[2]];this.getTerm(P)&&(g.label=P,g.locator=w[3])}}var W=[y,g];M.push(W),e.citationItems[l].item=y}e.sortedItems=M;var L=[],Q={},j;for(l=0,c=t.length;l<c;l+=1)a=t[l],this.opt.development_extensions.strict_inputs&&(Q[a[0]]&&u.error("Previously referenced citationID "+a[0]+" encountered in citationsPre"),a[1]&&(j>a[1]&&u.debug("Note index sequence is not sane at citationsPre["+l+"]"),j=a[1])),this.registry.citationreg.citationById[a[0]].properties.noteIndex=a[1],L.push(this.registry.citationreg.citationById[a[0]]),Q[a[0]]=this.registry.citationreg.citationById[a[0]];for(e.properties||(e.properties={noteIndex:0}),this.opt.development_extensions.strict_inputs&&(Q[e.citationID]&&u.error("Citation with previously referenced citationID "+e.citationID),e.properties.noteIndex&&(j>e.properties.noteIndex&&u.debug("Note index sequence is not sane for citation "+e.citationID),j=e.properties.noteIndex)),L.push(e),Q[e.citationID]=e,l=0,c=i.length;l<c;l+=1)o=i[l],this.opt.development_extensions.strict_inputs&&(Q[o[0]]&&u.error("Previously referenced citationID "+o[0]+" encountered in citationsPost"),o[1]&&(j>o[1]&&u.debug("Note index sequence is not sane at postCitation["+l+"]"),j=o[1])),this.registry.citationreg.citationById[o[0]].properties.noteIndex=o[1],L.push(this.registry.citationreg.citationById[o[0]]),Q[o[0]]=this.registry.citationreg.citationById[o[0]];this.registry.citationreg.citationByIndex=L,this.registry.citationreg.citationById=Q,this.registry.citationreg.citationsByItemId={},this.opt.update_mode===u.POSITION&&(k=[],x=[],C={});for(var O=[],l=0,c=L.length;l<c;l+=1){for(L[l].properties.index=l,f=0,p=L[l].sortedItems.length;f<p;f+=1)g=L[l].sortedItems[f],this.registry.citationreg.citationsByItemId[g[1].id]||(this.registry.citationreg.citationsByItemId[g[1].id]=[],O.push(""+g[1].id)),this.registry.citationreg.citationsByItemId[g[1].id].indexOf(L[l])===-1&&this.registry.citationreg.citationsByItemId[g[1].id].push(L[l]);this.opt.update_mode===u.POSITION&&(L[l].properties.noteIndex?x.push(L[l]):(L[l].properties.noteIndex=0,k.push(L[l])))}if(n!==u.ASSUME_ALL_ITEMS_REGISTERED&&(this.debug&&u.debug("****** start update items *********"),this.updateItems(O,null,null,!0),this.debug&&u.debug("****** endo update items *********")),!this.opt.citation_number_sort&&M&&M.length>1&&this.citation_sort.tokens.length>0){for(var l=0,c=M.length;l<c;l+=1)M[l][1].sortkeys=u.getSortKeys.call(this,M[l][0],"citation_sort");if(this.opt.grouped_sort&&!e.properties.unsorted){for(var l=0,c=M.length;l<c;l+=1){var R=M[l][1].sortkeys;this.tmp.authorstring_request=!0;var U=this.registry.registry[M[l][0].id].disambig;this.tmp.authorstring_request=!0,u.getAmbiguousCite.call(this,M[l][0],U);var oe=this.registry.authorstrings[M[l][0].id];this.tmp.authorstring_request=!1,M[l][1].sortkeys=[oe].concat(R)}M.sort(this.citation.srt.compareCompositeKeys);for(var ie=!1,ee=!1,te=!1,l=0,c=M.length;l<c;l+=1)M[l][1].sortkeys[0]!==ie&&(te=M[l][1].sortkeys[0],ee=M[l][1].sortkeys[1]),M[l][1].sortkeys[0]=""+ee+l,ie=te}e.properties.unsorted||M.sort(this.citation.srt.compareCompositeKeys)}this.opt.parallel.enable&&this.parallel.StartCitation(e.sortedItems);var X;if(this.opt.update_mode===u.POSITION)for(var l=0;l<2;l+=1){var F={},q={},ne={};for(X=[k,x][l],f=0,p=X.length;f<p;f+=1){var se=X[f];for(X[f].properties.noteIndex||(X[f].properties.noteIndex=0),X[f].properties.noteIndex=parseInt(X[f].properties.noteIndex,10),f>0&&se.properties.noteIndex&&X[f-1].properties.noteIndex>se.properties.noteIndex&&(C={},F={},q={},ne={}),m=0,d=se.sortedItems.length;m<d;m+=1)se.sortedItems[m][1].parallel&&se.sortedItems[m][1].parallel!=="first"||(C[se.properties.noteIndex]?C[se.properties.noteIndex]+=1:C[se.properties.noteIndex]=1);for(m=0,d=X[f].sortedItems.length;m<d;m+=1){g=X[f].sortedItems[m];var Se=g[0].id,Ae=g[0].legislation_id?g[0].legislation_id:g[0].id,fe=g[0].legislation_id?g[0].legislation_id:g[0].container_id?g[0].container_id:g[0].id,ke=g[1]["locator-extra"],G=g[1].locator,yt=g[1].label,we,At;if(m>0)if(se.sortedItems[m-1][0].legislation_id)we=se.sortedItems[m-1][0].legislation_id;else{we=se.sortedItems[m-1][1].id,At=se.sortedItems[m-1][1]["locator-extra"];for(var K=m-2;K>-1;K--)se.sortedItems[K][1].parallel==="first"&&(we=se.sortedItems[K][1].id,At=se.sortedItems[K][1]["locator-extra"])}if(n===u.PREVIEW&&se.citationID!=e.citationID){typeof F[g[1].id]>"u"&&(F[Ae]=se.properties.noteIndex),q[fe]=se.properties.noteIndex;continue}var I={};if(I.position=g[1].position,I["first-reference-note-number"]=g[1]["first-reference-note-number"],I["first-container-reference-note-number"]=g[1]["first-container-reference-note-number"],I["near-note"]=g[1]["near-note"],g[1]["first-reference-note-number"]=0,g[1]["first-container-reference-note-number"]=0,g[1]["near-note"]=!1,this.registry.citationreg.citationsByItemId[Se]&&this.opt.xclass==="note"&&this.opt.has_disambiguate){var J=this.registry.registry[g[0].id]["citation-count"],ze=this.registry.citationreg.citationsByItemId[Se].length;if(this.registry.registry[g[0].id]["citation-count"]=this.registry.citationreg.citationsByItemId[Se].length,typeof J=="number"){var Ue=J<2,qe=ze<2;if(Ue!==qe)for(var K=0,jt=this.registry.citationreg.citationsByItemId[Se].length;K<jt;K++)$[this.registry.registry[g[0].id].ambig]=!0,this.tmp.taintedCitationIDs[this.registry.citationreg.citationsByItemId[Se][K].citationID]=!0}else for(var K=0,jt=this.registry.citationreg.citationsByItemId[Se].length;K<jt;K++)$[this.registry.registry[g[0].id].ambig]=!0,this.tmp.taintedCitationIDs[this.registry.citationreg.citationsByItemId[Se][K].citationID]=!0}var pt,dt;if(typeof q[fe]>"u"&&se.properties.mode!=="author-only")F[Ae]=se.properties.noteIndex,q[fe]=se.properties.noteIndex,ne[fe]=se.properties.noteIndex,g[1].position=u.POSITION_FIRST;else{var Ot=!1,ri=!1,Xe=null;if(f>0)var Xe=X[f-1];var Si=X[f];if(f>0){var dn=1;Xe.properties.mode==="author-only"&&f>1&&(dn=2);var mn=f-dn;X[mn].sortedItems.length&&(pt=X[mn].sortedItems.slice(-1)[0][1].id,dt=X[f-dn].sortedItems.slice(-1)[0][1]["locator-extra"]),Xe.sortedItems.length&&Xe.sortedItems[0].slice(-1)[0].legislation_id&&(pt=Xe.sortedItems[0].slice(-1)[0].legislation_id)}if(f>0&&m===0&&Xe.properties.noteIndex!==Si.properties.noteIndex){var Ci=!1,ai=Xe.sortedItems[0][0].id;if(Xe.sortedItems[0][0].legislation_id&&(ai=Xe.sortedItems[0][0].legislation_id),ai==Ae&&Xe.properties.noteIndex>=Si.properties.noteIndex-1){var Wa=Xe.sortedItems[0][1]["locator-extra"],qt=Si.sortedItems[0][1]["locator-extra"];(C[Xe.properties.noteIndex]===1||Xe.properties.noteIndex===0)&&Wa===qt&&(Ci=!0)}Ci?Ot=!0:ri=!0}else m>0&&we==Ae&&At==ke||m===0&&f>0&&Xe.properties.noteIndex==Si.properties.noteIndex&&Xe.sortedItems.length&&pt==Ae&&dt==ke?Ot=!0:ri=!0;var mt,Tt,hn,Mt,Ei;Ot&&(m>0?mt=se.sortedItems[m-1][1]:mt=X[f-1].sortedItems[0][1],mt.locator?(mt.label?hn=mt.label:hn="",Tt=""+mt.locator+hn):Tt=mt.locator,G?(yt?Ei=yt:Ei="",Mt=""+G+Ei):Mt=G),Ot&&Tt&&!Mt&&(Ot=!1,ri=!0),Ot&&(!Tt&&Mt?g[1].position=u.POSITION_IBID_WITH_LOCATOR:!Tt&&!Mt||Tt&&Mt===Tt?g[1].position=u.POSITION_IBID:Tt&&Mt&&Mt!==Tt?g[1].position=u.POSITION_IBID_WITH_LOCATOR:(Ot=!1,ri=!0)),ri&&(g[1].position=u.POSITION_CONTAINER_SUBSEQUENT,typeof F[Ae]>"u"?F[Ae]=se.properties.noteIndex:g[1].position=u.POSITION_SUBSEQUENT),(ri||Ot)&&(se.properties.mode==="author-only"&&(g[1].position=u.POSITION_FIRST),ne[fe]!=se.properties.noteIndex&&(g[1]["first-container-reference-note-number"]=ne[fe],this.registry.registry[g[0].id]&&(this.registry.registry[g[0].id]["first-container-reference-note-number"]=ne[fe])),F[Ae]!=se.properties.noteIndex&&(g[1]["first-reference-note-number"]=F[Ae],this.registry.registry[g[0].id]&&(this.registry.registry[g[0].id]["first-reference-note-number"]=F[Ae])))}if(se.properties.noteIndex){var Ga=parseInt(se.properties.noteIndex,10)-parseInt(q[fe],10);g[1].position!==u.POSITION_FIRST&&Ga<=this.citation.opt["near-note-distance"]&&(g[1]["near-note"]=!0),q[fe]=se.properties.noteIndex}else g[1].position!==u.POSITION_FIRST&&(g[1]["near-note"]=!0);if(se.citationID!=e.citationID)for(h=0,v=u.POSITION_TEST_VARS.length;h<v;h+=1){var $t=u.POSITION_TEST_VARS[h];g[1][$t]!==I[$t]&&(this.registry.registry[g[0].id]&&$t==="first-reference-note-number"&&($[this.registry.registry[g[0].id].ambig]=!0,this.tmp.taintedItemIDs[g[0].id]=!0),this.tmp.taintedCitationIDs[se.citationID]=!0)}this.sys.variableWrapper&&(g[1].index=se.properties.index,g[1].noteIndex=se.properties.noteIndex)}}}if(this.opt.citation_number_sort&&M&&M.length>1&&this.citation_sort.tokens.length>0&&!e.properties.unsorted){for(var l=0,c=M.length;l<c;l+=1)M[l][1].sortkeys=u.getSortKeys.call(this,M[l][0],"citation_sort");M.sort(this.citation.srt.compareCompositeKeys)}for(var b in this.tmp.taintedItemIDs)if(this.tmp.taintedItemIDs.hasOwnProperty(b)&&(X=this.registry.citationreg.citationsByItemId[b],X))for(var l=0,c=X.length;l<c;l+=1)this.tmp.taintedCitationIDs[X[l].citationID]=!0;var oi=[];if(n===u.PREVIEW){this.debug&&u.debug("****** start run processor *********");try{oi=this.process_CitationCluster.call(this,e.sortedItems,e)}catch(li){u.error("Error running CSL processor for preview: "+li)}this.debug&&(u.debug("****** end run processor *********"),u.debug("****** start state restore *********")),this.registry.citationreg.citationByIndex=E,this.registry.citationreg.citationById={};for(var l=0,c=E.length;l<c;l+=1)this.registry.citationreg.citationById[E[l].citationID]=E[l];this.debug&&u.debug("****** start final update *********");for(var zt=[],l=0,c=B.length;l<c;l+=1)zt.push(""+B[l].id);this.updateItems(zt,null,null,!0),this.debug&&u.debug("****** end final update *********");for(var b in _)_.hasOwnProperty(b)&&(this.registry.registry[b].disambig=_[b]);this.debug&&u.debug("****** end state restore *********")}else{for(var si in $)this.disambiguate.run(si,e);var st;for(var b in this.tmp.taintedCitationIDs)if(b!=e.citationID){var lt=this.registry.citationreg.citationById[b];if(!lt.properties.unsorted){for(var l=0,c=lt.sortedItems.length;l<c;l+=1)lt.sortedItems[l][1].sortkeys=u.getSortKeys.call(this,lt.sortedItems[l][0],"citation_sort");lt.sortedItems.sort(this.citation.srt.compareCompositeKeys)}this.tmp.citation_pos=lt.properties.index,this.tmp.citation_note_index=lt.properties.noteIndex,this.tmp.citation_id=""+lt.citationID,st=[],st.push(lt.properties.index),st.push(this.process_CitationCluster.call(this,lt.sortedItems,lt)),st.push(lt.citationID),oi.push(st)}this.tmp.taintedItemIDs={},this.tmp.taintedCitationIDs={},this.tmp.citation_pos=e.properties.index,this.tmp.citation_note_index=e.properties.noteIndex,this.tmp.citation_id=""+e.citationID,st=[],st.push(t.length),st.push(this.process_CitationCluster.call(this,M,e)),st.push(e.citationID),oi.push(st),oi.sort(function(li,Yn){return li[0]>Yn[0]?1:li[0]<Yn[0]?-1:0})}return this.registry.return_data.citation_errors=this.tmp.citation_errors.slice(),[this.registry.return_data,oi]};u.Engine.prototype.process_CitationCluster=function(e,t){var i="";if(t&&t.properties&&t.properties.mode==="composite"){t.properties.mode="author-only";var n=u.getCitationCluster.call(this,e,t);t.properties.mode="suppress-author";var r="";t.properties.infix&&(this.output.append(t.properties.infix),r=this.output.string(this,this.output.queue),typeof r=="object"&&(r=r.join("")));var a=u.getCitationCluster.call(this,e,t);t.properties.mode="composite",n&&r&&u.SWAPPING_PUNCTUATION.concat(["’","'"]).indexOf(r[0])>-1&&(n+=r,r=!1),i=[n,r,a].filter(function(o){return o}).join(" ")}else i=u.getCitationCluster.call(this,e,t);return i};u.Engine.prototype.makeCitationCluster=function(e){var t,i,p,n,r,a,o;for(t=[],r=e.length,n=0;n<r;n+=1){a={};for(var l in e[n])a[l]=e[n][l];if(o=this.retrieveItem(""+a.id),this.opt.development_extensions.locator_label_parse&&a.locator&&["bill","gazette","legislation","regulation","treaty"].indexOf(o.type)===-1&&(!a.label||a.label==="page")){var c=u.LOCATOR_LABELS_REGEXP.exec(a.locator);if(c){var f=u.LOCATOR_LABELS_MAP[c[2]];this.getTerm(f)&&(a.label=f,a.locator=c[3])}}a.locator&&(a.locator=(""+a.locator).replace(/\s+$/,"")),i=[o,a],t.push(i)}if(this.opt.development_extensions.consolidate_legal_items&&this.remapSectionVariable(t),t&&t.length>1&&this.citation_sort.tokens.length>0){for(r=t.length,n=0;n<r;n+=1)t[n][1].sortkeys=u.getSortKeys.call(this,t[n][0],"citation_sort");t.sort(this.citation.srt.compareCompositeKeys)}this.tmp.citation_errors=[];var p=u.getCitationCluster.call(this,t);return p};u.getAmbiguousCite=function(e,t,i,n){var d,r=this.tmp.group_context.tip,a={term_intended:r.term_intended,variable_attempt:r.variable_attempt,variable_success:r.variable_success,output_tip:r.output_tip,label_form:r.label_form,non_parallel:r.non_parallel,parallel_last:r.parallel_last,parallel_first:r.parallel_first,parallel_last_override:r.parallel_last_override,parallel_delimiter_override:r.parallel_delimiter_override,parallel_delimiter_override_on_suppress:r.parallel_delimiter_override_on_suppress,condition:r.condition,force_suppress:r.force_suppress,done_vars:r.done_vars.slice()};t?this.tmp.disambig_request=t:this.tmp.disambig_request=!1;var o={position:u.POSITION_SUBSEQUENT,"near-note":!0};n&&(o.locator=n.locator,o.label=n.label),this.registry.registry[e.id]&&this.registry.citationreg.citationsByItemId&&this.registry.citationreg.citationsByItemId[e.id]&&this.registry.citationreg.citationsByItemId[e.id].length&&i&&this.citation.opt["givenname-disambiguation-rule"]==="by-cite"&&(o["first-reference-note-number"]=this.registry.registry[e.id]["first-reference-note-number"]),this.tmp.area="citation",this.tmp.root="citation";var l=this.tmp.suppress_decorations;this.tmp.suppress_decorations=!0,this.tmp.just_looking=!0,u.getCite.call(this,e,o,null,!1);for(var c=0,f=this.output.queue.length;c<f;c+=1)u.Output.Queue.purgeEmptyBlobs(this.output.queue[c]);if(this.opt.development_extensions.clean_up_csl_flaws)for(var p=0,m=this.output.queue.length;p<m;p+=1)this.output.adjust.upward(this.output.queue[p]),this.output.adjust.leftward(this.output.queue[p]),this.output.adjust.downward(this.output.queue[p]),this.output.adjust.fix(this.output.queue[p]);var d=this.output.string(this,this.output.queue);return this.tmp.just_looking=!1,this.tmp.suppress_decorations=l,this.tmp.group_context.replace(a),d};u.getSpliceDelimiter=function(e,t,i){if(this.citation.opt["after-collapse-delimiter"]!==void 0)e?this.tmp.splice_delimiter=this.citation.opt["after-collapse-delimiter"]:t&&!this.tmp.have_collapsed?this.tmp.splice_delimiter=this.citation.opt["after-collapse-delimiter"]:!t&&!this.tmp.have_collapsed&&this.citation.opt.collapse!=="year-suffix"?this.tmp.splice_delimiter=this.citation.opt["after-collapse-delimiter"]:this.tmp.splice_delimiter=this.citation.opt.layout_delimiter;else if(this.tmp.use_cite_group_delimiter)this.tmp.splice_delimiter=this.citation.opt.cite_group_delimiter;else if(this.tmp.have_collapsed&&this.opt.xclass==="in-text"&&this.opt.update_mode!==u.NUMERIC)this.tmp.splice_delimiter=", ";else if(this.tmp.cite_locales[i-1]){var n=this.tmp.cite_affixes[this.tmp.area][this.tmp.cite_locales[i-1]];n&&n.delimiter&&(this.tmp.splice_delimiter=n.delimiter)}else this.tmp.splice_delimiter||(this.tmp.splice_delimiter="");return this.tmp.splice_delimiter};u.getCitationCluster=function(e,t){var i,n,r,a,o,l,c,f,p,m,d,h,v,b,y,g,x,k,w,C,E,B="";this.output.checkNestedBrace=new u.checkNestedBrace(this),t&&(w=t.citationID,C=t.properties.mode==="author-only"?!!t.properties.mode:!1,this.opt.xclass!=="note"&&(E=t.properties.mode==="suppress-author"?!!t.properties.mode:!1),t.properties.prefix&&(B=u.checkPrefixSpaceAppend(this,t.properties.prefix))),e=e||[],this.tmp.last_primary_names_string=!1,x=u.getSafeEscape(this),this.tmp.area="citation",this.tmp.root="citation",i="",n=[],this.tmp.last_suffix_used="",this.tmp.last_names_used=[],this.tmp.last_years_used=[],this.tmp.backref_index=[],this.tmp.cite_locales=[],this.tmp.just_looking||(this.tmp.abbrev_trimmer={QUASHES:{}});var _=this.output.checkNestedBrace.update(this.citation.opt.layout_prefix+B),S=!1;if(this.citation.opt.suppressTrailingPunctuation&&(S=!0),w&&this.registry.citationreg.citationById[w].properties["suppress-trailing-punctuation"]&&(S=!0),this.opt.xclass==="note"){for(var T=[],D=!1,H=!1,V=[],M=0,$=e.length;M<$;M+=1){var P=e[M][0].type,W=e[M][0].title,L=e[M][1].position,Q=e[M][0].id;W&&P==="legal_case"&&Q!==H&&L&&((W!==D||T.length===0)&&(V=[],T.push(V)),V.push(e[M][1])),D=W,H=Q}for(M=0,$=T.length;M<$;M+=1)if(V=T[M],!(V.length<2)){var j=V.slice(-1)[0].locator;if(j)for(var O=0,R=V.length-1;O<R;O+=1)V[O].locator&&(j=!1);j&&(V[0].locator=j,delete V.slice(-1)[0].locator,V[0].label=V.slice(-1)[0].label,V.slice(-1)[0].label&&delete V.slice(-1)[0].label)}}for(r=[],a=e.length,e[0]&&e[0][1]&&(C?(delete e[0][1]["suppress-author"],e[0][1]["author-only"]=!0):E&&(delete e[0][1]["author-only"],e[0][1]["suppress-author"]=!0)),this.opt.parallel.enable&&this.parallel.StartCitation(e),o=0;o<a;o+=1){this.tmp.cite_index=o,h=e[o][0],l=e[o][1],l=u.parseLocator.call(this,l),c=this.tmp.have_collapsed;var U=!1;if(o>0&&e[o-1][1]&&(U=!!e[o-1][1].locator),f={},this.tmp.shadow_numbers={},!this.tmp.just_looking&&this.opt.hasPlaceholderTerm){var oe=this.output;this.output=new u.Output.Queue(this),this.output.adjust=new u.Output.Queue.adjust,u.getAmbiguousCite.call(this,h,null,!1,l),this.output=oe}if(this.tmp.in_cite_predecessor=!1,o>0?u.getCite.call(this,h,l,""+e[o-1][0].id,!0):(this.tmp.term_predecessor=!1,u.getCite.call(this,h,l,null,!0)),this.tmp.cite_renders_content||(k={citationID:""+this.tmp.citation_id,index:this.tmp.citation_pos,noteIndex:this.tmp.citation_note_index,itemID:""+h.id,citationItems_pos:o,error_code:u.ERROR_NO_RENDERED_FORM},this.tmp.citation_errors.push(k)),f.splice_delimiter=u.getSpliceDelimiter.call(this,U,c,o),l&&l["author-only"]&&(this.tmp.suppress_decorations=!0),o>0){g=e[o-1][1];var ie=g.suffix&&[";",".",","].indexOf(g.suffix.slice(-1))>-1,ee=!g.suffix&&l.prefix&&[";",".",","].indexOf(l.prefix.slice(0,1))>-1;if(ie||ee){var te=f.splice_delimiter.indexOf(" ");te>-1&&!ee?f.splice_delimiter=f.splice_delimiter.slice(te):f.splice_delimiter=""}}if(f.suppress_decorations=this.tmp.suppress_decorations,f.have_collapsed=this.tmp.have_collapsed,r.push(f),l["author-only"])break}d=this.output.queue.slice();var X="";t&&(X=u.checkSuffixSpacePrepend(this,t.properties.suffix));var F=this.citation.opt.layout_suffix,q=this.tmp.cite_locales[this.tmp.cite_locales.length-1];q&&this.tmp.cite_affixes[this.tmp.area][q]&&this.tmp.cite_affixes[this.tmp.area][q].suffix&&(F=this.tmp.cite_affixes[this.tmp.area][q].suffix),u.TERMINAL_PUNCTUATION.slice(0,-1).indexOf(F.slice(0,1))>-1&&(F=F.slice(0,1)),F=this.output.checkNestedBrace.update(X+F);for(var M=0,$=this.output.queue.length;M<$;M+=1)u.Output.Queue.purgeEmptyBlobs(this.output.queue[M]);if(!this.tmp.suppress_decorations&&this.output.queue.length&&(this.opt.development_extensions.apply_citation_wrapper&&this.sys.wrapCitationEntry&&!this.tmp.just_looking&&this.tmp.area==="citation"||(S||(this.output.queue[this.output.queue.length-1].strings.suffix=F),this.output.queue[0].strings.prefix=_)),this.opt.development_extensions.clean_up_csl_flaws)for(var O=0,R=this.output.queue.length;O<R;O+=1)this.output.adjust.upward(this.output.queue[O]),this.output.adjust.leftward(this.output.queue[O]),this.output.adjust.downward(this.output.queue[O]),this.tmp.last_chr=this.output.adjust.fix(this.output.queue[O]);for(o=0,a=d.length;o<a;o+=1){var ne=[];if(this.output.queue=[d[o]],this.tmp.suppress_decorations=r[o].suppress_decorations,this.tmp.splice_delimiter=r[o].splice_delimiter,d[o].parallel_delimiter&&(this.tmp.splice_delimiter=d[o].parallel_delimiter),this.tmp.have_collapsed=r[o].have_collapsed,p=this.output.string(this,this.output.queue),this.tmp.suppress_decorations=!1,typeof p=="string")return this.tmp.suppress_decorations=!1,p||(this.opt.development_extensions.throw_on_empty?u.error("Citation would render no content"):p="[NO_PRINTED_FORM]"),p;if(typeof p=="object"&&p.length===0&&!l["suppress-author"]){if(o===0){var se="[CSL STYLE ERROR: reference with no printed form.]",Se=o===0?x(this.citation.opt.layout_prefix):"",Ae=o===d.length-1?x(this.citation.opt.layout_suffix):"";p.push(Se+se+Ae)}else if(o===d.length-1){var fe=n[n.length-1];typeof fe=="string"?n[n.length-1]+=x(this.citation.opt.layout_suffix):typeof fe=="object"&&(fe.strings.suffix+=x(this.citation.opt.layout_suffix))}}if(ne.length&&typeof p[0]=="string"){p.reverse();var ke=p.pop();ke&&ke.slice(0,1)===","?ne.push(ke):typeof ne.slice(-1)[0]=="string"&&ne.slice(-1)[0].slice(-1)===","?ne.push(" "+ke):ke&&ne.push(x(this.tmp.splice_delimiter)+ke)}else p.reverse(),m=p.pop(),typeof m<"u"&&(ne.length&&typeof ne[ne.length-1]=="string"&&(ne[ne.length-1]+=m.successor_prefix),ne.push(m));for(v=p.length,b=0;b<v;b+=1){if(y=p[b],typeof y=="string"){ne.push(x(this.tmp.splice_delimiter)+y);continue}m=p.pop(),typeof m<"u"&&ne.push(m)}ne.length===0&&e[o][1]["suppress-author"],ne.length>1&&typeof ne[0]!="string"&&(ne=[this.output.renderBlobs(ne)]),ne.length&&(typeof ne[0]=="string"?o>0&&(ne[0]=x(this.tmp.splice_delimiter)+ne[0]):o>0?ne[0].splice_prefix=this.tmp.splice_delimiter:ne[0].splice_prefix=""),n=n.concat(ne)}if(i+=this.output.renderBlobs(n),i&&!this.tmp.suppress_decorations)for(a=this.citation.opt.layout_decorations.length,o=0;o<a;o+=1)f=this.citation.opt.layout_decorations[o],f[1]!=="normal"&&(!l||!l["author-only"])&&(i=this.fun.decorate[f[0]][f[1]](this,i));return this.tmp.suppress_decorations=!1,i||(this.opt.development_extensions.throw_on_empty?u.error("Citation would render no content"):i="[NO_PRINTED_FORM]"),i};u.getCite=function(e,t,i,n){var r,a,o=this.tmp.area;for(t&&t["author-only"]&&this.intext&&this.intext.tokens.length>0&&(this.tmp.area="intext"),this.tmp.cite_renders_content=!1,this.tmp.probably_rendered_something=!1,this.tmp.prevItemID=i,u.citeStart.call(this,e,t,n),r=0,this.tmp.name_node={},this.nameOutput=new u.NameOutput(this,e,t);r<this[this.tmp.area].tokens.length;)r=u.tokenExec.call(this,this[this.tmp.area].tokens[r],e,t);return u.citeEnd.call(this,e,t),!this.tmp.cite_renders_content&&!this.tmp.just_looking&&this.tmp.area==="bibliography"&&(a={index:this.tmp.bibliography_pos,itemID:""+e.id,error_code:u.ERROR_NO_RENDERED_FORM},this.tmp.bibliography_errors.push(a)),this.tmp.area=o,""+e.id};u.citeStart=function(e,t,i){if(this.tmp.lang_array=[],e.language){var n=e.language.match(/^([a-zA-Z]+).*/);n&&this.tmp.lang_array.push(n[1].toLowerCase())}if(this.tmp.lang_array.push(this.opt.lang),i||(this.tmp.shadow_numbers={}),this.tmp.disambiguate_count=0,this.tmp.disambiguate_maxMax=0,this.tmp.same_author_as_previous_cite=!1,this.tmp.suppress_decorations?this.tmp.subsequent_author_substitute_ok=!1:this.tmp.subsequent_author_substitute_ok=!0,this.tmp.lastchr="",this.tmp.area==="citation"&&this.citation.opt.collapse&&this.citation.opt.collapse.length?this.tmp.have_collapsed=!0:this.tmp.have_collapsed=!1,this.tmp.render_seen=!1,this.tmp.disambig_request&&!this.tmp.disambig_override?this.tmp.disambig_settings=this.tmp.disambig_request:this.registry.registry[e.id]&&!this.tmp.disambig_override?(this.tmp.disambig_request=this.registry.registry[e.id].disambig,this.tmp.disambig_settings=this.registry.registry[e.id].disambig):this.tmp.disambig_settings=new u.AmbigConfig,this.tmp.area!=="citation"){if(!this.registry.registry[e.id])this.tmp.disambig_restore=new u.AmbigConfig;else if(this.tmp.disambig_restore=u.cloneAmbigConfig(this.registry.registry[e.id].disambig),this.tmp.area==="bibliography"&&this.tmp.disambig_settings&&this.tmp.disambig_override&&(this.opt["disambiguate-add-names"]&&(this.tmp.disambig_settings.names=this.registry.registry[e.id].disambig.names.slice(),this.tmp.disambig_request&&(this.tmp.disambig_request.names=this.registry.registry[e.id].disambig.names.slice())),this.opt["disambiguate-add-givenname"])){this.tmp.disambig_request=this.tmp.disambig_settings,this.tmp.disambig_settings.givens=this.registry.registry[e.id].disambig.givens.slice(),this.tmp.disambig_request.givens=this.registry.registry[e.id].disambig.givens.slice();for(var r=0,a=this.tmp.disambig_settings.givens.length;r<a;r+=1)this.tmp.disambig_settings.givens[r]=this.registry.registry[e.id].disambig.givens[r].slice();for(var r=0,a=this.tmp.disambig_request.givens.length;r<a;r+=1)this.tmp.disambig_request.givens[r]=this.registry.registry[e.id].disambig.givens[r].slice()}}this.tmp.names_used=[],this.tmp.nameset_counter=0,this.tmp.years_used=[],this.tmp.names_max.clear(),this.tmp.just_looking||(!t||t.parallel==="first"||!t.parallel)&&(this.tmp.abbrev_trimmer={QUASHES:{}}),this.tmp.splice_delimiter=this[this.tmp.area].opt.layout_delimiter,this.bibliography_sort.keys=[],this.citation_sort.keys=[],this.tmp.has_done_year_suffix=!1,this.tmp.last_cite_locale=!1,!this.tmp.just_looking&&t&&!t.position&&this.registry.registry[e.id]&&(this.tmp.disambig_restore=u.cloneAmbigConfig(this.registry.registry[e.id].disambig)),this.tmp.first_name_string=!1,this.tmp.authority_stop_last=0};u.citeEnd=function(e,t){if(this.tmp.disambig_restore&&this.registry.registry[e.id]){this.registry.registry[e.id].disambig.names=this.tmp.disambig_restore.names.slice(),this.registry.registry[e.id].disambig.givens=this.tmp.disambig_restore.givens.slice();for(var i=0,n=this.registry.registry[e.id].disambig.givens.length;i<n;i+=1)this.registry.registry[e.id].disambig.givens[i]=this.tmp.disambig_restore.givens[i].slice()}if(this.tmp.disambig_restore=!1,t&&t.suffix?this.tmp.last_suffix_used=t.suffix:this.tmp.last_suffix_used="",this.tmp.last_years_used=this.tmp.years_used.slice(),this.tmp.last_names_used=this.tmp.names_used.slice(),this.tmp.cut_var=!1,this.tmp.disambig_request=!1,this.tmp.cite_locales.push(this.tmp.last_cite_locale),this.tmp.issued_date&&this.tmp.renders_collection_number){for(var r=[],i=this.tmp.issued_date.list.length-1;i>this.tmp.issued_date.pos;i+=-1)r.push(this.tmp.issued_date.list.pop());for(this.tmp.issued_date.list.pop(),i=r.length-1;i>-1;i+=-1)this.tmp.issued_date.list.push(r.pop())}this.tmp.issued_date=!1,this.tmp.renders_collection_number=!1};u.Engine.prototype.makeBibliography=function(e){var t,i,n,r,a,o,l,c,f;if(t=!1,!e&&(this.bibliography.opt.exclude_types||this.bibliography.opt.exclude_with_fields)){if(e={exclude:[]},this.bibliography.opt.exclude_types)for(var p in this.bibliography.opt.exclude_types){var m=this.bibliography.opt.exclude_types[p];e.exclude.push({field:"type",value:m})}if(this.bibliography.opt.exclude_with_fields)for(var p in this.bibliography.opt.exclude_with_fields){var d=this.bibliography.opt.exclude_with_fields[p];e.exclude.push({field:d,value:!0})}}if(!this.bibliography.tokens.length)return!1;if(typeof e=="string"&&(this.opt.citation_number_slug=e,e=!1),t){for(a=this.bibliography.tokens.length,o=0;o<a;o+=1)l=this.bibliography.tokens[o],u.debug("bibtok: "+l.name);for(u.debug("---"),a=this.citation.tokens.length,o=0;o<a;o+=1)this.citation.tokens[o],u.debug("cittok: "+l.name);for(u.debug("---"),a=this.bibliography_sort.tokens.length,o=0;o<a;o+=1)this.bibliography_sort.tokens[o],u.debug("bibsorttok: "+l.name)}i=u.getBibliographyEntries.call(this,e),c=i[0],f=i[1];var h=i[2];for(n={maxoffset:0,entryspacing:this.bibliography.opt["entry-spacing"],linespacing:this.bibliography.opt["line-spacing"],"second-field-align":!1,entry_ids:c,bibliography_errors:this.tmp.bibliography_errors.slice(),done:h},this.bibliography.opt["second-field-align"]&&(n["second-field-align"]=this.bibliography.opt["second-field-align"]),a=this.registry.reflist.length,o=0;o<a;o+=1)r=this.registry.reflist[o],r.offset>n.maxoffset&&(n.maxoffset=r.offset);return this.bibliography.opt.hangingindent&&(n.hangingindent=this.bibliography.opt.hangingindent),n.bibstart=this.fun.decorate.bibstart,n.bibend=this.fun.decorate.bibend,this.opt.citation_number_slug=!1,[n,f]};u.getBibliographyEntries=function(e){var t,i,n,r,a,o,l,c,f,p,m,d,h,v,b,y,g,x,k,w,C;t=[],k=[],this.tmp.area="bibliography",this.tmp.root="bibliography",this.tmp.last_rendered_name=!1,this.tmp.bibliography_errors=[],this.tmp.bibliography_pos=0,e&&e.page_start&&e.page_length?i=this.registry.getSortedIds():i=this.refetchItems(this.registry.getSortedIds()),this.tmp.disambig_override=!0;function E(P,W){return P===W}function B(P,W){for(p=W.length,m=0;m<p;m+=1)if(E(P,W[m]))return!0;return!1}function _(P,W){return typeof P=="boolean"||!P?P?!!W:!W:typeof W=="string"?E(P,W):W?B(P,W):!1}g={};var S;if(e&&e.page_start&&e.page_length&&(S=0,e.page_start!==!0))for(v=0,b=i.length;v<b&&(g[i[v]]=!0,e.page_start!=i[v]);v+=1);var T=[],D={};for(this.tmp.container_item_count={},i=i.filter(P=>{var W=P;return P.legislation_id?D[P.legislation_id]?W=!1:D[P.legislation_id]=!0:P.container_id&&(this.tmp.container_item_count[P.container_id]||(this.tmp.container_item_count[P.container_id]=0),this.tmp.container_item_count[P.container_id]++,this.bibliography.opt.consolidate_containers.indexOf(P.type)>-1&&(D[P.container_id]?W=!1:D[P.container_id]=!0)),W}),this.tmp.container_item_pos={},v=0,b=i.length;v<b;v+=1){if(e&&e.page_start&&e.page_length){if(g[i[v]])continue;if(c=this.refetchItem(i[v]),S===e.page_length)break}else if(c=i[v],g[c.id])continue;if(e){if(n=!0,e.include){for(n=!1,w=0,C=e.include.length;w<C;w+=1)if(f=e.include[w],_(f.value,c[f.field])){n=!0;break}}else if(e.exclude){for(r=!1,w=0,C=e.exclude.length;w<C;w+=1)if(f=e.exclude[w],_(f.value,c[f.field])){r=!0;break}r&&(n=!1)}else if(e.select){for(n=!1,a=!0,w=0,C=e.select.length;w<C;w+=1)f=e.select[w],_(f.value,c[f.field])||(a=!1);a&&(n=!0)}if(e.quash){for(a=!0,w=0,C=e.quash.length;w<C;w+=1)f=e.quash[w],_(f.value,c[f.field])||(a=!1);a&&(n=!1)}if(!n)continue}if(c.container_id&&(this.tmp.container_item_pos[c.container_id]||(this.tmp.container_item_pos[c.container_id]=0),this.tmp.container_item_pos[c.container_id]++),o=new u.Token("group",u.START),o.decorations=[["@bibliography","entry"]].concat(this.bibliography.opt.layout_decorations),this.output.startTag("bib_entry",o),c.system_id&&this.sys.embedBibliographyEntry?this.output.current.value().item_id=c.system_id:this.output.current.value().system_id=c.id,h=[],this.registry.registry[c.id].master&&!(e&&e.page_start&&e.page_length)){x=[[c,{id:c.id}]],y=this.registry.registry[c.id].siblings;for(var w=0,C=y.length;w<C;w++)x.push([this.refetchItem(y[w]),{id:y[w]}]);for(this.parallel.StartCitation(x),this.registry.registry[c.id].parallel_delimiter_override?this.output.queue[0].strings.delimiter=this.registry.registry[c.id].parallel_delimiter_override:this.output.queue[0].strings.delimiter=", ",this.tmp.term_predecessor=!1,this.tmp.cite_index=0,w=0,C=x.length;w<C;w+=1)w<x.length-1?this.tmp.parallel_and_not_last=!0:delete this.tmp.parallel_and_not_last,h.push(""+u.getCite.call(this,x[w][0],x[w][1])),this.tmp.cite_index++,g[x[w][0].id]=!0}else this.registry.registry[c.id].siblings||(this.tmp.term_predecessor=!1,this.tmp.cite_index=0,h.push(""+u.getCite.call(this,c)),e&&e.page_start&&e.page_length&&(S+=1));for(k.push(""),this.tmp.bibliography_pos+=1,T.push(h),this.output.endTag("bib_entry"),this.output.queue[0].blobs.length&&this.output.queue[0].blobs[0].blobs.length&&(this.output.queue[0].blobs[0].blobs[0].strings?d=this.output.queue[0].blobs[0].blobs:d=this.output.queue[0].blobs,d[0].strings.prefix=this.bibliography.opt.layout_prefix+d[0].strings.prefix),w=0,C=this.output.queue.length;w<C;w+=1)u.Output.Queue.purgeEmptyBlobs(this.output.queue[w]);for(w=0,C=this.output.queue.length;w<C;w+=1)this.output.adjust.upward(this.output.queue[w]),this.output.adjust.leftward(this.output.queue[w]),this.output.adjust.downward(this.output.queue[w],!0),this.output.adjust.fix(this.output.queue[w]);if(l=this.output.string(this,this.output.queue)[0],!l&&this.opt.update_mode===u.NUMERIC){var H=t.length+1+". [CSL STYLE ERROR: reference with no printed form.]";l=u.Output.Formats[this.opt.mode]["@bibliography/entry"](this,H)}l&&t.push(l)}var V=!1;if(e&&e.page_start&&e.page_length){var M=i.slice(-1)[0],$=T.slice(-1)[0];(!M||!$||M==$)&&(V=!0)}return this.tmp.disambig_override=!1,[T,t,V]};u.Engine.prototype.setCitationId=function(e,t){var i,n,r;if(i=!1,!e.citationID||t){for(n=Math.floor(Math.random()*1e14);;){if(r=0,this.registry.citationreg.citationById[n])!r&&n<5e13?r=1:r=-1;else{e.citationID="a"+n.toString(32);break}r===1?n+=1:n+=-1}i=""+n}return this.registry.citationreg.citationById[e.citationID]=e,i};u.Engine.prototype.rebuildProcessorState=function(e,t,i){e||(e=[]),t||(t="html");for(var n={},r=[],a=0,o=e.length;a<o;a+=1)for(var l=0,c=e[a].citationItems.length;l<c;l+=1){var f=""+e[a].citationItems[l].id;n[f]||r.push(f),n[f]=!0}this.updateItems(r);var p=[],m=[],d=[],h=this.opt.mode;this.setOutputFormat(t);for(var a=0,o=e.length;a<o;a+=1){var v=this.processCitationCluster(e[a],p,m,u.ASSUME_ALL_ITEMS_REGISTERED);p.push([e[a].citationID,e[a].properties.noteIndex]);for(var l=0,c=v[1].length;l<c;l+=1){var b=v[1][l][0];d[b]=[p[b][0],p[b][1],v[1][l][1]]}}return this.updateUncitedItems(i),this.setOutputFormat(h),d};u.Engine.prototype.restoreProcessorState=function(e){var t,i,n,r,a,o,l,c,f,p;c=[],f=[],e||(e=[]);var m=[],d={};for(t=0,i=e.length;t<i;t+=1)d[e[t].citationID]&&this.setCitationId(e[t],!0),d[e[t].citationID]=!0,m.push(e[t].properties.index);var h=e.slice();for(h.sort(function(b,y){return b.properties.index<y.properties.index?-1:b.properties.index>y.properties.index?1:0}),t=0,i=h.length;t<i;t+=1)h[t].properties.index=t;for(t=0,i=h.length;t<i;t+=1){for(p=[],n=0,r=h[t].citationItems.length;n<r;n+=1)a=h[t].citationItems[n],typeof a.sortkeys>"u"&&(a.sortkeys=[]),o=this.retrieveItem(""+a.id),l=[o,a],p.push(l),h[t].citationItems[n].item=o,f.push(""+a.id);h[t].properties.unsorted||p.sort(this.citation.srt.compareCompositeKeys),h[t].sortedItems=p,this.registry.citationreg.citationById[h[t].citationID]=h[t]}for(this.updateItems(f),t=0,i=e.length;t<i;t+=1)c.push([""+e[t].citationID,e[t].properties.noteIndex]);var v=[];return e&&e.length?v=this.processCitationCluster(e[0],[],c.slice(1)):(this.registry=new u.Registry(this),this.tmp=new u.Engine.Tmp,this.disambiguate=new u.Disambiguation(this)),v};u.Engine.prototype.updateItems=function(e,t,i,n){var r=this.tmp.area,a=this.tmp.root,o=this.tmp.extension;if(this.bibliography_sort.tokens.length===0&&(t=!0),this.tmp.area="citation",this.tmp.root="citation",this.tmp.extension="",n||(this.tmp.loadedItemIDs={}),this.registry.init(e),i)for(var l in this.registry.ambigcites)this.registry.ambigsTouched[l]=!0;return this.registry.dodeletes(this.registry.myhash),this.registry.doinserts(this.registry.mylist),this.registry.dorefreshes(),this.registry.rebuildlist(t),this.registry.setsortkeys(),this.registry.setdisambigs(),this.registry.sorttokens(t),this.registry.renumber(),this.tmp.extension=o,this.tmp.area=r,this.tmp.root=a,this.registry.getSortedIds()};u.Engine.prototype.updateUncitedItems=function(e,t){var i,n=this.tmp.area,r=this.tmp.root,a=this.tmp.extension;if(this.bibliography_sort.tokens.length===0&&(t=!0),this.tmp.area="citation",this.tmp.root="citation",this.tmp.extension="",this.tmp.loadedItemIDs={},e||(e=[]),typeof e=="object"){if(typeof e.length>"u"){i=e,e=[];for(var o in i)e.push(o)}else if(typeof e.length=="number"){i={};for(var l=0,c=e.length;l<c;l+=1)i[e[l]]=!0}}return this.registry.init(e,!0),this.registry.dopurge(i),this.registry.doinserts(this.registry.mylist),this.registry.dorefreshes(),this.registry.rebuildlist(t),this.registry.setsortkeys(),this.registry.setdisambigs(),this.registry.sorttokens(t),this.registry.renumber(),this.tmp.extension=a,this.tmp.area=n,this.tmp.root=r,this.registry.getSortedIds()};u.localeResolve=function(e,t){var i,n;return t||(t="en-US"),e||(e=t),i={},n=e.split(/[\-_]/),i.base=u.LANG_BASES[n[0]],typeof i.base>"u"?{base:t,best:e,bare:n[0]}:(n.length===1&&(i.generic=!0),n.length===1||n[1]==="x"?i.best=i.base.replace("_","-"):i.best=n.slice(0,2).join("-"),i.base=i.base.replace("_","-"),i.bare=n[0],i)};u.Engine.prototype.localeConfigure=function(e,t){var i;if(!(t&&this.locale[e.best])&&(e.best==="en-US"?(i=u.setupXml(this.sys.retrieveLocale("en-US")),this.localeSet(i,"en-US",e.best)):e.best!=="en-US"&&(e.base!==e.best&&(i=u.setupXml(this.sys.retrieveLocale(e.base)),this.localeSet(i,e.base,e.best)),i=u.setupXml(this.sys.retrieveLocale(e.best)),this.localeSet(i,e.best,e.best)),this.localeSet(this.cslXml,"",e.best),this.localeSet(this.cslXml,e.bare,e.best),e.base!==e.best&&this.localeSet(this.cslXml,e.base,e.best),this.localeSet(this.cslXml,e.best,e.best),typeof this.locale[e.best].terms["page-range-delimiter"]>"u"&&(["fr","pt"].indexOf(e.best.slice(0,2).toLowerCase())>-1?this.locale[e.best].terms["page-range-delimiter"]="-":this.locale[e.best].terms["page-range-delimiter"]="–"),typeof this.locale[e.best].terms["year-range-delimiter"]>"u"&&(this.locale[e.best].terms["year-range-delimiter"]="–"),typeof this.locale[e.best].terms["citation-range-delimiter"]>"u"&&(this.locale[e.best].terms["citation-range-delimiter"]="–"),this.opt.development_extensions.normalize_lang_keys_to_lowercase)){for(var n=["default-locale","locale-sort","locale-translit","locale-translat"],r=0,a=n.length;r<a;r+=1)for(var o=0,l=this.opt[n[r]].length;o<l;o+=1)this.opt[n[r]][o]=this.opt[n[r]][o].toLowerCase();this.opt.lang=this.opt.lang.toLowerCase()}};u.Engine.prototype.localeSet=function(e,t,i){var n,r,a,o,l,c,f,p,m,d,h,v,b,y,g,x;if(t=t.replace("_","-"),i=i.replace("_","-"),this.opt.development_extensions.normalize_lang_keys_to_lowercase&&(t=t.toLowerCase(),i=i.toLowerCase()),this.locale[i]||(this.locale[i]={},this.locale[i].terms={},this.locale[i].opts={},this.locale[i].opts["skip-words"]=u.SKIP_WORDS,this.locale[i].opts["leading-noise-words"]||(this.locale[i].opts["leading-noise-words"]=[]),this.locale[i].dates={},this.locale[i].ord={"1.0.1":!1,keys:{}},this.locale[i]["noun-genders"]={}),r=e.makeXml(),e.nodeNameIs(e.dataObj,"locale"))r=e.dataObj;else{a=e.getNodesByName(e.dataObj,"locale");var k=!1;for(l=0,v=e.numberofnodes(a);l<v;l+=1)if(n=a[l],!k&&e.getAttributeValue(n,"lang","xml")===t)r=n,k=!0;else{var w=e.getAttributeValue(n,"lang","xml"),C=e.getNodesByName(n,"style-options");if(w&&C&&C.length){var E=e.getAttributeValue(C[0],"jurisdiction-preference");E&&(this.locale[w]||(this.locale[w]={opts:{}}),this.locale[w].opts["jurisdiction-preference"]=E.split(/\s+/))}}}for(a=e.getNodesByName(r,"type"),g=0,x=e.numberofnodes(a);g<x;g+=1){var B=a[g],_=e.getAttributeValue(B,"name"),S=e.getAttributeValue(B,"gender");this.opt.gender[_]=S}var T=e.getNodesByName(r,"term","ordinal").length;if(T){for(var D in this.locale[i].ord.keys)delete this.locale[i].terms[D];this.locale[i].ord={"1.0.1":!1,keys:{}}}a=e.getNodesByName(r,"term");var H={"last-digit":{},"last-two-digits":{},"whole-number":{}},V=!1,M={};for(l=0,v=e.numberofnodes(a);l<v;l+=1){if(c=a[l],p=e.getAttributeValue(c,"name"),p==="sub verbo"&&(p="sub-verbo"),p.slice(0,7)==="ordinal"){if(p==="ordinal")V=!0;else{var $=e.getAttributeValue(c,"match"),P=p.slice(8),b=e.getAttributeValue(c,"gender-form");b||(b="neuter"),$||($="last-two-digits",P.slice(0,1)==="0"&&($="last-digit")),P.slice(0,1)==="0"&&(P=P.slice(1)),H[$][P]||(H[$][P]={}),H[$][P][b]=p}this.locale[i].ord.keys[p]=!0}typeof this.locale[i].terms[p]>"u"&&(this.locale[i].terms[p]={}),f="long",b=!1,e.getAttributeValue(c,"form")&&(f=e.getAttributeValue(c,"form")),e.getAttributeValue(c,"gender-form")&&(b=e.getAttributeValue(c,"gender-form")),e.getAttributeValue(c,"gender")&&(this.locale[i]["noun-genders"][p]=e.getAttributeValue(c,"gender")),b?(this.locale[i].terms[p][b]={},this.locale[i].terms[p][b][f]=[],y=this.locale[i].terms[p][b],M[p]=!0):(this.locale[i].terms[p][f]=[],y=this.locale[i].terms[p]),e.numberofnodes(e.getNodesByName(c,"multiple"))?(y[f][0]=e.getNodeValue(c,"single"),y[f][0].indexOf("%s")>-1&&(this.opt.hasPlaceholderTerm=!0),y[f][1]=e.getNodeValue(c,"multiple"),y[f][1].indexOf("%s")>-1&&(this.opt.hasPlaceholderTerm=!0)):(y[f]=e.getNodeValue(c),y[f].indexOf("%s")>-1&&(this.opt.hasPlaceholderTerm=!0))}if(this.locale[i].terms.supplement||(this.locale[i].terms.supplement={}),this.locale[i].terms.supplement.long||(this.locale[i].terms.supplement.long=["supplement","supplements"]),V){for(var W in M){var L={},Q=0;for(var j in this.locale[i].terms[W])["masculine","feminine"].indexOf(j)>-1?L[j]=this.locale[i].terms[W][j]:Q+=1;if(!Q){if(L.feminine)for(var j in L.feminine)this.locale[i].terms[W][j]=L.feminine[j];else if(L.masculine)for(var j in L.masculine)this.locale[i].terms[W][j]=L.masculine[j]}}this.locale[i].ord["1.0.1"]=H}for(p in this.locale[i].terms)for(g=0,x=2;g<x;g+=1)if(b=u.GENDERS[g],this.locale[i].terms[p][b])for(f in this.locale[i].terms[p])this.locale[i].terms[p][b][f]||(this.locale[i].terms[p][b][f]=this.locale[i].terms[p][f]);for(a=e.getNodesByName(r,"style-options"),l=0,v=e.numberofnodes(a);l<v;l+=1){m=a[l],o=e.attributes(m);for(h in o)if(o.hasOwnProperty(h)){if(h==="@punctuation-in-quote"||h==="@limit-day-ordinals-to-day-1")o[h]==="true"?this.locale[i].opts[h.slice(1)]=!0:this.locale[i].opts[h.slice(1)]=!1;else if(h==="@jurisdiction-preference"){var O=o[h].split(/\s+/);this.locale[i].opts[h.slice(1)]=O}else if(h==="@skip-words"){var R=o[h].split(/\s*,\s*/);this.locale[i].opts[h.slice(1)]=R}else if(h==="@leading-noise-words"){var U=o[h].split(/\s*,\s*/);this.locale[i].opts["leading-noise-words"]=U}else if(h==="@name-as-sort-order"){this.locale[i].opts["name-as-sort-order"]={};for(var oe=o[h].split(/\s+/),g=0,x=oe.length;g<x;g+=1)this.locale[i].opts["name-as-sort-order"][oe[g]]=!0}else if(h==="@name-as-reverse-order"){this.locale[i].opts["name-as-reverse-order"]={};for(var oe=o[h].split(/\s+/),g=0,x=oe.length;g<x;g+=1)this.locale[i].opts["name-as-reverse-order"][oe[g]]=!0}else if(h==="@name-never-short"){this.locale[i].opts["name-never-short"]={};for(var oe=o[h].split(/\s+/),g=0,x=oe.length;g<x;g+=1)this.locale[i].opts["name-never-short"][oe[g]]=!0}}}for(a=e.getNodesByName(r,"date"),l=0,v=e.numberofnodes(a);l<v;l+=1){var d=a[l];this.locale[i].dates[e.getAttributeValue(d,"form")]=d}u.SET_COURT_CLASSES(this,i,e,r)};u.getLocaleNames=function(e,t){var i=u.setupXml(e);function n(m,d){var h=["base","best"];if(d)for(var v=u.localeResolve(d),b=0,y=h.length;b<y;b++)v[h[b]]&&m.indexOf(v[h[b]])===-1&&m.push(v[h[b]])}var r=["en-US"];function a(m){for(var d=i.getNodesByName(i.dataObj,m),h=0,v=d.length;h<v;h++){var b=i.getAttributeValue(d[h],"locale");if(b){b=b.split(/ +/);for(var y=0,g=b.length;y<g;y++)this.extendLocaleList(r,b[y])}}}n(r,t);var o=i.getNodesByName(i.dataObj,"style")[0],l=i.getAttributeValue(o,"default-locale");n(r,l);for(var c=["layout","if","else-if","condition"],f=0,p=c.length;f<p;f++)a(i);return r};u.Node={};u.Node.bibliography={build:function(e,t){if(this.tokentype===u.START){e.build.area="bibliography",e.build.root="bibliography",e.build.extension="";var i=function(n){n.tmp.area="bibliography",n.tmp.root="bibliography",n.tmp.extension=""};this.execs.push(i)}t.push(this)}};u.Node.choose={build:function(e,t){var i;this.tokentype===u.START&&(i=function(n){n.tmp.jump.push(void 0,u.LITERAL)}),this.tokentype===u.END&&(i=function(n){n.tmp.jump.pop()}),this.execs.push(i),t.push(this)},configure:function(e,t){this.tokentype===u.END?(e.configure.fail.push(t),e.configure.succeed.push(t)):(e.configure.fail.pop(),e.configure.succeed.pop())}};u.Node.citation={build:function(e,t){if(this.tokentype===u.START){e.build.area="citation",e.build.root="citation",e.build.extension="";var i=function(r){r.tmp.area="citation",r.tmp.root="citation",r.tmp.extension=""};this.execs.push(i)}if(this.tokentype===u.END){if(e.opt.grouped_sort=e.opt.xclass==="in-text"&&e.citation.opt.collapse&&e.citation.opt.collapse.length||e.citation.opt.cite_group_delimiter&&e.citation.opt.cite_group_delimiter.length&&e.opt.update_mode!==u.POSITION&&e.opt.update_mode!==u.NUMERIC,e.opt.grouped_sort&&e.citation_sort.opt.sort_directions.length){var n=e.citation_sort.opt.sort_directions[0].slice();e.citation_sort.opt.sort_directions=[n].concat(e.citation_sort.opt.sort_directions)}e.citation.srt=new u.Registry.Comparifier(e,"citation_sort")}t.push(this)}};u.Node["#comment"]={build:function(){}};u.Node.date={build:function(e,t){var i,n,r,a,o,l,c,f,p,m;(this.tokentype===u.START||this.tokentype===u.SINGLETON)&&(e.dateput.string(e,e.dateput.queue),e.tmp.date_token=u.Util.cloneToken(this),e.tmp.date_token.strings.prefix="",e.tmp.date_token.strings.suffix="",e.dateput.openLevel(this),e.build.date_parts=[],e.build.date_variables=this.variables,e.build.extension||u.Util.substituteStart.call(this,e,t),e.build.extension?i=u.dateMacroAsSortKey:i=function(d,h,v){var b;if(d.tmp.element_rendered_ok=!1,d.tmp.donesies=[],d.tmp.dateparts=[],b=[],this.variables.length&&!(d.tmp.just_looking&&this.variables[0]==="accessed")){for(n=h[this.variables[0]],typeof n>"u"&&(n={"date-parts":[[0]]},d.opt.development_extensions.locator_date_and_revision&&v&&this.variables[0]==="locator-date"&&v["locator-date"]&&(n=v["locator-date"])),d.tmp.date_object=n,r=this.dateparts.length,a=0;a<r;a+=1)o=this.dateparts[a],(typeof d.tmp.date_object[o+"_end"]<"u"||o==="month"&&typeof d.tmp.date_object.season_end<"u")&&b.push(o);for(l=[],c=["year","month","day"],r=c.length,a=0;a<r;a+=1)b.indexOf(c[a])>-1&&l.push(c[a]);for(b=l.slice(),f=2,r=b.length,a=0;a<r;a+=1)if(o=b[a],p=d.tmp.date_object[o],m=d.tmp.date_object[o+"_end"],p!==m){f=a;break}d.tmp.date_collapse_at=b.slice(f)}else d.tmp.date_object=!1},this.execs.push(i),i=function(d,h){if(h[this.variables[0]]&&(d.output.startTag("date",this),this.variables[0]==="issued"&&(h.type==="legal_case"||h.type==="legislation")&&d.opt.disable_duplicate_year_suppression.indexOf(h.country)===-1&&!d.tmp.extension&&""+h["collection-number"]==""+d.tmp.date_object.year&&this.dateparts.length===1&&this.dateparts[0]==="year")){for(var v in d.tmp.date_object)if(d.tmp.date_object.hasOwnProperty(v)&&v.slice(0,4)==="year"){d.tmp.issued_date={};var b=d.output.current.mystack.slice(-2)[0].blobs;d.tmp.issued_date.list=b,d.tmp.issued_date.pos=b.length-1}}},this.execs.push(i)),!e.build.extension&&(this.tokentype===u.END||this.tokentype===u.SINGLETON)&&(i=function(d,h){h[this.variables[0]]&&d.output.endTag()},this.execs.push(i)),t.push(this),(this.tokentype===u.END||this.tokentype===u.SINGLETON)&&(e.build.extension||u.Util.substituteEnd.call(this,e,t))}};u.Node["date-part"]={build:function(e,t){var i,n,r,a,o,l,c,f,p,m,d,h,v,b,y,g,x,k,w,C,E;this.strings.form||(this.strings.form="long"),e.build.date_parts.push(this.strings.name);var B=e.build.date_variables[0];function _(S,T,D){if(!D)return D;if(D=""+u.Util.Dates[this.strings.name][S](e,D,T,this.default_locale),this.strings.name==="month"){if(e.tmp.strip_periods)D=D.replace(/\./g,"");else for(var H=0,V=this.decorations.length;H<V;H+=1)if(this.decorations[H][0]==="@strip-periods"&&this.decorations[H][1]==="true"){D=D.replace(/\./g,"");break}}return D}i=function(S,T){if(S.tmp.date_object)S.tmp.probably_rendered_something=!0;else return;var D="";if(a=!0,o="",l="",S.tmp.donesies.push(this.strings.name),S.tmp.date_object.literal&&this.strings.name==="year"&&(D=S.tmp.date_object.literal,S.output.append(S.tmp.date_object.literal,this)),S.tmp.date_object&&(o=S.tmp.date_object[this.strings.name],l=S.tmp.date_object[this.strings.name+"_end"]),this.strings.name==="year"&&o===0&&!S.tmp.suppress_decorations&&(o=!1),c=!S.tmp.suppress_decorations,f=S.tmp.have_collapsed,p=S[S.tmp.area].opt.collapse==="year-suffix"||S[S.tmp.area].opt.collapse==="year-suffix-ranged",m=S.opt["disambiguate-add-year-suffix"],c&&m&&p&&(S.tmp.years_used.push(o),d=S.tmp.last_years_used.length>=S.tmp.years_used.length,d&&f&&S.tmp.last_years_used[S.tmp.years_used.length-1]===o&&(o=!1)),typeof o<"u"){h=!1,v=!1,this.strings.name==="year"&&(parseInt(o,10)<500&&parseInt(o,10)>0&&(v=S.getTerm("ad")),parseInt(o,10)<0&&(h=S.getTerm("bc"),o=parseInt(o,10)*-1),l&&(parseInt(l,10)<500&&parseInt(l,10)>0&&S.getTerm("ad"),parseInt(l,10)<0&&(S.getTerm("bc"),l=parseInt(l,10)*-1)));for(var H=""+S.tmp.date_object.month;H.length<2;)H="0"+H;H="month-"+H;var V=S.locale[S.opt.lang]["noun-genders"][H];if(this.strings.form){var M=this.strings.form,$=this.strings.form;this.strings.name==="day"&&M==="ordinal"&&S.locale[S.opt.lang].opts["limit-day-ordinals-to-day-1"]&&(o!=1&&(M="numeric"),l!=1&&($="numeric")),o=_.call(this,M,V,o),l=_.call(this,$,V,l)}if(S.output.openLevel("empty"),S.tmp.date_collapse_at.length){for(b=!0,r=S.tmp.date_collapse_at.length,n=0;n<r;n+=1)if(C=S.tmp.date_collapse_at[n],S.tmp.donesies.indexOf(C)===-1){b=!1;break}if(b){if(""+l!="0"){if(S.dateput.queue.length===0&&(a=!0),S.opt["year-range-format"]&&S.opt["year-range-format"]!=="expanded"&&!S.tmp.date_object.day&&!S.tmp.date_object.month&&!S.tmp.date_object.season&&this.strings.name==="year"&&o&&l){l=S.fun.year_mangler(o+"-"+l,!0);var P=S.getTerm("year-range-delimiter");l=l.slice(l.indexOf(P)+1)}D=l,S.dateput.append(l,this),a&&(E=S.dateput.current.value().blobs[0],E&&(E.strings.prefix=""))}D=o,S.output.append(o,this),y=S.output.current.value(),E=y.blobs[y.blobs.length-1],E&&(E.strings.suffix=""),this.strings["range-delimiter"]?S.output.append(this.strings["range-delimiter"]):S.output.append(S.getTerm("year-range-delimiter"),"empty"),S.dateput.closeLevel(),g=S.dateput.current.value(),y.blobs=y.blobs.concat(g),S.dateput.string(S,S.dateput.queue),S.dateput.openLevel(S.tmp.date_token),S.tmp.date_collapse_at=[]}else D=o,S.output.append(o,this),S.tmp.date_collapse_at.indexOf(this.strings.name)>-1&&""+l!="0"&&(S.dateput.queue.length===0&&(a=!0),S.dateput.openLevel("empty"),D=l,S.dateput.append(l,this),a&&(E=S.dateput.current.value().blobs[0],E&&(E.strings.prefix="")),h&&(D=h,S.dateput.append(h)),v&&(D=v,S.dateput.append(v)),S.dateput.closeLevel())}else D=o,S.output.append(o,this);h&&(D=h,S.output.append(h)),v&&(D=v,S.output.append(v)),S.output.closeLevel()}else this.strings.name==="month"&&S.tmp.date_object.season&&(o=""+S.tmp.date_object.season,o&&o.match(/^[1-4]$/)?(S.tmp.group_context.tip.variable_success=!0,D="winter",S.output.append(S.getTerm("season-0"+o),this)):o&&(D=o,S.output.append(o,this)));S.tmp.value=[],T[B]&&(o||S.tmp.have_collapsed)&&!S.opt.has_year_suffix&&this.strings.name==="year"&&!S.tmp.just_looking&&S.registry.registry[T.id]&&S.registry.registry[T.id].disambig.year_suffix!==!1&&!S.tmp.has_done_year_suffix&&(S.tmp.has_done_year_suffix=!0,D="x",k=parseInt(S.registry.registry[T.id].disambig.year_suffix,10),x=new u.NumericBlob(S,!1,k,this,T.id),this.successor_prefix=S[S.build.area].opt.layout_delimiter,this.splice_prefix=S[S.build.area].opt.layout_delimiter,w=new u.Util.Suffixator(u.SUFFIX_CHARS),x.setFormatter(w),S[S.tmp.area].opt.collapse==="year-suffix-ranged"&&(x.range_prefix=S.getTerm("citation-range-delimiter")),S[S.tmp.area].opt.cite_group_delimiter?x.successor_prefix=S[S.tmp.area].opt.cite_group_delimiter:S[S.tmp.area].opt["year-suffix-delimiter"]?x.successor_prefix=S[S.tmp.area].opt["year-suffix-delimiter"]:x.successor_prefix=S[S.tmp.area].opt.layout_delimiter,x.UGLY_DELIMITER_SUPPRESS_HACK=!0,S.output.append(x,"literal")),D&&!S.tmp.group_context.tip.condition&&(S.tmp.just_did_number=D.match(/[0-9]$/),S.output.current.tip.strings.suffix&&(S.tmp.just_did_number=!1))},this.execs.push(i),t.push(this)}};u.Node["else-if"]={build:function(e,t){u.Conditions.TopNode.call(this,e,t),t.push(this)},configure:function(e,t){u.Conditions.Configure.call(this,e,t)}};u.Node.else={build:function(e,t){t.push(this)},configure:function(e,t){this.tokentype===u.START&&(e.configure.fail[e.configure.fail.length-1]=t)}};u.Node["et-al"]={build:function(e,t){if(e.build.area==="citation"||e.build.area==="bibliography"){var i=function(n){n.tmp.etal_node=this,typeof this.strings.term=="string"&&(n.tmp.etal_term=this.strings.term)};this.execs.push(i)}t.push(this)}};u.Node.group={build:function(e,t,i){var n,r;if(this.realGroup=i,this.tokentype===u.START&&(u.Util.substituteStart.call(this,e,t),e.build.substitute_level.value()&&e.build.substitute_level.replace(e.build.substitute_level.value()+1),this.juris||t.push(this),n=function(d){if(d.output.startTag("group",this),this.strings.label_form_override&&(d.tmp.group_context.tip.label_form||(d.tmp.group_context.tip.label_form=this.strings.label_form_override)),this.strings.label_capitalize_if_first_override&&(d.tmp.group_context.tip.label_capitalize_if_first||(d.tmp.group_context.tip.label_capitalize_if_first=this.strings.label_capitalize_if_first_override)),this.realGroup){d.tmp.group_context.tip.condition&&u.UPDATE_GROUP_CONTEXT_CONDITION(d,this.strings.prefix,null,this);var h=!1,v=!1;d.tmp.group_context.mystack.length&&(d.output.current.value().parent=d.tmp.group_context.tip.output_tip);var b=d.tmp.group_context.tip.label_form;b||(b=this.strings.label_form_override);var y=d.tmp.group_context.tip.label_capitalize_if_first;y||(y=this.strings.label_capitalize_if_first),d.tmp.group_context.tip.condition?(h=d.tmp.group_context.tip.condition,v=d.tmp.group_context.tip.force_suppress):this.strings.reject?h={test:this.strings.reject,not:!0}:this.strings.require&&(h={test:this.strings.require,not:!1});var g={old_term_predecessor:d.tmp.term_predecessor,term_intended:!1,variable_attempt:!1,variable_success:!1,variable_success_parent:d.tmp.group_context.tip.variable_success,output_tip:d.output.current.tip,label_form:b,label_static:d.tmp.group_context.tip.label_static,label_capitalize_if_first:y,parallel_delimiter_override:this.strings.set_parallel_delimiter_override,parallel_delimiter_override_on_suppress:this.strings.set_parallel_delimiter_override_on_suppress,condition:h,force_suppress:v,done_vars:d.tmp.group_context.tip.done_vars.slice()};if(this.non_parallel){var x=d.tmp.group_context.tip.non_parallel;x||(x={}),Object.assign(x,this.non_parallel),g.non_parallel=x}if(this.parallel_first){var k=d.tmp.group_context.tip.parallel_first;k||(k={}),Object.assign(k,this.parallel_first),g.parallel_first=k}if(this.parallel_last){var w=d.tmp.group_context.tip.parallel_last;w||(w={}),Object.assign(w,this.parallel_last),g.parallel_last=w}if(d.tmp.abbrev_trimmer&&d.tmp.abbrev_trimmer.LAST_TO_FIRST&&g.parallel_last){g.parallel_first||(g.parallel_first={});for(var C in d.tmp.abbrev_trimmer.LAST_TO_FIRST)g.parallel_last[C]&&(g.parallel_first[C]=!0,delete g.parallel_last[C])}if(d.tmp.group_context.push(g),d.tmp.abbrev_trimmer&&this.parallel_last_to_first){d.tmp.abbrev_trimmer.LAST_TO_FIRST||(d.tmp.abbrev_trimmer.LAST_TO_FIRST={});for(var C in this.parallel_last_to_first)d.tmp.abbrev_trimmer.LAST_TO_FIRST[C]=!0}}},r=[],r.push(n),this.execs=r.concat(this.execs),this.strings["has-publisher-and-publisher-place"]&&(e.build["publisher-special"]=!0,this.strings["subgroup-delimiter"]&&(n=function(d,h){if(h.publisher&&h["publisher-place"]){var v=h.publisher.split(/;\s*/),b=h["publisher-place"].split(/;\s*/);v.length>1&&v.length===b.length&&(d.publisherOutput=new u.PublisherOutput(d,this),d.publisherOutput["publisher-list"]=v,d.publisherOutput["publisher-place-list"]=b)}},this.execs.push(n))),this.juris)){var a=new u.Token("choose",u.START);u.Node.choose.build.call(a,e,t);var o=new u.Token("if",u.START);n=function(d){return function(h,v){return u.INIT_JURISDICTION_MACROS(e,h,v,d)}}(this.juris),o.tests||(o.tests=[]),o.tests.push(n),o.test=e.fun.match.any(o,e,o.tests),t.push(o);var l=new u.Token("text",u.SINGLETON);n=function(d,h,v){var b=h;v&&v["best-jurisdiction"]&&this.juris==="juris-locator"&&(b=v);var y=0;if(d.juris[b["best-jurisdiction"]][this.juris])for(;y<d.juris[b["best-jurisdiction"]][this.juris].length;)y=u.tokenExec.call(d,d.juris[b["best-jurisdiction"]][this.juris][y],h,v)},l.juris=this.juris,l.execs.push(n),t.push(l);var c=new u.Token("if",u.END);u.Node.if.build.call(c,e,t);var f=new u.Token("else",u.START);u.Node.else.build.call(f,e,t)}if(this.tokentype===u.END&&(e.build["publisher-special"]&&(e.build["publisher-special"]=!1,n=function(d){d.publisherOutput&&(d.publisherOutput.render(),d.publisherOutput=!1)},this.execs.push(n)),n=function(d,h,v){if(d.tmp.group_context.tip.condition||d.output.current.tip.strings.suffix&&(d.tmp.just_did_number=!1),d.output.endTag(),this.realGroup){var b=d.tmp.group_context.pop();if(b.parallel_delimiter_override&&(d.tmp.group_context.tip.parallel_delimiter_override=b.parallel_delimiter_override,!d.tmp.just_looking&&d.registry.registry[h.id].master&&(d.registry.registry[h.id].parallel_delimiter_override=b.parallel_delimiter_override)),b.parallel_delimiter_override_on_suppress&&(d.tmp.group_context.tip.parallel_delimiter_override_on_suppress=b.parallel_delimiter_override_on_suppress),d.tmp.area==="bibliography_sort"){var y=b.done_vars.indexOf("citation-number");this.strings.sort_direction&&y>-1&&d.tmp.group_context.length()==1&&(this.strings.sort_direction===u.DESCENDING?d.bibliography_sort.opt.citation_number_sort_direction=u.DESCENDING:d.bibliography_sort.opt.citation_number_sort_direction=u.ASCENDING,b.done_vars=b.done_vars.slice(0,y).concat(b.done_vars.slice(y+1)))}if(b.condition&&(b.force_suppress=u.EVALUATE_GROUP_CONDITION(d,b)),d.tmp.group_context.tip.condition&&(d.tmp.group_context.tip.force_suppress=b.force_suppress),!b.force_suppress&&(b.variable_success||b.term_intended&&!b.variable_attempt)){this.isJurisLocatorLabel||(d.tmp.group_context.tip.variable_success=!0);var g=d.output.current.value().blobs;if(d.output.current.value().blobs.length-1,!d.tmp.just_looking&&(b.non_parallel||b.parallel_last||b.parallel_first||b.parallel_delimiter_override||b.parallel_delimiter_override_on_suppress)){var x=d.parallel.checkRepeats(b);if(x&&g&&g.pop(),d.tmp.cite_index>0&&(x||!b.parallel_first&&!b.parallel_last&&!b.non_parallel)){var k=d.tmp.suppress_repeats[d.tmp.cite_index-1];x&&b.parallel_delimiter_override_on_suppress&&(k.SIBLING||k.ORPHAN)?d.output.queue.slice(-1)[0].parallel_delimiter=b.parallel_delimiter_override_on_suppress:b.parallel_delimiter_override&&k.SIBLING&&(d.output.queue.slice(-1)[0].parallel_delimiter=b.parallel_delimiter_override)}}}else{if(d.tmp.term_predecessor=b.old_term_predecessor,d.tmp.group_context.tip.variable_attempt=b.variable_attempt,b.force_suppress&&!d.tmp.group_context.tip.condition&&(d.tmp.group_context.tip.variable_attempt=!0,d.tmp.group_context.tip.variable_success=b.variable_success_parent),b.force_suppress)for(var w=0,C=b.done_vars.length;w<C;w++)for(var E=b.done_vars[w],B=0,_=d.tmp.done_vars.length;B<_;B++)d.tmp.done_vars[B]===E&&(d.tmp.done_vars=d.tmp.done_vars.slice(0,B).concat(d.tmp.done_vars.slice(B+1)));d.output.current.value().blobs&&d.output.current.value().blobs.pop()}}},this.execs.push(n),this.juris)){var p=new u.Token("else",u.END);u.Node.else.build.call(p,e,t);var m=new u.Token("choose",u.END);u.Node.choose.build.call(m,e,t)}this.tokentype===u.END&&(this.juris||t.push(this),e.build.substitute_level.value()&&e.build.substitute_level.replace(e.build.substitute_level.value()-1),u.Util.substituteEnd.call(this,e,t))}};u.Node.if={build:function(e,t){u.Conditions.TopNode.call(this,e,t),t.push(this)},configure:function(e,t){u.Conditions.Configure.call(this,e,t)}};u.Node.conditions={build:function(e){this.tokentype===u.START&&e.tmp.conditions.addMatch(this.match),this.tokentype===u.END&&e.tmp.conditions.matchCombine()}};u.Node.condition={build:function(e){if(this.tokentype===u.SINGLETON){var t=e.fun.match[this.match](this,e,this.tests);e.tmp.conditions.addTest(t)}}};u.Conditions={};u.Conditions.TopNode=function(e){var t;(this.tokentype===u.START||this.tokentype===u.SINGLETON)&&(this.locale&&(e.opt.lang=this.locale),!this.tests||!this.tests.length?e.tmp.conditions=new u.Conditions.Engine(e,this):this.test=e.fun.match[this.match](this,e,this.tests),e.build.substitute_level.value()===0&&(t=function(i){i.tmp.condition_counter++},this.execs.push(t))),(this.tokentype===u.END||this.tokentype===u.SINGLETON)&&(e.build.substitute_level.value()===0&&(t=function(i){if(i.tmp.condition_counter--,i.tmp.condition_lang_counter_arr.length>0){var n=i.tmp.condition_lang_counter_arr.slice(-1)[0];n===i.tmp.condition_counter&&(i.opt.lang=i.tmp.condition_lang_val_arr.pop(),i.tmp.condition_lang_counter_arr.pop())}this.locale_default&&(i.output.current.value().old_locale=this.locale_default,i.output.closeLevel("empty"),i.opt.lang=this.locale_default)},this.execs.push(t)),t=function(i){var n=this[i.tmp.jump.value()];return n},this.execs.push(t),this.locale_default&&(e.opt.lang=this.locale_default))};u.Conditions.Configure=function(e,t){this.tokentype===u.START?(this.fail=e.configure.fail.slice(-1)[0],this.succeed=this.next,e.configure.fail[e.configure.fail.length-1]=t):this.tokentype===u.SINGLETON?(this.fail=this.next,this.succeed=e.configure.succeed.slice(-1)[0],e.configure.fail[e.configure.fail.length-1]=t):(this.succeed=e.configure.succeed.slice(-1)[0],this.fail=this.next)};u.Conditions.Engine=function(e,t){this.token=t,this.state=e};u.Conditions.Engine.prototype.addTest=function(e){this.token.tests||(this.token.tests=[]),this.token.tests.push(e)};u.Conditions.Engine.prototype.addMatch=function(e){this.token.match=e};u.Conditions.Engine.prototype.matchCombine=function(){this.token.test=this.state.fun.match[this.token.match](this.token,this.state,this.token.tests)};u.Node.info={build:function(e){this.tokentype===u.START?e.build.skip="info":e.build.skip=!1}};u.Node.institution={build:function(e,t){if([u.SINGLETON,u.START].indexOf(this.tokentype)>-1){var i=function(n){typeof this.strings.delimiter=="string"?n.tmp.institution_delimiter=this.strings.delimiter:n.tmp.institution_delimiter=n.tmp.name_delimiter,n.inheritOpt(this,"and")==="text"?this.and_term=n.getTerm("and","long",0):n.inheritOpt(this,"and")==="symbol"?n.opt.development_extensions.expect_and_symbol_form?this.and_term=n.getTerm("and","symbol",0):this.and_term="&":n.inheritOpt(this,"and")==="none"&&(this.and_term=n.tmp.institution_delimiter),typeof this.and_term>"u"&&n.tmp.and_term&&(this.and_term=n.tmp.and_term),u.STARTSWITH_ROMANESQUE_REGEXP.test(this.and_term)?(this.and_prefix_single=" ",this.and_prefix_multiple=", ",typeof n.tmp.institution_delimiter=="string"&&(this.and_prefix_multiple=n.tmp.institution_delimiter),this.and_suffix=" "):(this.and_prefix_single="",this.and_prefix_multiple="",this.and_suffix=""),n.inheritOpt(this,"delimiter-precedes-last")==="always"?this.and_prefix_single=n.tmp.institution_delimiter:n.inheritOpt(this,"delimiter-precedes-last")==="never"&&this.and_prefix_multiple&&(this.and_prefix_multiple=" "),this.and={},typeof this.and_term<"u"?(n.output.append(this.and_term,"empty",!0),this.and.single=n.output.pop(),this.and.single.strings.prefix=this.and_prefix_single,this.and.single.strings.suffix=this.and_suffix,n.output.append(this.and_term,"empty",!0),this.and.multiple=n.output.pop(),this.and.multiple.strings.prefix=this.and_prefix_multiple,this.and.multiple.strings.suffix=this.and_suffix):this.strings.delimiter!=="undefined"&&(this.and.single=new u.Blob(n.tmp.institution_delimiter),this.and.single.strings.prefix="",this.and.single.strings.suffix="",this.and.multiple=new u.Blob(n.tmp.institution_delimiter),this.and.multiple.strings.prefix="",this.and.multiple.strings.suffix=""),n.nameOutput.institution=this};this.execs.push(i)}t.push(this)},configure:function(e){[u.SINGLETON,u.START].indexOf(this.tokentype)>-1&&(e.build.has_institution=!0)}};u.Node["institution-part"]={build:function(e,t){var i;this.strings.name==="long"?this.strings["if-short"]?i=function(n){n.nameOutput.institutionpart["long-with-short"]=this}:i=function(n){n.nameOutput.institutionpart.long=this}:this.strings.name==="short"&&(i=function(n){n.nameOutput.institutionpart.short=this}),this.execs.push(i),t.push(this)}};u.Node.key={build:function(e,t){t=e[e.build.root+"_sort"].tokens;var i,n=new u.Token("key",u.START);e.tmp.root=e.build.root,n.strings["et-al-min"]=e.inheritOpt(this,"et-al-min"),n.strings["et-al-use-first"]=e.inheritOpt(this,"et-al-use-first"),n.strings["et-al-use-last"]=e.inheritOpt(this,"et-al-use-last"),i=function(g){g.tmp.done_vars=[]},n.execs.push(i),i=function(g){g.output.openLevel("empty")},n.execs.push(i);var r=[];if(this.strings.sort_direction===u.DESCENDING?(r.push(1),r.push(-1)):(r.push(-1),r.push(1)),e[e.build.area].opt.sort_directions.push(r),u.DATE_VARIABLES.indexOf(this.variables[0])>-1&&(e.build.date_key=!0),i=function(g){g.tmp.sort_key_flag=!0,g.inheritOpt(this,"et-al-min")&&(g.tmp["et-al-min"]=g.inheritOpt(this,"et-al-min")),g.inheritOpt(this,"et-al-use-first")&&(g.tmp["et-al-use-first"]=g.inheritOpt(this,"et-al-use-first")),typeof g.inheritOpt(this,"et-al-use-last")=="boolean"&&(g.tmp["et-al-use-last"]=g.inheritOpt(this,"et-al-use-last"))},n.execs.push(i),t.push(n),this.variables.length){var a=this.variables[0];if(u.NAME_VARIABLES.indexOf(a)>-1){var o=new u.Token("names",u.START);o.tokentype=u.START,o.variables=this.variables,u.Node.names.build.call(o,e,t);var l=new u.Token("name",u.SINGLETON);l.tokentype=u.SINGLETON,l.strings["name-as-sort-order"]="all",l.strings["sort-separator"]=" ",l.strings["et-al-use-last"]=e.inheritOpt(this,"et-al-use-last"),l.strings["et-al-min"]=e.inheritOpt(this,"et-al-min"),l.strings["et-al-use-first"]=e.inheritOpt(this,"et-al-use-first"),u.Node.name.build.call(l,e,t);var c=new u.Token("institution",u.SINGLETON);c.tokentype=u.SINGLETON,u.Node.institution.build.call(c,e,t);var f=new u.Token("names",u.END);f.tokentype=u.END,u.Node.names.build.call(f,e,t)}else{var p=new u.Token("text",u.SINGLETON);if(p.strings.sort_direction=this.strings.sort_direction,p.dateparts=this.dateparts,u.NUMERIC_VARIABLES.indexOf(a)>-1)a==="citation-number"?i=function(g,x){if(g.tmp.area==="bibliography_sort"&&(this.strings.sort_direction===u.DESCENDING?g.bibliography_sort.opt.citation_number_sort_direction=u.DESCENDING:g.bibliography_sort.opt.citation_number_sort_direction=u.ASCENDING),g.tmp.area==="citation_sort"&&g.bibliography_sort.tmp.citation_number_map)var k=g.bibliography_sort.tmp.citation_number_map[g.registry.registry[x.id].seq];else var k=g.registry.registry[x.id].seq;k&&(k=u.Util.padding(""+k)),g.output.append(k,this)}:i=function(g,x){var k=!1;k=x[a],k&&(k=u.Util.padding(k)),g.output.append(k,this)};else if(a==="citation-label")i=function(g,x){var k=g.getCitationLabel(x);g.output.append(k,this)};else if(u.DATE_VARIABLES.indexOf(a)>-1)i=u.dateAsSortKey,p.variables=this.variables;else if(a==="title"){var m="title",d=!1,h=!1,v=!0;i=e.transform.getOutputFunction(this.variables,m,d,h,v)}else a==="court-class"?i=function(g,x,k){u.INIT_JURISDICTION_MACROS(g,x,k,"juris-main");var w=u.GET_COURT_CLASS(g,x,!0);g.output.append(w,"empty")}:i=function(g,x){var k=x[a];g.output.append(k,"empty")};p.execs.push(i),t.push(p)}}else{var b=new u.Token("text",u.SINGLETON);b.strings.sort_direction=this.strings.sort_direction,b.postponed_macro=this.postponed_macro,u.expandMacro.call(e,b,t)}var y=new u.Token("key",u.END);i=function(g){var x=g.output.string(g,g.output.queue);g.sys.normalizeUnicode&&(x=g.sys.normalizeUnicode(x)),x=x?x.split(" ").join(g.opt.sort_sep)+g.opt.sort_sep:"",x===""&&(x=void 0),typeof x!="string"&&(x=void 0),g[g[g.tmp.area].root+"_sort"].keys.push(x),g.tmp.value=[]},y.execs.push(i),e.build.date_key&&(e.build.area==="citation"&&e.build.extension==="_sort"&&(e[e.build.area].opt.sort_directions.push([-1,1]),i=function(g,x){var k=g.registry.registry[x.id].disambig.year_suffix;k||(k=0);var w=u.Util.padding(""+k);g[g.tmp.area].keys.push(w)},y.execs.push(i)),e.build.date_key=!1),i=function(g){g.tmp["et-al-min"]=void 0,g.tmp["et-al-use-first"]=void 0,g.tmp["et-al-use-last"]=void 0,g.tmp.sort_key_flag=!1},y.execs.push(i),t.push(y)}};u.Node.label={build:function(e,t){if(this.strings.term){var i=function(l,c,f){var p=u.evaluateLabel(this,l,c,f);f&&this.strings.term==="locator"&&(f.section_form_override=this.strings.form),p&&(l.tmp.group_context.tip.term_intended=!0),u.UPDATE_GROUP_CONTEXT_CONDITION(l,p,null,this),p.indexOf("%s")===-1&&(this.strings.capitalize_if_first&&!l.tmp.term_predecessor&&!(l.opt.class==="in-text"&&l.tmp.area==="citation")&&(p=u.Output.Formatters["capitalize-first"](l,p)),l.output.append(p,this))};this.execs.push(i)}else{this.strings.form||(this.strings.form="long");for(var n=e.build.names_variables[e.build.names_variables.length-1],r=e.build.name_label[e.build.name_label.length-1],a=0,o=n.length;a<o;a+=1)r[n[a]]||(r[n[a]]={});if(e.build.name_flag)for(var a=0,o=n.length;a<o;a+=1)r[n[a]].after=this;else for(var a=0,o=n.length;a<o;a+=1)r[n[a]].before=this}t.push(this)}};u.Node.layout={build:function(e,t){var i,n,r,a;function o(){e.build.area==="bibliography"&&(r=new u.Token("text",u.SINGLETON),i=function(f){if(!f.tmp.parallel_and_not_last){var p;f.tmp.cite_affixes[f.tmp.area][f.tmp.last_cite_locale]?p=f.tmp.cite_affixes[f.tmp.area][f.tmp.last_cite_locale].suffix:p=f.bibliography.opt.layout_suffix;var m=f.output.current.value();f.opt.using_display?m.blobs[m.blobs.length-1].strings.suffix=p:m.strings.suffix=p}f.bibliography.opt["second-field-align"]&&f.output.endTag("bib_other")},r.execs.push(i),t.push(r))}this.tokentype===u.START&&(this.locale_raw?e.build.current_default_locale=this.locale_raw:e.build.current_default_locale=e.opt["default-locale"],i=function(f,p,m){if(f.opt.development_extensions.apply_citation_wrapper&&f.sys.wrapCitationEntry&&!f.tmp.just_looking&&p.system_id&&f.tmp.area==="citation"){var d=new u.Token("group",u.START);d.decorations=[["@cite","entry"]],f.output.startTag("cite_entry",d),f.output.current.value().item_id=p.system_id,m&&(f.output.current.value().locator_txt=m.locator_txt,f.output.current.value().suffix_txt=m.suffix_txt)}},this.execs.push(i)),this.tokentype===u.START&&!e.tmp.cite_affixes[e.build.area]&&(i=function(f,p,m){if(f.tmp.done_vars=[],m&&m["author-only"]&&f.tmp.done_vars.push("locator"),f.opt.suppressedJurisdictions[p.country]&&p.country&&["treaty","patent"].indexOf(p.type)===-1&&f.tmp.done_vars.push("country"),!f.tmp.just_looking&&f.registry.registry[p.id]&&f.registry.registry[p.id].parallel&&f.tmp.done_vars.push("first-reference-note-number"),!f.tmp.just_looking&&f.tmp.abbrev_trimmer&&p.jurisdiction)for(var d in f.tmp.abbrev_trimmer.QUASHES[p.jurisdiction])f.tmp.done_vars.push(d);f.tmp.rendered_name=!1},this.execs.push(i),i=function(f){f.tmp.sort_key_flag=!1},this.execs.push(i),i=function(f){f.tmp.nameset_counter=0},this.execs.push(i),i=function(f,p){var m=new u.Token;f.output.openLevel(m)},this.execs.push(i),t.push(this),e.build.area==="citation"&&(n=new u.Token("text",u.SINGLETON),i=function(f,p,m){if(m&&m.prefix){var d=u.checkPrefixSpaceAppend(f,m.prefix);f.tmp.just_looking||(d=f.output.checkNestedBrace.update(d));var h=u.checkIgnorePredecessor(f,d);f.output.append(d,this,!1,h)}},n.execs.push(i),t.push(n)));var l;if(this.locale_raw&&(l=new u.Token("dummy",u.START),l.locale=this.locale_raw,l.strings.delimiter=this.strings.delimiter,l.strings.suffix=this.strings.suffix,e.tmp.cite_affixes[e.build.area]||(e.tmp.cite_affixes[e.build.area]={})),this.tokentype===u.START&&(e.build.layout_flag=!0,this.locale_raw||(e[e.tmp.area].opt.topdecor=[this.decorations],e[e.tmp.area+"_sort"].opt.topdecor=[this.decorations],e[e.build.area].opt.layout_prefix=this.strings.prefix,e[e.build.area].opt.layout_suffix=this.strings.suffix,e[e.build.area].opt.layout_delimiter=this.strings.delimiter,e[e.build.area].opt.layout_decorations=this.decorations,e.tmp.cite_affixes[e.build.area]&&(a=new u.Token("else",u.START),u.Node.else.build.call(a,e,t))),this.locale_raw)){if(e.build.layout_locale_flag)l.name="else-if",u.Attributes["@locale-internal"].call(l,e,this.locale_raw),u.Node["else-if"].build.call(l,e,t);else{var c=new u.Token("choose",u.START);u.Node.choose.build.call(c,e,t),l.name="if",u.Attributes["@locale-internal"].call(l,e,this.locale_raw),u.Node.if.build.call(l,e,t)}e.tmp.cite_affixes[e.build.area][l.locale]={},e.tmp.cite_affixes[e.build.area][l.locale].delimiter=this.strings.delimiter,e.tmp.cite_affixes[e.build.area][l.locale].suffix=this.strings.suffix}this.tokentype===u.END&&(this.locale_raw&&(o(),e.build.layout_locale_flag?(l.name="else-if",l.tokentype=u.END,u.Attributes["@locale-internal"].call(l,e,this.locale_raw),u.Node["else-if"].build.call(l,e,t)):(l.name="if",l.tokentype=u.END,u.Attributes["@locale-internal"].call(l,e,this.locale_raw),u.Node.if.build.call(l,e,t),e.build.layout_locale_flag=!0)),this.locale_raw||(o(),e.tmp.cite_affixes[e.build.area]&&e.build.layout_locale_flag&&(a=new u.Token("else",u.END),u.Node.else.build.call(a,e,t),a=new u.Token("choose",u.END),u.Node.choose.build.call(a,e,t)),e.build_layout_locale_flag=!0,e.build.area==="citation"&&(r=new u.Token("text",u.SINGLETON),i=function(f,p,m){if(m&&m.suffix){var d=u.checkSuffixSpacePrepend(f,m.suffix);f.tmp.just_looking||(d=f.output.checkNestedBrace.update(d)),f.output.append(d,this)}},r.execs.push(i),t.push(r)),i=function(f){f.output.closeLevel()},this.execs.push(i),i=function(f,p){f.opt.development_extensions.apply_citation_wrapper&&f.sys.wrapCitationEntry&&!f.tmp.just_looking&&p.system_id&&f.tmp.area==="citation"&&f.output.endTag()},this.execs.push(i),t.push(this),e.build.layout_flag=!1,e.build.layout_locale_flag=!1))}};u.Node.macro={build:function(){}};u.Node.alternative={build:function(e,t){if(this.tokentype===u.START){var i=new u.Token("choose",u.START);u.Node.choose.build.call(i,e,t);var n=new u.Token("if",u.START);u.Attributes["@alternative-node-internal"].call(n,e),u.Node.if.build.call(n,e,t);var r=function(a,o){if(a.tmp.oldItem=o,a.tmp.oldLang=a.opt.lang,a.tmp.abort_alternative=!0,o["language-name"]&&o["language-name-original"]){var l=JSON.parse(JSON.stringify(o));l.language=l["language-name"];var c=u.localeResolve(l.language,a.opt["default-locale"][0]);if(a.opt.multi_layout)for(var f in a.opt.multi_layout){var p=a.opt.multi_layout[f],m=!1;for(var d in p){var h=p[d];if(c.best===h.best||c.base===h.base||c.bare===h.bare){m=p[0].best;break}}m||(m=a.opt["default-locale"][0]),a.opt.lang=m}for(var v in l)if(["id","type","language","multi"].indexOf(v)===-1&&v.slice(0,4)!=="alt-")if(l.multi&&l.multi._keys[v]){var b=!0;for(var y in l.multi._keys[v])if(c.bare===y.replace(/^([a-zA-Z]+).*/,"$1")){b=!1;break}b&&delete l[v]}else delete l[v];for(var v in l)v.slice(0,4)==="alt-"?(l[v.slice(4)]=l[v],a.tmp.abort_alternative=!1):l.multi&&l.multi._keys&&!l["alt-"+v]&&l.multi._keys[v]&&(l.multi._keys[v][c.best]?(l[v]=l.multi._keys[v][c.best],a.tmp.abort_alternative=!1):l.multi._keys[v][c.base]?(l[v]=l.multi._keys[v][c.base],a.tmp.abort_alternative=!1):l.multi._keys[v][c.bare]&&(l[v]=l.multi._keys[v][c.bare],a.tmp.abort_alternative=!1))}a.output.openLevel(this),a.registry.refhash[o.id]=l,a.nameOutput=new u.NameOutput(a,l)};this.execs.push(r),t.push(this);var i=new u.Token("choose",u.START);u.Node.choose.build.call(i,e,t);var n=new u.Token("if",u.START);u.Attributes["@alternative-node-internal"].call(n,e);var r=function(a){a.tmp.abort_alternative=!0};n.execs.push(r),u.Node.if.build.call(n,e,t)}else if(this.tokentype===u.END){var n=new u.Token("if",u.END);u.Node.if.build.call(n,e,t);var i=new u.Token("choose",u.END);u.Node.choose.build.call(i,e,t);var r=function(c,f){c.output.closeLevel(),c.registry.refhash[f.id]=c.tmp.oldItem,c.opt.lang=c.tmp.oldLang,c.nameOutput=new u.NameOutput(c,c.tmp.oldItem),c.tmp.abort_alternative=!1};this.execs.push(r),t.push(this);var n=new u.Token("if",u.END);u.Node.if.build.call(n,e,t);var i=new u.Token("choose",u.END);u.Node.choose.build.call(i,e,t)}}};u.Node["alternative-text"]={build:function(e,t){if(this.tokentype===u.SINGLETON){var i=function(n,a){var a=n.refetchItem(a.id);u.getCite.call(n,a)};this.execs.push(i)}t.push(this)}};u.NameOutput=function(e,t,i){this.debug=!1,this.state=e,this.debug&&this.state.sys.print("(1)"),this.Item=t,this.item=i,this.nameset_base=0,this.etal_spec={},this._first_creator_variable=!1,this._please_chop=!1};u.NameOutput.prototype.init=function(e){this.requireMatch=e.requireMatch,this.state.tmp.term_predecessor&&(this.state.tmp.subsequent_author_substitute_ok=!1),this.nameset_offset&&(this.nameset_base=this.nameset_base+this.nameset_offset),this.nameset_offset=0,this.names=e,this.variables=e.variables,this.state.tmp.value=[],this.state.tmp.rendered_name=[],this.state.tmp.label_blob=!1,this.state.tmp.etal_node=!1,this.state.tmp.etal_term=!1;for(var t=0,i=this.variables.length;t<i;t+=1)this.Item[this.variables[t]]&&this.Item[this.variables[t]].length&&(this.state.tmp.value=this.state.tmp.value.concat(this.Item[this.variables[t]]));if(this["et-al"]=void 0,this.with=void 0,this.name=void 0,this.institutionpart={},this.state.tmp.group_context.tip.variable_attempt=!0,this.labelVariable=this.variables[0],!!this.state.tmp.value.length){var n=this.checkCommonAuthor(this.requireMatch);if(n){this.state.tmp.can_substitute.pop(),this.state.tmp.can_substitute.push(!0);for(var t in this.variables){var r=this.state.tmp.done_vars.indexOf(this.variables[t]);r>-1&&(this.state.tmp.done_vars=this.state.tmp.done_vars.slice(0,r).concat(this.state.tmp.done_vars.slice(t+1)))}this.state.tmp.common_term_match_fail=!0,this.variables=[]}}};u.NameOutput.prototype.reinit=function(e,t){if(this.requireMatch=e.requireMatch,this.labelVariable=t,this.state.tmp.can_substitute.value()){this.nameset_offset=0,this.variables=e.variables;var i=this.state.tmp.value.slice();this.state.tmp.value=[];for(var n=0,r=this.variables.length;n<r;n+=1)this.Item[this.variables[n]]&&this.Item[this.variables[n]].length&&(this.state.tmp.value=this.state.tmp.value.concat(this.Item[this.variables[n]]));this.state.tmp.value.length&&this.state.tmp.can_substitute.replace(!1,u.LITERAL),this.state.tmp.value=i}var a=this.checkCommonAuthor(this.requireMatch);if(a){this.state.tmp.can_substitute.pop(),this.state.tmp.can_substitute.push(!0);for(var n in this.variables){var o=this.state.tmp.done_vars.indexOf(this.variables[n]);o>-1&&(this.state.tmp.done_vars=this.state.tmp.done_vars.slice(0,o).concat(this.state.tmp.done_vars.slice(n+1)))}this.variables=[]}};u.NameOutput.prototype.outputNames=function(){var e,t,i=this.variables;if(this.institution.and&&((!this.institution.and.single.blobs||!this.institution.and.single.blobs.length)&&(this.institution.and.single.blobs=this.name.and.single.blobs),(!this.institution.and.multiple.blobs||!this.institution.and.multiple.blobs.length)&&(this.institution.and.multiple.blobs=this.name.and.multiple.blobs)),this.variable_offset={},this.family)for(this.family_decor=u.Util.cloneToken(this.family),this.family_decor.strings.prefix="",this.family_decor.strings.suffix="",e=0,t=this.family.execs.length;e<t;e+=1)this.family.execs[e].call(this.family_decor,this.state,this.Item);else this.family_decor=!1;if(this.given)for(this.given_decor=u.Util.cloneToken(this.given),this.given_decor.strings.prefix="",this.given_decor.strings.suffix="",e=0,t=this.given.execs.length;e<t;e+=1)this.given.execs[e].call(this.given_decor,this.state,this.Item);else this.given_decor=!1;if(this.debug&&this.state.sys.print("(2)"),this.getEtAlConfig(),this.debug&&this.state.sys.print("(3)"),this.divideAndTransliterateNames(),this.debug&&this.state.sys.print("(4)"),this.truncatePersonalNameLists(),this.debug&&this.state.sys.print("(5)"),this.debug&&this.state.sys.print("(6)"),this.disambigNames(),this.constrainNames(),this.debug&&this.state.sys.print("(7)"),this.name.strings.form==="count"){(this.state.tmp.extension||this.names_count!=0)&&(this.state.output.append(this.names_count,"empty"),this.state.tmp.group_context.tip.variable_success=!0);return}this.debug&&this.state.sys.print("(8)"),this.setEtAlParameters(),this.debug&&this.state.sys.print("(9)"),this.setCommonTerm(this.requireMatch),this.debug&&this.state.sys.print("(10)"),this.renderAllNames(),this.debug&&this.state.sys.print("(11)");var n=[];for(e=0,t=i.length;e<t;e+=1){var r=i[e],a=[],o=!1,l=null;if(!this.state.opt.development_extensions.spoof_institutional_affiliations)l=this._join([this.freeters[r]],"");else{this.debug&&this.state.sys.print("(11a)");for(var c=0,f=this.institutions[r].length;c<f;c+=1)a.push(this.joinPersonsAndInstitutions([this.persons[r][c],this.institutions[r][c]]));if(this.debug&&this.state.sys.print("(11b)"),this.institutions[r].length){var p=this.nameset_base+this.variable_offset[r];this.freeters[r].length&&(p+=1),o=this.joinInstitutionSets(a,p)}this.debug&&this.state.sys.print("(11c)");var l=this.joinFreetersAndInstitutionSets([this.freeters[r],o]);this.debug&&this.state.sys.print("(11d)")}if(l&&(this.state.tmp.extension||(l=this._applyLabels(l,r)),n.push(l)),this.debug&&this.state.sys.print("(11e)"),this.common_term)break}for(this.debug&&this.state.sys.print("(12)"),this.state.output.openLevel("empty"),this.state.output.current.value().strings.delimiter=this.state.inheritOpt(this.names,"delimiter","names-delimiter"),this.debug&&this.state.sys.print("(13)"),e=0,t=n.length;e<t;e+=1)this.state.output.append(n[e],"literal",!0);!this.state.tmp.just_looking&&n.length>0&&(this.state.tmp.probably_rendered_something=!0),this.debug&&this.state.sys.print("(14)"),this.state.output.closeLevel("empty"),this.debug&&this.state.sys.print("(15)");var m=this.state.output.pop();this.state.tmp.name_node.top=m,this.debug&&this.state.sys.print("(16)");var d=u.Util.cloneToken(this.names);if(this.state.tmp.group_context.tip.condition&&u.UPDATE_GROUP_CONTEXT_CONDITION(this.state,this.names.strings.prefix,null,this.names),this.state.output.append(m,d),this.state.tmp.term_predecessor_name&&(this.state.tmp.term_predecessor=!0),this.debug&&this.state.sys.print("(17)"),this.debug&&this.state.sys.print("(18)"),i[0]!=="authority"){var h=[],v=this.Item[i[0]];if(v)for(var e=0,t=v.length;e<t;e+=1){var b=u.Util.Names.getRawName(v[e]);b&&h.push(b)}h=h.join(", "),h&&(this.state.tmp.name_node.string=h)}if(this.state.tmp.name_node.string&&!this.state.tmp.first_name_string&&(this.state.tmp.first_name_string=this.state.tmp.name_node.string),this.Item.type==="classic"&&this.state.tmp.first_name_string){var y=[];y.push(this.state.tmp.first_name_string),this.Item.title&&y.push(this.Item.title),y=y.join(", "),y&&this.state.sys.getAbbreviation&&(this.state.sys.normalizeAbbrevsKey&&(y=this.state.sys.normalizeAbbrevsKey("classic",y)),this.state.transform.loadAbbreviation("default","classic",y,this.Item.language),this.state.transform.abbrevs.default.classic[y]&&(this.state.tmp.done_vars.push("title"),this.state.output.append(this.state.transform.abbrevs.default.classic[y],"empty",!0),m=this.state.output.pop(),this.state.tmp.name_node.top.blobs.pop(),this.state.tmp.name_node.top.blobs.push(m)))}this._collapseAuthor(),this.variables=[],this.state.tmp.authority_stop_last=0,this.debug&&this.state.sys.print("(19)")};u.NameOutput.prototype._applyLabels=function(e,t){var i;if(!this.label||!this.label[this.labelVariable])return e;var n=0,r=this.freeters_count[t]+this.institutions_count[t];if(r>1)n=1;else{for(var a=0,o=this.persons[t].length;a<o;a+=1)r+=this.persons_count[t][a];r>1&&(n=1)}return this.label[this.labelVariable].before?(typeof this.label[this.labelVariable].before.strings.plural=="number"&&(n=this.label[this.labelVariable].before.strings.plural),i=this._buildLabel(t,n,"before",this.labelVariable),this.state.output.openLevel("empty"),this.state.output.append(i,this.label[this.labelVariable].before,!0),this.state.output.append(e,"literal",!0),this.state.output.closeLevel("empty"),e=this.state.output.pop()):this.label[this.labelVariable].after&&(typeof this.label[this.labelVariable].after.strings.plural=="number"&&(n=this.label[this.labelVariable].after.strings.plural),i=this._buildLabel(t,n,"after",this.labelVariable),this.state.output.openLevel("empty"),this.state.output.append(e,"literal",!0),this.state.output.append(i,this.label[this.labelVariable].after,!0),this.state.tmp.label_blob=this.state.output.pop(),this.state.output.append(this.state.tmp.label_blob,"literal",!0),this.state.output.closeLevel("empty"),e=this.state.output.pop()),e};u.NameOutput.prototype._buildLabel=function(e,t,i,n){this.common_term&&(e=this.common_term);var r=!1,a=this.label[n][i];return a&&(r=u.castLabel(this.state,a,e,t,u.TOLERANT)),r};u.NameOutput.prototype._collapseAuthor=function(){var e,t,i;this.state.tmp.name_node.top.blobs.length!==0&&(this.nameset_base===0&&this.Item[this.variables[0]]&&!this._first_creator_variable&&(this._first_creator_variable=this.variables[0]),(this.state[this.state.tmp.area].opt.collapse&&this.state[this.state.tmp.area].opt.collapse.length||this.state[this.state.tmp.area].opt.cite_group_delimiter&&this.state[this.state.tmp.area].opt.cite_group_delimiter.length)&&(this.state.tmp.authorstring_request?(t="",e=this.state.tmp.name_node.top.blobs.slice(-1)[0].blobs,i=this.state.tmp.offset_characters,e&&(t=this.state.output.string(this.state,e,!1)),this.state.tmp.offset_characters=i,this.state.registry.authorstrings[this.Item.id]=t):!this.state.tmp.just_looking&&!this.state.tmp.suppress_decorations&&(this.state[this.state.tmp.area].opt.collapse&&this.state[this.state.tmp.area].opt.collapse.length||this.state[this.state.tmp.area].opt.cite_group_delimiter&&this.state[this.state.tmp.area].opt.cite_group_delimiter)&&(t="",e=this.state.tmp.name_node.top.blobs.slice(-1)[0].blobs,i=this.state.tmp.offset_characters,e&&(t=this.state.output.string(this.state,e,!1)),t===this.state.tmp.last_primary_names_string?((this.item["suppress-author"]||this.state[this.state.tmp.area].opt.collapse&&this.state[this.state.tmp.area].opt.collapse.length)&&(this.state.tmp.name_node.top.blobs.pop(),this.state.tmp.name_node.children=[],this.state.tmp.offset_characters=i),this.state[this.state.tmp.area].opt.cite_group_delimiter&&this.state[this.state.tmp.area].opt.cite_group_delimiter&&(this.state.tmp.use_cite_group_delimiter=!0)):(this.state.tmp.last_primary_names_string=t,this.variables.indexOf(this._first_creator_variable)>-1&&this.item&&this.item["suppress-author"]&&this.Item.type!=="legal_case"&&(this.state.tmp.name_node.top.blobs.pop(),this.state.tmp.name_node.children=[],this.state.tmp.offset_characters=i,this.state.tmp.term_predecessor=!1),this.state.tmp.have_collapsed=!1,this.state[this.state.tmp.area].opt.cite_group_delimiter&&this.state[this.state.tmp.area].opt.cite_group_delimiter&&(this.state.tmp.use_cite_group_delimiter=!1)))))};u.NameOutput.prototype.isPerson=function(e){return!(e.literal||!e.given&&e.family&&e.isInstitution)};u.NameOutput.prototype.truncatePersonalNameLists=function(){var e,t,i,n,r,a;this.freeters_count={},this.persons_count={},this.institutions_count={};for(e in this.freeters)this.freeters.hasOwnProperty(e)&&(this.freeters_count[e]=this.freeters[e].length,this.freeters[e]=this._truncateNameList(this.freeters,e));for(e in this.persons)if(this.persons.hasOwnProperty(e))for(this.institutions_count[e]=this.institutions[e].length,this._truncateNameList(this.institutions,e),this.persons[e]=this.persons[e].slice(0,this.institutions[e].length),this.persons_count[e]=[],n=0,r=this.persons[e].length;n<r;n+=1)this.persons_count[e][n]=this.persons[e][n].length,this.persons[e][n]=this._truncateNameList(this.persons,e,n);if(this.state.opt.development_extensions.etal_min_etal_usefirst_hack&&this.etal_min===1&&this.etal_use_first===1&&!(this.state.tmp.extension||this.state.tmp.just_looking)?a=e:a=!1,a||this._please_chop)for(t=0,i=this.variables.length;t<i;t+=1){e=this.variables[t],this.freeters[e].length&&(this._please_chop===e?(this.freeters[e]=this.freeters[e].slice(1),this.freeters_count[e]+=-1,this._please_chop=!1):a&&!this._please_chop&&(this.freeters[e]=this.freeters[e].slice(0,1),this.freeters_count[e]=1,this.institutions[e]=[],this.persons[e]=[],this._please_chop=a));for(var n=0,r=this.persons[e].length;n<r;n++)if(this.persons[e][n].length){if(this._please_chop===e){this.persons[e][n]=this.persons[e][n].slice(1),this.persons_count[e][n]+=-1,this._please_chop=!1;break}else if(a&&!this._please_chop){this.freeters[e]=this.persons[e][n].slice(0,1),this.freeters_count[e]=1,this.institutions[e]=[],this.persons[e]=[],this._please_chop=a;break}}this.institutions[e].length&&(this._please_chop===e?(this.institutions[e]=this.institutions[e].slice(1),this.institutions_count[e]+=-1,this._please_chop=!1):a&&!this._please_chop&&(this.institutions[e]=this.institutions[e].slice(0,1),this.institutions_count[e]=1,this._please_chop=a))}for(t=0,i=this.variables.length;t<i;t+=1){this.institutions[e].length&&(this.nameset_offset+=1);for(var n=0,r=this.persons[e].length;n<r;n++)this.persons[e][n].length&&(this.nameset_offset+=1)}};u.NameOutput.prototype._truncateNameList=function(e,t,i){var n;if(typeof i>"u"?n=e[t]:n=e[t][i],this.state[this.state[this.state.tmp.area].root].opt.max_number_of_names&&n.length>50&&n.length>this.state[this.state[this.state.tmp.area].root].opt.max_number_of_names+2){var r=this.state[this.state[this.state.tmp.area].root].opt.max_number_of_names;n=n.slice(0,r+1).concat(n.slice(-1))}return n};u.NameOutput.prototype.divideAndTransliterateNames=function(){var e,t,i,n,r=this.Item,a=this.variables;for(this.varnames=a.slice(),this.freeters={},this.persons={},this.institutions={},e=0,t=a.length;e<t;e+=1){var o=a[e];this.variable_offset[o]=this.nameset_offset;var l=this._normalizeVariableValue(r,o);if(this.name.strings["suppress-min"]&&l.length>=this.name.strings["suppress-min"]&&(l=[]),this.name.strings["suppress-max"]&&l.length<=this.name.strings["suppress-max"]&&(l=[]),this._getFreeters(o,l),this._getPersonsAndInstitutions(o,l),this.state.opt.development_extensions.spoof_institutional_affiliations){if(this.name.strings["suppress-min"]===0)for(this.freeters[o]=[],i=0,n=this.persons[o].length;i<n;i+=1)this.persons[o][i]=[];else if(this.institution.strings["suppress-min"]===0){for(this.institutions[o]=[],this.freeters[o]=this.freeters[o].concat(this.persons[o]),i=0,n=this.persons[o].length;i<n;i+=1)for(var c=0,f=this.persons[o][i].length;c<f;c+=1)this.freeters[o].push(this.persons[o][i][c]);this.persons[o]=[]}}}};u.NameOutput.prototype._normalizeVariableValue=function(e,t){var i;return typeof e[t]=="string"||typeof e[t]=="number"?(u.debug('name variable "'+t+'" is string or number, not array. Attempting to fix.'),i=[{literal:e[t]+""}]):e[t]?(typeof e[t].length!="number"&&(u.debug('name variable "'+t+'" is object, not array. Attempting to fix.'),e[t]=[e[t]]),i=e[t].slice()):i=[],i};u.NameOutput.prototype._getFreeters=function(e,t){if(this.freeters[e]=[],this.state.opt.development_extensions.spoof_institutional_affiliations)for(var i=t.length-1;i>-1&&this.isPerson(t[i]);i--){var n=this._checkNickname(t.pop());n&&this.freeters[e].push(n)}else for(var i=t.length-1;i>-1;i--){var n=t.pop();if(this.isPerson(n))var n=this._checkNickname(n);this.freeters[e].push(n)}this.freeters[e].reverse(),this.freeters[e].length&&(this.nameset_offset+=1)};u.NameOutput.prototype._getPersonsAndInstitutions=function(e,t){if(this.persons[e]=[],this.institutions[e]=[],!!this.state.opt.development_extensions.spoof_institutional_affiliations){for(var i=[],n=!1,r=!0,a=t.length-1;a>-1;a+=-1)if(this.isPerson(t[a])){var o=this._checkNickname(t[a]);o&&i.push(o)}else n=!0,this.institutions[e].push(t[a]),r||(i.reverse(),this.persons[e].push(i),i=[]),r=!1;n&&(i.reverse(),this.persons[e].push(i),this.persons[e].reverse(),this.institutions[e].reverse())}};u.NameOutput.prototype._clearValues=function(e){for(var t=e.length-1;t>-1;t+=-1)e.pop()};u.NameOutput.prototype._checkNickname=function(e){if(["interview","personal_communication"].indexOf(this.Item.type)>-1){var t="";if(t=u.Util.Names.getRawName(e),t&&this.state.sys.getAbbreviation&&!(this.item&&this.item["suppress-author"])){var i=t;this.state.sys.normalizeAbbrevsKey&&(i=this.state.sys.normalizeAbbrevsKey("author",t)),this.state.transform.loadAbbreviation("default","nickname",i,this.Item.language);var n=this.state.transform.abbrevs.default.nickname[i];n&&(n==="!here>>>"?e=!1:e={family:n,given:""})}}return e};u.NameOutput.prototype._purgeEmptyBlobs=function(e){for(var t=e.length-1;t>-1;t+=-1)(!e[t]||e[t].length===0||!e[t].blobs.length)&&(e=e.slice(0,t).concat(e.slice(t+1)));return e};u.NameOutput.prototype.joinPersons=function(e,t,i,n){var r;return e=this._purgeEmptyBlobs(e),typeof i>"u"?this.etal_spec[t].freeters===1?r=this._joinEtAl(e):this.etal_spec[t].freeters===2?r=this._joinEllipsis(e):this.state.tmp.sort_key_flag?r=this._join(e,this.state.inheritOpt(this.name,"delimiter","name-delimiter",", ")):r=this._joinAnd(e):this.etal_spec[t].persons[i]===1?r=this._joinEtAl(e):this.etal_spec[t].persons[i]===2?r=this._joinEllipsis(e):this.state.tmp.sort_key_flag?r=this._join(e,this.state.inheritOpt(this.name,"delimiter","name-delimiter",", ")):r=this._joinAnd(e),r};u.NameOutput.prototype.joinInstitutionSets=function(e,t){var i;return e=this._purgeEmptyBlobs(e),this.etal_spec[t].institutions===1?i=this._joinEtAl(e,"institution"):this.etal_spec[t].institutions===2?i=this._joinEllipsis(e,"institution"):i=this._joinAnd(e),i};u.NameOutput.prototype.joinPersonsAndInstitutions=function(e){e=this._purgeEmptyBlobs(e);var t=this._join(e,this.state.tmp.name_delimiter);return t.isInstitution=!0,t};u.NameOutput.prototype.joinFreetersAndInstitutionSets=function(e){e=this._purgeEmptyBlobs(e);var t=this._join(e,"[never here]",this.with.single,this.with.multiple);return t};u.NameOutput.prototype._getAfterInvertedName=function(e,t,i){if(i&&e.length>1&&this.state.inheritOpt(this.name,"delimiter-precedes-last")==="after-inverted-name"){var n=e[e.length-2];n.blobs.length>0&&n.blobs[0].isInverted&&(i.strings.prefix=t)}return i};u.NameOutput.prototype._getAndJoin=function(e,t){var i=!1;if(e.length>1){var n="single";e.length>2&&(n="multiple"),e[e.length-1].isInstitution?i=this.institution.and[n]:i=this.name.and[n],i=JSON.parse(JSON.stringify(i)),i=this._getAfterInvertedName(e,t,i)}return i};u.NameOutput.prototype._joinEtAl=function(e){var t=this.state.inheritOpt(this.name,"delimiter","name-delimiter",", "),i=this._join(e,t);return this.state.output.openLevel(this._getToken("name")),this.state.output.current.value().strings.delimiter="",this.state.output.append(i,"literal",!0),e.length>1?this.state.output.append(this["et-al"].multiple,"literal",!0):e.length===1&&this.state.output.append(this["et-al"].single,"literal",!0),this.state.output.closeLevel(),this.state.output.pop()};u.NameOutput.prototype._joinEllipsis=function(e){var t=this.state.inheritOpt(this.name,"delimiter","name-delimiter",", "),i=!1;if(e.length>1){var n="single";e.length>2&&(n="multiple"),i=JSON.parse(JSON.stringify(this.name.ellipsis[n])),i=this._getAfterInvertedName(e,t,i)}return this._join(e,t,i)};u.NameOutput.prototype._joinAnd=function(e){var t=this.state.inheritOpt(this.name,"delimiter","name-delimiter",", "),i=this._getAndJoin(e,t);return this._join(e,t,i)};u.NameOutput.prototype._join=function(e,t,i){var n,r;if(!e||(e=this._purgeEmptyBlobs(e),!e.length))return!1;if(e.length>1)if(e.length===2)i?e=[e[0],i,e[1]]:e[0].strings.suffix+=t;else{var a;i?a=1:a=0;for(var o=e.pop(),n=0,r=e.length-a;n<r;n++)e[n].strings.suffix+=t;e.push(i),e.push(o)}for(this.state.output.openLevel(),n=0,r=e.length;n<r;n+=1)this.state.output.append(e[n],!1,!0);return this.state.output.closeLevel(),this.state.output.pop()};u.NameOutput.prototype._getToken=function(e){var t=this[e];if(e==="institution"){var i=new u.Token;return i}return t};u.NameOutput.prototype.checkCommonAuthor=function(e){if(!e)return!1;var t=!1;if(this.variables.length===2){var i=this.variables,n=i.slice();n.sort(),t=n.join("")}if(!t)return!1;var r=!1;if(this.state.locale[this.state.opt.lang].terms[t]&&(r=!0),!r)return this.state.tmp.done_vars.push(this.variables[0]),this.state.tmp.done_vars.push(this.variables[1]),!1;var a=this.Item[this.variables[0]],o=this.Item[this.variables[1]],l=this._compareNamesets(a,o);return l===!0&&(this.state.tmp.done_vars.push(this.variables[0]),this.state.tmp.done_vars.push(this.variables[1])),!l};u.NameOutput.prototype.setCommonTerm=function(){var e=this.variables,t=e.slice();if(t.sort(),this.common_term=t.join(""),!!this.common_term){var i=!1;if(this.label&&this.label[this.variables[0]]&&(this.label[this.variables[0]].before?i=this.state.getTerm(this.common_term,this.label[this.variables[0]].before.strings.form,0):this.label[this.variables[0]].after&&(i=this.state.getTerm(this.common_term,this.label[this.variables[0]].after.strings.form,0))),!this.state.locale[this.state.opt.lang].terms[this.common_term]||!i||this.variables.length<2){this.common_term=!1;return}for(var n=0,r=this.variables.length-1;n<r;n+=1){var a=this.variables[n],o=this.variables[n+1];if((this.freeters[a].length||this.freeters[o].length)&&(this.etal_spec[a].freeters!==this.etal_spec[o].freeters||!this._compareNamesets(this.freeters[a],this.freeters[o]))){this.common_term=!1;return}if(this.persons[a].length!==this.persons[o].length){this.common_term=!1;return}for(var l=0,c=this.persons[a].length;l<c;l+=1)if(this.etal_spec[a].persons[l]!==this.etal_spec[o].persons[l]||!this._compareNamesets(this.persons[a][l],this.persons[o][l])){this.common_term=!1;return}}}};u.NameOutput.prototype._compareNamesets=function(e,t){if(!e||!t||e.length!==t.length)return!1;for(var i=0,n=t.length;i<n;i+=1)for(var r=0,a=u.NAME_PARTS.length;r<a;r+=1){var o=u.NAME_PARTS[r];if(!e[i]||e[i][o]!=t[i][o])return!1}return!0};u.NameOutput.prototype.constrainNames=function(){this.names_count=0;for(var e,t=0,i=this.variables.length;t<i;t+=1){var n=this.variables[t];e=this.nameset_base+t,this.freeters[n].length&&(this.state.tmp.names_max.push(this.freeters[n].length,"literal"),this._imposeNameConstraints(this.freeters,this.freeters_count,n,e),this.names_count+=this.freeters[n].length),this.institutions[n].length&&(this.state.tmp.names_max.push(this.institutions[n].length,"literal"),this._imposeNameConstraints(this.institutions,this.institutions_count,n,e),this.persons[n]=this.persons[n].slice(0,this.institutions[n].length),this.names_count+=this.institutions[n].length);for(var r=0,a=this.persons[n].length;r<a;r+=1)this.persons[n][r].length&&(this.state.tmp.names_max.push(this.persons[n][r].length,"literal"),this._imposeNameConstraints(this.persons[n],this.persons_count[n],r,e),this.names_count+=this.persons[n][r].length)}};u.NameOutput.prototype._imposeNameConstraints=function(e,t,i,n){var r=e[i],a=this.state.tmp["et-al-min"];this.state.tmp.suppress_decorations?this.state.tmp.disambig_request&&this.state.tmp.disambig_request.names[n]?a=this.state.tmp.disambig_request.names[n]:t[i]>=this.etal_min&&(a=this.etal_use_first):(this.state.tmp.disambig_request&&this.state.tmp.disambig_request.names[n]>this.etal_use_first?t[i]<this.etal_min?a=t[i]:a=this.state.tmp.disambig_request.names[n]:t[i]>=this.etal_min&&(a=this.etal_use_first),this.etal_use_last&&a>this.etal_min-2&&(a=this.etal_min-2));var o=this.etal_min>=this.etal_use_first,l=t[i]>a;a>t[i]&&(a=r.length),o&&l&&(this.etal_use_last?e[i]=r.slice(0,a).concat(r.slice(-1)):e[i]=r.slice(0,a)),this.state.tmp.disambig_settings.names[n]=e[i].length,this.state.disambiguate.padBase(this.state.tmp.disambig_settings)};u.NameOutput.prototype.disambigNames=function(){for(var e,t=0,i=this.variables.length;t<i;t+=1){var n=this.variables[t];if(e=this.nameset_base+t,this.freeters[n].length&&this._runDisambigNames(this.freeters[n],e),this.institutions[n].length){typeof this.state.tmp.disambig_settings.givens[e]>"u"&&(this.state.tmp.disambig_settings.givens[e]=[]);for(var r=0,a=this.institutions[n].length;r<a;r+=1)typeof this.state.tmp.disambig_settings.givens[e][r]>"u"&&this.state.tmp.disambig_settings.givens[e].push(2)}for(var r=0,a=this.persons[n].length;r<a;r+=1)this.persons[n][r].length&&this._runDisambigNames(this.persons[n][r],e)}};u.NameOutput.prototype._runDisambigNames=function(e,t){var i,n,r,a,o,l,c;for(o=0,l=e.length;o<l;o+=1)if(!(!e[o].given&&!e[o].family)){if(r=this.state.inheritOpt(this.name,"initialize-with"),this.state.registry.namereg.addname(""+this.Item.id,e[o],o),i=this.state.tmp.disambig_settings.givens[t],typeof i>"u")for(var f=0,p=t+1;f<p;f+=1)this.state.tmp.disambig_settings.givens[f]||(this.state.tmp.disambig_settings.givens[f]=[]);if(i=this.state.tmp.disambig_settings.givens[t][o],typeof i>"u"&&(n=this.state.inheritOpt(this.name,"form","name-form","long"),a=this.state.registry.namereg.evalname(""+this.Item.id,e[o],o,0,n,r),this.state.tmp.disambig_settings.givens[t].push(a)),n=this.state.inheritOpt(this.name,"form","name-form","long"),c=this.state.registry.namereg.evalname(""+this.Item.id,e[o],o,0,n,r),this.state.tmp.disambig_request){var m=this.state.tmp.disambig_settings.givens[t][o];m===1&&this.state.citation.opt["givenname-disambiguation-rule"]==="by-cite"&&(typeof this.state.inheritOpt(this.name,"initialize-with")>"u"||typeof e[o].given>"u")&&(m=2),a=m,this.state.opt["disambiguate-add-givenname"]&&e[o].given&&(a=this.state.registry.namereg.evalname(""+this.Item.id,e[o],o,a,this.state.inheritOpt(this.name,"form","name-form","long"),this.state.inheritOpt(this.name,"initialize-with")))}else a=c;!this.state.tmp.just_looking&&this.item&&this.item.position===u.POSITION_FIRST&&c>a&&(a=c),this.state.tmp.sort_key_flag||(this.state.tmp.disambig_settings.givens[t][o]=a,typeof r=="string"&&(typeof this.name.strings.initialize>"u"||this.name.strings.initialize===!0)&&(this.state.tmp.disambig_settings.use_initials=!0))}};u.NameOutput.prototype.getEtAlConfig=function(){var e=this.item;this["et-al"]={},this.state.output.append(this.etal_term,this.etal_style,!0),this["et-al"].single=this.state.output.pop(),this["et-al"].single.strings.suffix=this.etal_suffix,this["et-al"].single.strings.prefix=this.etal_prefix_single,this.state.output.append(this.etal_term,this.etal_style,!0),this["et-al"].multiple=this.state.output.pop(),this["et-al"].multiple.strings.suffix=this.etal_suffix,this["et-al"].multiple.strings.prefix=this.etal_prefix_multiple,typeof e>"u"&&(e={}),e.position?(this.state.inheritOpt(this.name,"et-al-subsequent-min")?this.etal_min=this.state.inheritOpt(this.name,"et-al-subsequent-min"):this.etal_min=this.state.inheritOpt(this.name,"et-al-min"),this.state.inheritOpt(this.name,"et-al-subsequent-use-first")?this.etal_use_first=this.state.inheritOpt(this.name,"et-al-subsequent-use-first"):this.etal_use_first=this.state.inheritOpt(this.name,"et-al-use-first")):(this.state.tmp["et-al-min"]?this.etal_min=this.state.tmp["et-al-min"]:this.etal_min=this.state.inheritOpt(this.name,"et-al-min"),this.state.tmp["et-al-use-first"]?this.etal_use_first=this.state.tmp["et-al-use-first"]:this.etal_use_first=this.state.inheritOpt(this.name,"et-al-use-first"),typeof this.state.tmp["et-al-use-last"]=="boolean"?this.etal_use_last=this.state.tmp["et-al-use-last"]:this.etal_use_last=this.state.inheritOpt(this.name,"et-al-use-last")),this.state.tmp["et-al-min"]||(this.state.tmp["et-al-min"]=this.etal_min)};u.NameOutput.prototype.setEtAlParameters=function(){var e,t,i,n;for(e=0,t=this.variables.length;e<t;e+=1){var r=this.variables[e];for(typeof this.etal_spec[r]>"u"&&(this.etal_spec[r]={freeters:0,institutions:0,persons:[]}),this.etal_spec[this.nameset_base+e]=this.etal_spec[r],this.freeters[r].length&&this._setEtAlParameter("freeters",r),i=0,n=this.persons[r].length;i<n;i+=1)typeof this.etal_spec[r][i]>"u"&&(this.etal_spec[r].persons[i]=0),this._setEtAlParameter("persons",r,i);this.institutions[r].length&&this._setEtAlParameter("institutions",r)}};u.NameOutput.prototype._setEtAlParameter=function(e,t,i){var n,r;e==="persons"?(n=this.persons[t][i],r=this.persons_count[t][i]):(n=this[e][t],r=this[e+"_count"][t]),n.length<r&&!this.state.tmp.sort_key_flag?this.etal_use_last?e==="persons"?this.etal_spec[t].persons[i]=2:this.etal_spec[t][e]=2:e==="persons"?this.etal_spec[t].persons[i]=1:this.etal_spec[t][e]=1:e==="persons"?this.etal_spec[t].persons[i]=0:this.etal_spec[t][e]=0};u.NameOutput.prototype.renderAllNames=function(){for(var e,t=0,i=this.variables.length;t<i;t+=1){var n=this.variables[t];(this.freeters[n].length||this.institutions[n].length)&&(this.state.tmp.group_context.tip.condition||(this.state.tmp.just_did_number=!1)),e=this.nameset_base+t,this.freeters[n].length&&(this.freeters[n]=this._renderNames(n,this.freeters[n],e));for(var r=0,a=this.institutions[n].length;r<a;r+=1)this.persons[n][r]=this._renderNames(n,this.persons[n][r],e,r)}this.renderInstitutionNames()};u.NameOutput.prototype.renderInstitutionNames=function(){for(var e=0,t=this.variables.length;e<t;e+=1)for(var i=this.variables[e],n=0,r=this.institutions[i].length;n<r;n+=1){var m,a=this.institutions[i][n],n,r,o;this.state.tmp.extension?o=["sort"]:a.isInstitution||a.literal?o=this.state.opt["cite-lang-prefs"].institutions:o=this.state.opt["cite-lang-prefs"].persons;var l={primary:"locale-orig",secondary:!1,tertiary:!1};if(o)for(var c=["primary","secondary","tertiary"],f=0,p=c.length;f<p&&!(o.length-1<f);f+=1)o[f]&&(l[c[f]]="locale-"+o[f]);else l.primary="locale-translat";this.state.tmp.area!=="bibliography"&&!(this.state.tmp.area==="citation"&&this.state.opt.xclass==="note"&&this.item&&!this.item.position)&&(l.secondary=!1,l.tertiary=!1),this.setRenderedName(a);var m=this._renderInstitutionName(i,a,l,n);this.institutions[i][n]=m}};u.NameOutput.prototype._renderInstitutionName=function(e,t,i,n){var r,a,o,l,c,f,p,m=this.getName(t,i.primary,!0),d=m.name,h=m.usedOrig;if(d&&(d=this.fixupInstitution(d,e,n)),r=!1,i.secondary){m=this.getName(t,i.secondary,!1,h);var r=m.name;h=m.usedOrig,r&&(r=this.fixupInstitution(r,e,n))}a=!1,i.tertiary&&(m=this.getName(t,i.tertiary,!1,h),a=m.name,a&&(a=this.fixupInstitution(a,e,n)));var v={l:{pri:!1,sec:!1,ter:!1},s:{pri:!1,sec:!1,ter:!1}};switch(d&&(v.l.pri=d.long,v.s.pri=d.short.length?d.short:d.long),r&&(v.l.sec=r.long,v.s.sec=r.short.length?r.short:r.long),a&&(v.l.ter=a.long,v.s.ter=a.short.length?a.short:a.long),this.institution.strings["institution-parts"]){case"short":d.short.length?(l=this._getShortStyle(),c=[this._composeOneInstitutionPart([v.s.pri,v.s.sec,v.s.ter],i,l,e)]):(o=this._getLongStyle(d,e,n),c=[this._composeOneInstitutionPart([v.l.pri,v.l.sec,v.l.ter],i,o,e)]);break;case"short-long":o=this._getLongStyle(d,e,n),l=this._getShortStyle(),f=this._renderOneInstitutionPart(d.short,l),p=this._composeOneInstitutionPart([v.l.pri,v.l.sec,v.l.ter],i,o,e),c=[f,p];break;case"long-short":o=this._getLongStyle(d,e,n),l=this._getShortStyle(),f=this._renderOneInstitutionPart(d.short,l),p=this._composeOneInstitutionPart([v.l.pri,v.l.sec,v.l.ter],i,o,e),c=[p,f];break;default:o=this._getLongStyle(d,e,n),c=[this._composeOneInstitutionPart([v.l.pri,v.l.sec,v.l.ter],i,o,e)];break}var b=this._join(c," ");return b&&(b.isInstitution=!0),this.state.tmp.name_node.children.push(b),b};u.NameOutput.prototype._composeOneInstitutionPart=function(e,t,i){var n=!1,r=!1,a=!1,o,l,c;if(e[0]){if(o=u.Util.cloneToken(i),this.state.opt.citeAffixes[t.primary]&&this.state.opt.citeAffixes.institutions[t.primary].prefix==="<i>"){for(var f=!1,p=0,m=o.decorations.length;p<m;p+=1)i.decorations[p][0]==="@font-style"&&o.decorations[p][1]==="italic"&&(f=!0);f||o.decorations.push(["@font-style","italic"])}n=this._renderOneInstitutionPart(e[0],o)}e[1]&&(r=this._renderOneInstitutionPart(e[1],i)),e[2]&&(a=this._renderOneInstitutionPart(e[2],i));var d;if(r||a){this.state.output.openLevel("empty"),this.state.output.append(n),l=u.Util.cloneToken(i),t.secondary&&(l.strings.prefix=this.state.opt.citeAffixes.institutions[t.secondary].prefix,l.strings.suffix=this.state.opt.citeAffixes.institutions[t.secondary].suffix,l.strings.prefix||(l.strings.prefix=" "));var h=new u.Token;h.decorations.push(["@font-style","normal"]),h.decorations.push(["@font-weight","normal"]),this.state.output.openLevel(h),this.state.output.append(r,l),this.state.output.closeLevel(),c=u.Util.cloneToken(i),t.tertiary&&(c.strings.prefix=this.state.opt.citeAffixes.institutions[t.tertiary].prefix,c.strings.suffix=this.state.opt.citeAffixes.institutions[t.tertiary].suffix,c.strings.prefix||(c.strings.prefix=" "));var v=new u.Token;v.decorations.push(["@font-style","normal"]),v.decorations.push(["@font-weight","normal"]),this.state.output.openLevel(v),this.state.output.append(a,c),this.state.output.closeLevel(),this.state.output.closeLevel(),d=this.state.output.pop()}else d=n;return d};u.NameOutput.prototype._renderOneInstitutionPart=function(e,t){for(var i=0,n=e.length;i<n;i+=1)if(e[i]){var r=e[i];if(this.state.tmp.strip_periods)r=r.replace(/\./g,"");else for(var a=0,o=t.decorations.length;a<o;a+=1)if(t.decorations[a][0]==="@strip-periods"&&t.decorations[a][1]==="true"){r=r.replace(/\./g,"");break}this.state.tmp.group_context.tip.variable_success=!0,this.state.tmp.can_substitute.replace(!1,u.LITERAL),r==="!here>>>"?e[i]=!1:(this.state.output.append(r,t,!0),e[i]=this.state.output.pop())}return typeof this.institution.strings["part-separator"]>"u"&&(this.institution.strings["part-separator"]=this.state.tmp.name_delimiter),this._join(e,this.institution.strings["part-separator"])};u.NameOutput.prototype._renderNames=function(e,t,i,n){var r=!1;if(t.length){for(var a=[],o=0,l=t.length;o<l;o+=1){var c=t[o],r,f;this.state.tmp.extension?f=["sort"]:c.isInstitution||c.literal?f=this.state.opt["cite-lang-prefs"].institutions:f=this.state.opt["cite-lang-prefs"].persons;var p={primary:"locale-orig",secondary:!1,tertiary:!1};if(f)for(var m=["primary","secondary","tertiary"],d=0,h=m.length;d<h&&!(f.length-1<d);d+=1)p[m[d]]="locale-"+f[d];else p.primary="locale-translat";if((this.state.tmp.sort_key_flag||this.state.tmp.area!=="bibliography"&&!(this.state.tmp.area==="citation"&&this.state.opt.xclass==="note"&&this.item&&!this.item.position))&&(p.secondary=!1,p.tertiary=!1),this.setRenderedName(c),!c.literal&&!c.isInstitution){var v=this._renderPersonalName(e,c,p,i,o,n),b=u.Util.cloneToken(this.name);this.state.output.append(v,b,!0),a.push(this.state.output.pop())}else a.push(this._renderInstitutionName(e,c,p,n))}r=this.joinPersons(a,i,n)}return r};u.NameOutput.prototype._renderPersonalName=function(e,t,i,n,r,a){var o=this.getName(t,i.primary,!0),l=this._renderOnePersonalName(o.name,n,r,a),c=!1;i.secondary&&(o=this.getName(t,i.secondary,!1,o.usedOrig),o.name&&(c=this._renderOnePersonalName(o.name,n,r,a)));var f=!1;i.tertiary&&(o=this.getName(t,i.tertiary,!1,o.usedOrig),o.name&&(f=this._renderOnePersonalName(o.name,n,r,a)));var p;if(c||f){this.state.output.openLevel("empty"),this.state.output.append(l);var m=new u.Token;i.secondary&&(m.strings.prefix=this.state.opt.citeAffixes.persons[i.secondary].prefix,m.strings.suffix=this.state.opt.citeAffixes.persons[i.secondary].suffix,m.strings.prefix||(m.strings.prefix=" ")),this.state.output.append(c,m);var d=new u.Token;i.tertiary&&(d.strings.prefix=this.state.opt.citeAffixes.persons[i.tertiary].prefix,d.strings.suffix=this.state.opt.citeAffixes.persons[i.tertiary].suffix,d.strings.prefix||(d.strings.prefix=" ")),this.state.output.append(f,d),this.state.output.closeLevel(),p=this.state.output.pop()}else p=l;return p};u.NameOutput.prototype._isRomanesque=function(e){var t=2;e.family.replace(/\"/g,"").match(u.ROMANESQUE_REGEXP)||(t=0),!t&&e.given&&e.given.match(u.STARTSWITH_ROMANESQUE_REGEXP)&&(t=1);var i;return t==2&&(e.multi&&e.multi.main?i=e.multi.main.slice(0,2):this.Item.language&&(i=this.Item.language.slice(0,2)),["ja","zh"].indexOf(i)>-1&&(t=1)),t};u.NameOutput.prototype._renderOnePersonalName=function(e,t,i,n){var r=e,a=this._droppingParticle(r,t,n),o=this._familyName(r),l=this._nonDroppingParticle(r),c=this._givenName(r,t,i),f=c.blob,p=this._nameSuffix(r);f===!1&&(a=!1,p=!1);var m=this.state.inheritOpt(this.name,"sort-separator");m||(m="");var d;r["comma-suffix"]?d=", ":d=" ";var h=this._isRomanesque(r);function v(_){return _?typeof _.blobs=="string"?["’","'","-"," "].indexOf(_.blobs.slice(-1))>-1:v(_.blobs[_.blobs.length-1]):!1}var b=v(l),y;["fr","ru","cs"].indexOf(this.state.opt["default-locale"][0].slice(0,2))>-1?y=" ":y=" ";var g,x,k,w;if(h===0)g=this._join([l,o,f],"");else if(h===1||r["static-ordering"])x=this._join([l,o],y),g=this._join([x,f]," ");else if(r["reverse-ordering"])x=this._join([l,o],y),g=this._join([f,x]," ");else if(this.state.tmp.sort_key_flag)this.state.opt["demote-non-dropping-particle"]==="never"?(x=this._join([l,o],y),x=this._join([x,a]," "),x=this._join([x,f],this.state.opt.sort_sep),g=this._join([x,p]," ")):(w=this._join([f,a,l]," "),x=this._join([o,w],this.state.opt.sort_sep),g=this._join([x,p]," "));else if(this.state.inheritOpt(this.name,"name-as-sort-order")==="all"||this.state.inheritOpt(this.name,"name-as-sort-order")==="first"&&i===0&&(n===0||typeof n>"u"))["Lord","Lady"].indexOf(r.given)>-1&&(m=", "),["always","display-and-sort"].indexOf(this.state.opt["demote-non-dropping-particle"])>-1?(w=this._join([f,a],r["comma-dropping-particle"]+" "),w=this._join([w,l]," "),w&&this.given&&(w.strings.prefix=this.given.strings.prefix,w.strings.suffix=this.given.strings.suffix),o&&this.family&&(o.strings.prefix=this.family.strings.prefix,o.strings.suffix=this.family.strings.suffix),x=this._join([o,w],m),g=this._join([x,p],m)):(b?k=this._join([l,o],""):k=this._join([l,o],y),k&&this.family&&(k.strings.prefix=this.family.strings.prefix,k.strings.suffix=this.family.strings.suffix),w=this._join([f,a],r["comma-dropping-particle"]+" "),w&&this.given&&(w.strings.prefix=this.given.strings.prefix,w.strings.suffix=this.given.strings.suffix),x=this._join([k,w],m),g=this._join([x,p],m)),g.isInverted=!0;else{if(r["dropping-particle"]&&r.family&&!r["non-dropping-particle"]){var C=r["dropping-particle"],E=["'","ʼ","’","-"];E.indexOf(C.slice(-1))>-1&&C.slice(0,-1)!=="de"&&(o=this._join([a,o],""),a=!1)}b?(w=this._join([l,o],""),w=this._join([a,w],y)):w=this._join([a,l,o],y),w=this._join([w,p],d),w&&this.family&&(w.strings.prefix=this.family.strings.prefix,w.strings.suffix=this.family.strings.suffix),f&&this.given&&(f.strings.prefix=this.given.strings.prefix,f.strings.suffix=this.given.strings.suffix),w.strings.prefix&&(r["comma-dropping-particle"]="");var B;this.state.inheritOpt(this.name,"initialize-with")&&this.state.inheritOpt(this.name,"initialize-with").match(/[\u00a0\ufeff]/)&&c.initializationLevel===1?B=y:B=" ",g=this._join([f,w],r["comma-dropping-particle"]+B)}return this.state.tmp.group_context.tip.variable_success=!0,this.state.tmp.can_substitute.replace(!1,u.LITERAL),this.state.tmp.term_predecessor=!0,this.state.tmp.name_node.children.push(g),g};u.NameOutput.prototype._normalizeNameInput=function(e){var t={literal:e.literal,family:e.family,isInstitution:e.isInstitution,given:e.given,suffix:e.suffix,"comma-suffix":e["comma-suffix"],"non-dropping-particle":e["non-dropping-particle"],"dropping-particle":e["dropping-particle"],"static-ordering":e["static-ordering"],"static-particles":e["static-particles"],"reverse-ordering":e["reverse-ordering"],"full-form-always":e["full-form-always"],"parse-names":e["parse-names"],"comma-dropping-particle":"",block_initialize:e.block_initialize,multi:e.multi};return this._parseName(t),t};u.NameOutput.prototype._stripPeriods=function(e,t){var i=this[e+"_decor"];if(t){if(this.state.tmp.strip_periods)t=t.replace(/\./g,"");else if(i){for(var n=0,r=i.decorations.length;n<r;n+=1)if(i.decorations[n][0]==="@strip-periods"&&i.decorations[n][1]==="true"){t=t.replace(/\./g,"");break}}}return t};u.NameOutput.prototype._nonDroppingParticle=function(e){var t=e["non-dropping-particle"];t&&this.state.tmp.sort_key_flag&&(t=t.replace(/[\'\u2019]/,""));var i=this._stripPeriods("family",t);return this.state.output.append(i,this.family_decor,!0)?this.state.output.pop():!1};u.NameOutput.prototype._droppingParticle=function(e,t,i){var n=e["dropping-particle"];n&&this.state.tmp.sort_key_flag&&(n=n.replace(/[\'\u2019]/,""));var r=this._stripPeriods("given",n);if(e["dropping-particle"]&&e["dropping-particle"].match(/^et.?al[^a-z]$/))this.state.inheritOpt(this.name,"et-al-use-last")?typeof i>"u"?this.etal_spec[t].freeters=2:this.etal_spec[t].persons=2:typeof i>"u"?this.etal_spec[t].freeters=1:this.etal_spec[t].persons=1,e["comma-dropping-particle"]="";else if(this.state.output.append(r,this.given_decor,!0))return this.state.output.pop();return!1};u.NameOutput.prototype._familyName=function(e){var t=this._stripPeriods("family",e.family);return this.state.output.append(t,this.family_decor,!0)?this.state.output.pop():!1};u.NameOutput.prototype._givenName=function(e,t,i){var n,r=this.state.inheritOpt(this.name,"form","name-form","long")!=="long",a=this.state.inheritOpt(this.name,"initialize")!==!1,o=typeof this.state.inheritOpt(this.name,"initialize-with")=="string"&&!e.block_initialize,l,c;if(e["full-form-always"])c=2;else{r?l=0:o?l=1:l=2;var f=this.state.tmp.disambig_settings.givens[t][i];f>l?c=f:c=l}var p=this.state.citation.opt["givenname-disambiguation-rule"];if(p&&p.slice(-14)==="-with-initials"&&(o=!0),e.family&&c===1)if(o){var m=this.state.inheritOpt(this.name,"initialize-with",!1,"");e.given=u.Util.Names.initializeWith(this.state,e.given,m,!a)}else e.given=u.Util.Names.unInitialize(this.state,e.given);else{if(c===0)return{blob:!1};c===2&&(e.given=u.Util.Names.unInitialize(this.state,e.given))}var d=this._stripPeriods("given",e.given),h=this.state.output.append(d,this.given_decor,!0);return h?(n=this.state.output.pop(),{blob:n,initializationLevel:c}):{blob:!1}};u.NameOutput.prototype._nameSuffix=function(e){var t=e.suffix,i;t&&typeof this.state.inheritOpt(this.name,"initialize-with")=="string"&&(t=u.Util.Names.initializeWith(this.state,t,this.state.inheritOpt(this.name,"initialize-with"),!0)),t=this._stripPeriods("family",t);var n="";t&&t.slice(-1)==="."&&(t=t.slice(0,-1),n=".");var r=this.state.output.append(t,"empty",!0);return r?(i=this.state.output.pop(),i.strings.suffix=n+i.strings.suffix,i):!1};u.NameOutput.prototype._getLongStyle=function(e){var t;return e.short.length?this.institutionpart["long-with-short"]?t=this.institutionpart["long-with-short"]:t=this.institutionpart.long:t=this.institutionpart.long,t||(t=new u.Token),t};u.NameOutput.prototype._getShortStyle=function(){var e;return this.institutionpart.short?e=this.institutionpart.short:e=new u.Token,e};u.NameOutput.prototype._parseName=function(e){if(!e["parse-names"]&&typeof e["parse-names"]<"u")return e;e.family&&!e.given&&e.isInstitution&&(e.literal=e.family,e.family=void 0,e.isInstitution=void 0);var t;e.family&&e.family.slice(0,1)==='"'&&e.family.slice(-1)==='"'||!e["parse-names"]&&typeof e["parse-names"]<"u"?(e.family=e.family.slice(1,-1),t=!0,e["parse-names"]=0):t=!1,this.state.opt.development_extensions.parse_names&&!e["non-dropping-particle"]&&e.family&&!t&&e.given&&(e["static-particles"]||u.parseParticles(e,!0))};u.NameOutput.prototype.getName=function(e,t,i,n){if(n&&t==="locale-orig")return{name:!1,usedOrig:n};e.family||(e.family=""),e.given||(e.given="");var r={};r["static-ordering"]=this.getStaticOrder(e);var a=!0,o;if(t!=="locale-orig"&&(a=!1,e.multi)){for(var l=this.state.opt[t],c=0,f=l.length;c<f;c+=1)if(o=l[c],e.multi._key[o]){a=!0;var p=e.isInstitution;e=e.multi._key[o],e.isInstitution=p,r=this.getNameParams(o),r.transliterated=!0;break}}if(a||(o=!1,e.multi&&e.multi.main?o=e.multi.main:this.Item.language&&(o=this.Item.language),o&&(r=this.getNameParams(o))),!i&&!a)return{name:!1,usedOrig:n};e.family||(e.family=""),e.given||(e.given=""),e.literal&&(delete e.family,delete e.given),e={family:e.family,given:e.given,"non-dropping-particle":e["non-dropping-particle"],"dropping-particle":e["dropping-particle"],suffix:e.suffix,"static-ordering":r["static-ordering"],"static-particles":e["static-particles"],"reverse-ordering":r["reverse-ordering"],"full-form-always":r["full-form-always"],"parse-names":e["parse-names"],"comma-suffix":e["comma-suffix"],"comma-dropping-particle":e["comma-dropping-particle"],transliterated:r.transliterated,block_initialize:r["block-initialize"],literal:e.literal,isInstitution:e.isInstitution,multi:e.multi},!e.literal&&!e.given&&e.family&&e.isInstitution&&(e.literal=e.family),e.literal&&(delete e.family,delete e.given),e=this._normalizeNameInput(e);var m;return n?m=n:m=!a,{name:e,usedOrig:m}};u.NameOutput.prototype.getNameParams=function(e){var t={},i=u.localeResolve(this.Item.language,this.state.opt["default-locale"][0]),n=this.state.locale[i.best]?i.best:this.state.opt["default-locale"][0],r=this.state.locale[n].opts["name-as-sort-order"],a=this.state.locale[n].opts["name-as-reverse-order"],o=this.state.locale[n].opts["name-never-short"],l=e.split("-")[0];return r&&r[l]&&(t["static-ordering"]=!0,t["reverse-ordering"]=!1),a&&a[l]&&(t["reverse-ordering"]=!0,t["static-ordering"]=!1),o&&o[l]&&(t["full-form-always"]=!0),t["static-ordering"]&&(t["block-initialize"]=!0),t};u.NameOutput.prototype.setRenderedName=function(e){if(this.state.tmp.area==="bibliography"){for(var t="",i=0,n=u.NAME_PARTS.length;i<n;i+=1)e[u.NAME_PARTS[i]]&&(t+=e[u.NAME_PARTS[i]]);this.state.tmp.rendered_name.push(t)}};u.NameOutput.prototype.fixupInstitution=function(e,t,i){!e.literal&&e.family&&(e.literal=e.family,delete e.family);var n=e.literal,r=n,a={long:n.split(/\s*\|\s*/),short:r.split(/\s*\|\s*/)};if(this.state.sys.getAbbreviation){if(this.institution.strings.form==="short"){let d=this.Item.jurisdiction;d=this.state.transform.loadAbbreviation(d,"institution-entire",n,this.Item.language),this.state.transform.abbrevs[d]["institution-entire"][n]?n=this.state.transform.abbrevs[d]["institution-entire"][n]:(d=this.Item.jurisdiction,d=this.state.transform.loadAbbreviation(d,"institution-part",n,this.Item.language),this.state.transform.abbrevs[d]["institution-part"][n]&&(n=this.state.transform.abbrevs[d]["institution-part"][n])),n=this._quashChecks(d,n)}if(["short","short-long","long-short"].indexOf(this.institution.strings["institution-parts"])>-1){let d=this.Item.jurisdiction;d=this.state.transform.loadAbbreviation(d,"institution-part",r,this.Item.language),this.state.transform.abbrevs[d]["institution-part"][r]&&(r=this.state.transform.abbrevs[d]["institution-part"][r]),r=this._quashChecks(d,r),["short-long","long-short"].indexOf(this.institution.strings["institution-parts"])>-1&&r===n&&(r="")}if(a.long=n.split(/\s*\|\s*/),a.short=r.split(/\s*\|\s*/),["short","short-long","long-short"].indexOf(this.institution.strings["institution-parts"])>-1)for(var o=a.short.length-1;o>-1;o--){let d=this.Item.jurisdiction;var l=a.short[o];if(d=this.state.transform.loadAbbreviation(d,"institution-part",l,this.Item.language),this.state.transform.abbrevs[d]["institution-part"][l]&&(a.short[o]=this.state.transform.abbrevs[d]["institution-part"][l]),a.short[o].indexOf("|")>-1){let h=a.short,v=h[o].split(/\s*\|\s*/);a.short=h.slice(0,o).concat(v).concat(h.slice(o+1))}}if(this.state.opt.development_extensions.legacy_institution_name_ordering&&a.short.reverse(),a.short=this._trimInstitution(a.short),this.institution.strings["reverse-order"]&&a.short.reverse(),!this.state.tmp.just_looking&&this.Item.jurisdiction){let d=this.Item.jurisdiction;var c=this.state.tmp.abbrev_trimmer;if(c&&c[d]&&c[d][t])for(var f=0,p=a.short.length;f<p;f++){var m=a.short[f];a.short[f]=m.replace(c[d][t],"").trim()}}}return this.state.opt.development_extensions.legacy_institution_name_ordering&&a.long.reverse(),a.long=this._trimInstitution(a.long),this.institution.strings["reverse-order"]&&a.long.reverse(),a};u.NameOutput.prototype.getStaticOrder=function(e,t){var i=!1;return(!t&&e["static-ordering"]||this._isRomanesque(e)===0||(!e.multi||!e.multi.main)&&this.Item.language&&["vi","hu"].indexOf(this.Item.language)>-1||e.multi&&e.multi.main&&["vi","hu"].indexOf(e.multi.main.slice(0,2))>-1||this.state.opt["auto-vietnamese-names"]&&u.VIETNAMESE_NAMES.exec(e.family+" "+e.given)&&u.VIETNAMESE_SPECIALS.exec(e.family+e.given))&&(i=!0),i};u.NameOutput.prototype._quashChecks=function(e,i){var i=this.state.transform.quashCheck(e,i),n=i.split(/>>[0-9]{4}>>/),r=i.match(/>>([0-9]{4})>>/);i=n.pop();var a=this.Item["original-date"]?this.Item["original-date"]:this.Item.issued;if(a&&(a=parseInt(a.year,10),a=isNaN(a)?!1:a),a){if(n.length>0)for(var o=r.length-1;o>0&&!(a>=parseInt(r[o],10));o--)i=n.pop();i=i.replace(/\s*\|\s*/g,"|")}return i};u.NameOutput.prototype._trimInstitution=function(e){var t=!1,i=!1,n=!1,r=!1,a=e.slice();if(this.institution){if(typeof this.institution.strings["use-first"]<"u"&&(t=this.institution.strings["use-first"]),typeof this.institution.strings["use-last"]<"u"&&(n=this.institution.strings["use-last"]),typeof this.institution.strings["stop-first"]<"u"&&(r=this.institution.strings["stop-first"]),typeof this.institution.strings["stop-last"]<"u"&&(i=this.institution.strings["stop-last"]),t&&(i&&(a=a.slice(0,i*-1)),a=a.slice(0,t)),n){var o=e.slice();t?r=t:a=[],r&&(o=o.slice(r)),o=o.slice(n*-1),a=a.concat(o)}e=a}return e};u.PublisherOutput=function(e,t){this.state=e,this.group_tok=t,this.varlist=[]};u.PublisherOutput.prototype.render=function(){this.clearVars(),this.composeAndBlob(),this.composeElements(),this.composePublishers(),this.joinPublishers()};u.PublisherOutput.prototype.composeAndBlob=function(){this.and_blob={};var e=!1;this.group_tok.strings.and==="text"?e=this.state.getTerm("and"):this.group_tok.strings.and==="symbol"&&(e="&");var t=new u.Token;t.strings.suffix=" ",t.strings.prefix=" ",this.state.output.append(e,t,!0);var i=this.state.output.pop();t.strings.prefix=this.group_tok.strings["subgroup-delimiter"],this.state.output.append(e,t,!0);var n=this.state.output.pop();this.and_blob.single=!1,this.and_blob.multiple=!1,e&&(this.group_tok.strings["subgroup-delimiter-precedes-last"]==="always"?this.and_blob.single=n:this.group_tok.strings["subgroup-delimiter-precedes-last"]==="never"?(this.and_blob.single=i,this.and_blob.multiple=i):(this.and_blob.single=i,this.and_blob.multiple=n))};u.PublisherOutput.prototype.composeElements=function(){for(var e=0,t=2;e<t;e+=1)for(var i=["publisher","publisher-place"][e],n=0,r=this["publisher-list"].length;n<r;n+=1){var a=this[i+"-list"][n],o=this[i+"-token"];this.state.output.append(a,o,!0),this[i+"-list"][n]=this.state.output.pop()}};u.PublisherOutput.prototype.composePublishers=function(){for(var e,t=0,i=this["publisher-list"].length;t<i;t+=1)e=[this[this.varlist[0]+"-list"][t],this[this.varlist[1]+"-list"][t]],this["publisher-list"][t]=this._join(e,this.group_tok.strings.delimiter)};u.PublisherOutput.prototype.joinPublishers=function(){var e=this["publisher-list"],t=this._join(e,this.group_tok.strings["subgroup-delimiter"],this.and_blob.single,this.and_blob.multiple,this.group_tok);this.state.output.append(t,"literal")};u.PublisherOutput.prototype._join=u.NameOutput.prototype._join;u.PublisherOutput.prototype._getToken=u.NameOutput.prototype._getToken;u.PublisherOutput.prototype.clearVars=function(){this.state.tmp["publisher-list"]=!1,this.state.tmp["publisher-place-list"]=!1,this.state.tmp["publisher-group-token"]=!1,this.state.tmp["publisher-token"]=!1,this.state.tmp["publisher-place-token"]=!1};u.evaluateLabel=function(e,t,i,n){var r;e.strings.term==="locator"?(n&&n.label&&(n.label==="sub verbo"?r="sub-verbo":r=n.label),r||(r="page")):r=e.strings.term;var a=e.strings.plural;if(typeof a!="number"){var o=n&&e.strings.term==="locator"?n:i;o[e.strings.term]&&(t.processNumber(!1,o,e.strings.term,i.type),a=t.tmp.shadow_numbers[e.strings.term].plural,!t.tmp.shadow_numbers[e.strings.term].labelForm&&!t.tmp.shadow_numbers[e.strings.term].labelDecorations&&(e.strings.form?t.tmp.shadow_numbers[e.strings.term].labelForm=e.strings.form:t.tmp.group_context.tip.label_form&&(t.tmp.shadow_numbers[e.strings.term].labelForm=t.tmp.group_context.tip.label_form),t.tmp.shadow_numbers[e.strings.term].labelCapitalizeIfFirst=e.strings.capitalize_if_first,t.tmp.shadow_numbers[e.strings.term].labelDecorations=e.decorations.slice()),["locator","number","page"].indexOf(e.strings.term)>-1&&t.tmp.shadow_numbers[e.strings.term].label&&(r=t.tmp.shadow_numbers[e.strings.term].label),e.decorations&&t.opt.development_extensions.csl_reverse_lookup_support&&(e.decorations.reverse(),e.decorations.push(["@showid","true",e.cslid]),e.decorations.reverse()))}return u.castLabel(t,e,r,a,u.TOLERANT)};u.castLabel=function(e,t,i,n,r){var a=t.strings.form,o=t.strings.capitalize_if_first;e.tmp.group_context.tip.label_form&&(a==="static"?e.tmp.group_context.tip.label_static=!0:a=e.tmp.group_context.tip.label_form),e.tmp.group_context.tip.label_capitalize_if_first&&(o=e.tmp.group_context.tip.label_capitalize_if_first);var l=e.getTerm(i,a,n,!1,r,t.default_locale);if(o&&(l=u.Output.Formatters["capitalize-first"](e,l)),e.tmp.strip_periods)l=l.replace(/\./g,"");else for(var c=0,f=t.decorations.length;c<f;c+=1)if(t.decorations[c][0]==="@strip-periods"&&t.decorations[c][1]==="true"){l=l.replace(/\./g,"");break}return l};u.Node.name={build:function(e,t){var i;if([u.SINGLETON,u.START].indexOf(this.tokentype)>-1){var n;typeof e.tmp.root>"u"?(n=void 0,e.tmp.root="citation"):n=e.tmp.root,e.inheritOpt(this,"et-al-subsequent-min")&&e.inheritOpt(this,"et-al-subsequent-min")!==e.inheritOpt(this,"et-al-min")&&(e.opt.update_mode=u.POSITION),e.inheritOpt(this,"et-al-subsequent-use-first")&&e.inheritOpt(this,"et-al-subsequent-use-first")!==e.inheritOpt(this,"et-al-use-first")&&(e.opt.update_mode=u.POSITION),e.tmp.root=n,i=function(r){r.tmp.etal_term="et-al",r.tmp.name_delimiter=r.inheritOpt(this,"delimiter","name-delimiter",", "),r.tmp["delimiter-precedes-et-al"]=r.inheritOpt(this,"delimiter-precedes-et-al"),r.inheritOpt(this,"and")==="text"?this.and_term=r.getTerm("and","long",0):r.inheritOpt(this,"and")==="symbol"&&(r.opt.development_extensions.expect_and_symbol_form?this.and_term=r.getTerm("and","symbol",0):this.and_term="&"),r.tmp.and_term=this.and_term,u.STARTSWITH_ROMANESQUE_REGEXP.test(this.and_term)?(this.and_prefix_single=" ",this.and_prefix_multiple=", ",typeof r.tmp.name_delimiter=="string"&&(this.and_prefix_multiple=r.tmp.name_delimiter),this.and_suffix=" "):(this.and_prefix_single="",this.and_prefix_multiple="",this.and_suffix=""),r.inheritOpt(this,"delimiter-precedes-last")==="always"?this.and_prefix_single=r.tmp.name_delimiter:r.inheritOpt(this,"delimiter-precedes-last")==="never"?this.and_prefix_multiple&&(this.and_prefix_multiple=" "):r.inheritOpt(this,"delimiter-precedes-last")==="after-inverted-name"&&(this.and_prefix_single&&(this.and_prefix_single=r.tmp.name_delimiter),this.and_prefix_multiple&&(this.and_prefix_multiple=" ")),this.and={},r.inheritOpt(this,"and")?(r.output.append(this.and_term,"empty",!0),this.and.single=r.output.pop(),this.and.single.strings.prefix=this.and_prefix_single,this.and.single.strings.suffix=this.and_suffix,r.output.append(this.and_term,"empty",!0),this.and.multiple=r.output.pop(),this.and.multiple.strings.prefix=this.and_prefix_multiple,this.and.multiple.strings.suffix=this.and_suffix):r.tmp.name_delimiter&&(this.and.single=new u.Blob(r.tmp.name_delimiter),this.and.single.strings.prefix="",this.and.single.strings.suffix="",this.and.multiple=new u.Blob(r.tmp.name_delimiter),this.and.multiple.strings.prefix="",this.and.multiple.strings.suffix=""),this.ellipsis={},r.inheritOpt(this,"et-al-use-last")&&(this.ellipsis_term="…",this.ellipsis_prefix_single=" ",this.ellipsis_prefix_multiple=r.inheritOpt(this,"delimiter","name-delimiter",", "),this.ellipsis_suffix=" ",this.ellipsis.single=new u.Blob(this.ellipsis_term),this.ellipsis.single.strings.prefix=this.ellipsis_prefix_single,this.ellipsis.single.strings.suffix=this.ellipsis_suffix,this.ellipsis.multiple=new u.Blob(this.ellipsis_term),this.ellipsis.multiple.strings.prefix=this.ellipsis_prefix_multiple,this.ellipsis.multiple.strings.suffix=this.ellipsis_suffix),typeof r.tmp["et-al-min"]>"u"&&(r.tmp["et-al-min"]=r.inheritOpt(this,"et-al-min")),typeof r.tmp["et-al-use-first"]>"u"&&(r.tmp["et-al-use-first"]=r.inheritOpt(this,"et-al-use-first")),typeof r.tmp["et-al-use-last"]>"u"&&(r.tmp["et-al-use-last"]=r.inheritOpt(this,"et-al-use-last")),r.nameOutput.name=this},e.build.name_flag=!0,this.execs.push(i)}t.push(this)}};u.Node["name-part"]={build:function(e){e.build[this.strings.name]=this}};u.Node.names={build:function(e,t){var i;if((this.tokentype===u.START||this.tokentype===u.SINGLETON)&&(u.Util.substituteStart.call(this,e,t),e.build.substitute_level.push(1)),this.tokentype===u.SINGLETON){e.build.names_variables[e.build.names_variables.length-1].concat(this.variables);for(var n in this.variables){var r=this.variables[n],a=e.build.name_label[e.build.name_label.length-1];Object.keys(a).length&&(a[r]=a[Object.keys(a)[0]])}i=function(c){c.nameOutput.reinit(this,this.variables_real[0])},this.execs.push(i)}if(this.tokentype===u.START&&(e.build.names_flag=!0,e.build.name_flag=!1,e.build.names_level+=1,e.build.names_variables.push(this.variables),e.build.name_label.push({}),i=function(c){c.tmp.can_substitute.push(!0),c.tmp.name_node={},c.tmp.name_node.children=[],c.nameOutput.init(this)},this.execs.push(i)),this.tokentype===u.END){for(var n=0,o=3;n<o;n+=1){var l=["family","given","et-al"][n];this[l]=e.build[l],e.build.names_level===1&&(e.build[l]=void 0)}this.label=e.build.name_label[e.build.name_label.length-1],e.build.names_level+=-1,e.build.names_variables.pop(),e.build.name_label.pop(),i=function(c){c.tmp.etal_node?this.etal_style=c.tmp.etal_node:this.etal_style="empty",this.etal_term=c.getTerm(c.tmp.etal_term,"long",0),this.etal_prefix_single=" ",this.etal_prefix_multiple=c.tmp.name_delimiter,c.tmp["delimiter-precedes-et-al"]==="always"?this.etal_prefix_single=c.tmp.name_delimiter:c.tmp["delimiter-precedes-et-al"]==="never"?this.etal_prefix_multiple=" ":c.tmp["delimiter-precedes-et-al"]==="after-inverted-name"&&(this.etal_prefix_single=c.tmp.name_delimiter,this.etal_prefix_multiple=" "),this.etal_suffix="",u.STARTSWITH_ROMANESQUE_REGEXP.test(this.etal_term)||(this.etal_prefix_single===" "&&(this.etal_prefix_single=""),this.etal_prefix_multiple===" "&&(this.etal_prefix_multiple=""),this.etal_suffix===" "&&(this.etal_suffix=""));for(var f=0,p=3;f<p;f+=1){var m=["family","given"][f];c.nameOutput[m]=this[m]}c.nameOutput.with=this.with;var d="with",h="",v="";u.STARTSWITH_ROMANESQUE_REGEXP.test(d)&&(h=" ",v=" ");var b={};b.single=new u.Blob(d),b.single.strings.suffix=v,b.multiple=new u.Blob(d),b.multiple.strings.suffix=v,c.inheritOpt(c.nameOutput.name,"delimiter-precedes-last")==="always"?(b.single.strings.prefix=c.inheritOpt(this,"delimiter","names-delimiter"),b.multiple.strings.prefix=c.inheritOpt(this,"delimiter","names-delimiter")):c.inheritOpt(c.nameOutput.name,"delimiter-precedes-last")==="contextual"?(b.single.strings.prefix=h,b.multiple.strings.prefix=c.inheritOpt(this,"delimiter","names-delimiter")):c.inheritOpt(c.nameOutput.name,"delimiter-precedes-last")==="after-inverted-name"?(b.single.strings.prefix=c.inheritOpt(this,"delimiter","names-delimiter"),b.multiple.strings.prefix=h):(b.single.strings.prefix=h,b.multiple.strings.prefix=h),c.nameOutput.with=b,c.nameOutput.label=this.label,c.nameOutput.etal_style=this.etal_style,c.nameOutput.etal_term=this.etal_term,c.nameOutput.etal_prefix_single=this.etal_prefix_single,c.nameOutput.etal_prefix_multiple=this.etal_prefix_multiple,c.nameOutput.etal_suffix=this.etal_suffix,c.nameOutput.outputNames(),c.tmp["et-al-use-first"]=void 0,c.tmp["et-al-min"]=void 0,c.tmp["et-al-use-last"]=void 0},this.execs.push(i),i=function(c){c.tmp.can_substitute.pop()||c.tmp.can_substitute.replace(!1,u.LITERAL),c.tmp.can_substitute.mystack.length===1&&(c.tmp.can_block_substitute=!1)},this.execs.push(i),e.build.name_flag=!1}t.push(this),(this.tokentype===u.END||this.tokentype===u.SINGLETON)&&(e.build.substitute_level.pop(),u.Util.substituteEnd.call(this,e,t))}};u.Node.number={build:function(e,t){var i;u.Util.substituteStart.call(this,e,t),this.strings.form==="roman"?this.formatter=e.fun.romanizer:this.strings.form==="ordinal"?this.formatter=e.fun.ordinalizer:this.strings.form==="long-ordinal"&&(this.formatter=e.fun.long_ordinalizer),typeof this.successor_prefix>"u"&&(this.successor_prefix=e[e.build.area].opt.layout_delimiter),typeof this.splice_prefix>"u"&&(this.splice_prefix=e[e.build.area].opt.layout_delimiter),i=function(n,r,a){if(this.variables.length!==0){var o;if(o=this.variables[0],typeof a>"u")var a={};if(["locator","locator-extra"].indexOf(o)>-1){if(n.tmp.just_looking||!a[o])return}else if(!r[o])return;o==="collection-number"&&r.type==="legal_case"&&(n.tmp.renders_collection_number=!0);var l=this;if(n.tmp.group_context.tip.force_suppress)return!1;if(["locator","locator-extra"].indexOf(o)>-1?n.processNumber.call(n,l,a,o,r.type):(!n.tmp.group_context.tip.condition&&r[o]&&(n.tmp.just_did_number=(""+r[o]).match(/[0-9]$/)),n.processNumber.call(n,l,r,o,r.type)),this.substring){var c=r[o].slice(this.substring);n.output.append(c,l)}else u.Util.outputNumericField(n,o,r.id);["locator","locator-extra"].indexOf(this.variables_real[0])>-1&&!n.tmp.just_looking&&(n.tmp.done_vars.push(this.variables_real[0]),n.tmp.group_context.tip.done_vars.push(this.variables_real[0]))}},this.execs.push(i),t.push(this),u.Util.substituteEnd.call(this,e,t)}};u.Node.sort={build:function(e,t){if(t=e[e.build.root+"_sort"].tokens,this.tokentype===u.START){e.build.area==="citation"&&(e.opt.sort_citations=!0),e.build.area=e.build.root+"_sort",e.build.extension="_sort";var i=function(n,r){if(n.opt.has_layout_locale){for(var a=u.localeResolve(r.language,n.opt["default-locale"][0]),o=n[n.tmp.area.slice(0,-5)].opt.sort_locales,l,c=0,f=o.length;c<f&&(l=o[c][a.bare],l||(l=o[c][a.best]),!l);c+=1);l||(l=n.opt["default-locale"][0]),n.tmp.lang_sort_hold=n.opt.lang,n.opt.lang=l}};this.execs.push(i)}if(this.tokentype===u.END){e.build.area=e.build.root,e.build.extension="";var i=function(r){r.opt.has_layout_locale&&(r.opt.lang=r.tmp.lang_sort_hold,delete r.tmp.lang_sort_hold)};this.execs.push(i)}t.push(this)}};u.Node.substitute={build:function(e,t){var i;if(this.tokentype===u.START){var n=new u.Token("choose",u.START);u.Node.choose.build.call(n,e,t);var r=new u.Token("if",u.SINGLETON);i=function(){return!!(e.tmp.value.length&&!e.tmp.common_term_match_fail)},r.tests=[i],r.test=e.fun.match.any(r,e,r.tests),t.push(r),i=function(o){o.tmp.can_block_substitute=!0,o.tmp.value.length&&!o.tmp.common_term_match_fail&&o.tmp.can_substitute.replace(!1,u.LITERAL),o.tmp.common_term_match_fail=!1},this.execs.push(i),t.push(this)}if(this.tokentype===u.END){t.push(this);var a=new u.Token("choose",u.END);u.Node.choose.build.call(a,e,t)}}};u.Node.text={build:function(e,t){var i,n,r,a,o,l,c,f,p,m,d;if(this.postponed_macro){var h=u.Util.cloneToken(this);h.name="group",h.tokentype=u.START,u.Node.group.build.call(h,e,t),u.expandMacro.call(e,this,t);var v=u.Util.cloneToken(this);v.name="group",v.tokentype=u.END,this.postponed_macro==="juris-locator-label"&&(v.isJurisLocatorLabel=!0),u.Node.group.build.call(v,e,t)}else{if(u.Util.substituteStart.call(this,e,t),this.variables_real||(this.variables_real=[]),this.variables||(this.variables=[]),n="long",r=0,this.strings.form&&(n=this.strings.form),this.strings.plural&&(r=this.strings.plural),this.variables_real[0]==="citation-number"||this.variables_real[0]==="year-suffix"||this.variables_real[0]==="citation-label")this.variables_real[0]==="citation-number"?(e.build.root==="citation"&&(e.opt.update_mode=u.NUMERIC),e.build.root==="bibliography"&&(e.opt.bib_mode=u.NUMERIC),e[e.tmp.area].opt.collapse==="citation-number"&&(this.range_prefix=e.getTerm("citation-range-delimiter")),this.successor_prefix=e[e.build.area].opt.layout_delimiter,this.splice_prefix=e[e.build.area].opt.layout_delimiter,i=function(k,w,C){if(a=""+w.id,!k.tmp.just_looking){if(k.tmp.area.slice(-5)==="_sort"&&this.variables[0]==="citation-number"){if(k.tmp.area==="bibliography_sort"&&k.tmp.group_context.tip.done_vars.push("citation-number"),k.tmp.area==="citation_sort"&&k.bibliography_sort.tmp.citation_number_map)var E=k.bibliography_sort.tmp.citation_number_map[k.registry.registry[w.id].seq];else var E=k.registry.registry[w.id].seq;E&&(E=u.Util.padding(""+E)),k.output.append(E,this);return}C&&C["author-only"]&&k.tmp.element_trace.replace("suppress-me"),k.tmp.area!=="bibliography_sort"&&k.bibliography_sort.tmp.citation_number_map&&k.bibliography_sort.opt.citation_number_sort_direction===u.DESCENDING?E=k.bibliography_sort.tmp.citation_number_map[k.registry.registry[a].seq]:E=k.registry.registry[a].seq,k.opt.citation_number_slug?k.output.append(k.opt.citation_number_slug,this):(l=new u.NumericBlob(k,!1,E,this,w.id),k.tmp.in_cite_predecessor&&(l.suppress_splice_prefix=!0),k.output.append(l,"literal"))}},this.execs.push(i)):this.variables_real[0]==="year-suffix"?(e.opt.has_year_suffix=!0,e[e.tmp.area].opt.collapse==="year-suffix-ranged"&&(this.range_prefix=e.getTerm("citation-range-delimiter")),this.successor_prefix=e[e.build.area].opt.layout_delimiter,e[e.tmp.area].opt["year-suffix-delimiter"]&&(this.successor_prefix=e[e.build.area].opt["year-suffix-delimiter"]),i=function(k,w){if(k.registry.registry[w.id]&&k.registry.registry[w.id].disambig.year_suffix!==!1&&!k.tmp.just_looking){o=parseInt(k.registry.registry[w.id].disambig.year_suffix,10),k[k.tmp.area].opt.cite_group_delimiter&&(this.successor_prefix=k[k.tmp.area].opt.cite_group_delimiter),l=new u.NumericBlob(k,!1,o,this,w.id),c=new u.Util.Suffixator(u.SUFFIX_CHARS),l.setFormatter(c),k.output.append(l,"literal"),f=!1;for(var C=0,E=k.tmp.group_context.mystack.length;C<E;C++){var B=k.tmp.group_context.mystack[C];if(!B.variable_success&&(B.variable_attempt||!B.variable_attempt&&!B.term_intended)){f=!0;break}}p=k[k.tmp.area].opt["year-suffix-delimiter"],f&&p&&!k.tmp.sort_key_flag&&(k.tmp.splice_delimiter=k[k.tmp.area].opt["year-suffix-delimiter"])}},this.execs.push(i)):this.variables_real[0]==="citation-label"&&(e.build.root==="bibliography"&&(e.opt.bib_mode=u.TRIGRAPH),e.opt.has_year_suffix=!0,i=function(k,w){m=w["citation-label"],m||(m=k.getCitationLabel(w)),k.tmp.just_looking||(d="",k.registry.registry[w.id]&&k.registry.registry[w.id].disambig.year_suffix!==!1&&(o=parseInt(k.registry.registry[w.id].disambig.year_suffix,10),d=k.fun.suffixator.format(o)),m+=d),k.output.append(m,this)},this.execs.push(i));else if(this.strings.term)i=function(k,w){var C=k.opt.gender[w.type],E=this.strings.term;E=k.getTerm(E,n,r,C,u.TOLERANT,this.default_locale);var B;if(E!==""&&(k.tmp.group_context.tip.term_intended=!0),u.UPDATE_GROUP_CONTEXT_CONDITION(k,E,null,this),!k.tmp.term_predecessor&&!(k.opt.class==="in-text"&&k.tmp.area==="citation")?B=u.Output.Formatters["capitalize-first"](k,E):B=E,k.tmp.strip_periods)B=B.replace(/\./g,"");else for(var _=0,S=this.decorations.length;_<S;_+=1)if(this.decorations[_][0]==="@strip-periods"&&this.decorations[_][1]==="true"){B=B.replace(/\./g,"");break}k.output.append(B,this),k.tmp.can_block_substitute&&k.tmp.can_substitute.replace(!1,u.LITERAL)},this.execs.push(i),e.build.term=!1,e.build.form=!1,e.build.plural=!1;else if(this.variables_real.length){if(i=function(k,w){this.variables_real[0]!=="locator"&&(k.tmp.have_collapsed=!1),!k.tmp.group_context.tip.condition&&w[this.variables[0]]&&(k.tmp.just_did_number=!1);var C=w[this.variables[0]];C&&!k.tmp.group_context.tip.condition&&((""+C).slice(-1).match(/[0-9]/)?k.tmp.just_did_number=!0:k.tmp.just_did_number=!1)},this.execs.push(i),u.MULTI_FIELDS.indexOf(this.variables_real[0])>-1||this.variables_real[0].indexOf("-main")>-1||this.variables_real[0].indexOf("-sub")>-1||["language-name","language-name-original"].indexOf(this.variables_real[0])>-1){var b=this.variables[0],y=!1,g=!1,x=!1;n==="short"?this.variables_real[0].slice(-6)!=="-short"&&(g=this.variables_real[0]+"-short"):b=!1,e.build.extension?x=!0:(x=!0,y=!0),i=e.transform.getOutputFunction(this.variables,b,y,g,x)}else u.CITE_FIELDS.indexOf(this.variables_real[0])>-1?i=function(k,w,C){C&&C[this.variables[0]]&&(k.processNumber(this,C,this.variables[0],w.type),u.Util.outputNumericField(k,this.variables[0],w.id),["locator","locator-extra"].indexOf(this.variables_real[0])>-1&&!k.tmp.just_looking&&k.tmp.done_vars.push(this.variables_real[0]))}:["page","page-first","chapter-number","collection-number","edition","issue","number","number-of-pages","number-of-volumes","volume"].indexOf(this.variables_real[0])>-1?i=function(k,w){k.processNumber(this,w,this.variables[0],w.type),u.Util.outputNumericField(k,this.variables[0],w.id)}:["URL","DOI"].indexOf(this.variables_real[0])>-1?i=function(k,w){var C;if(this.variables[0]&&(C=k.getVariable(w,this.variables[0],n),C))if(this.variables[0]==="URL"&&n==="short"&&(C=C.replace(/(.*\.[^\/]+)\/.*/,"$1"),C.match(/\/\/www\./)&&(C=C.replace(/https?:\/\//,""))),k.opt.development_extensions.wrap_url_and_doi)if(!this.decorations.length||this.decorations[0][0]!=="@"+this.variables[0]){var E=u.Util.cloneToken(this),B=new u.Blob(null,null,"url-wrapper");if(B.decorations.push(["@DOI","true"]),this.variables_real[0]==="DOI"){var _;this.strings.prefix&&this.strings.prefix.match(/^.*https:\/\/doi\.org\/$/)&&(C=C.replace(/^https?:\/\/doi\.org\//,""),C.match(/^https?:\/\//)?_="":_="https://doi.org/",E.strings.prefix=this.strings.prefix.slice(0,E.strings.prefix.length-16));var S=new u.Blob(_),T=new u.Blob(C);B.push(S),B.push(T),k.output.append(B,E,!1,!1,!0)}else{var T=new u.Blob(C);B.push(T),k.output.append(B,E,!1,!1,!0)}}else k.output.append(C,this,!1,!1,!0);else{if(this.decorations.length)for(var D=this.decorations.length-1;D>-1;D--)this.decorations[D][0]==="@"+this.variables[0]&&(this.decorations=this.decorations.slice(0,D).concat(this.decorations.slice(D+1)));k.output.append(C,this,!1,!1,!0)}}:this.variables_real[0]==="section"?i=function(k,w){var C;C=k.getVariable(w,this.variables[0],n),C&&k.output.append(C,this)}:this.variables_real[0]==="hereinafter"?i=function(k,w){var C=k.transform.abbrevs.default.hereinafter[w.id];C&&(k.output.append(C,this),k.tmp.group_context.tip.variable_success=!0)}:i=function(k,w){var C;this.variables[0]&&(C=k.getVariable(w,this.variables[0],n),C&&(C=""+C,C=C.split("\\").join(""),k.output.append(C,this)))};this.execs.push(i)}else this.strings.value&&(i=function(k){k.tmp.group_context.tip.term_intended=!0,u.UPDATE_GROUP_CONTEXT_CONDITION(k,this.strings.value,!0,this),k.output.append(this.strings.value,this),k.tmp.can_block_substitute&&k.tmp.can_substitute.replace(!1,u.LITERAL)},this.execs.push(i));t.push(this),u.Util.substituteEnd.call(this,e,t)}}};u.Node.intext={build:function(e,t){if(this.tokentype===u.START){e.build.area="intext",e.build.root="intext",e.build.extension="";var i=function(n,r){n.tmp.area="intext",n.tmp.root="intext",n.tmp.extension=""};this.execs.push(i)}this.tokentype===u.END&&(e.intext_sort={opt:{sort_directions:e.citation_sort.opt.sort_directions}},e.intext.srt=e.citation.srt),t.push(this)}};u.Attributes={};u.Attributes["@disambiguate"]=function(e,t){if(this.tests||(this.tests=[]),t==="true"){e.opt.has_disambiguate=!0;var i=function(n){if(e.tmp.area==="bibliography"){if(e.tmp.disambiguate_count<e.registry.registry[n.id].disambig.disambiguate)return e.tmp.disambiguate_count+=1,!0}else if(e.tmp.disambiguate_maxMax+=1,e.tmp.disambig_settings.disambiguate&&e.tmp.disambiguate_count<e.tmp.disambig_settings.disambiguate)return e.tmp.disambiguate_count+=1,!0;return!1};this.tests.push(i)}else if(t==="check-ambiguity-and-backreference"){var i=function(r){return!!(e.registry.registry[r.id].disambig.disambiguate&&e.registry.registry[r.id]["citation-count"]>1)};this.tests.push(i)}};u.Attributes["@is-numeric"]=function(e,t){this.tests||(this.tests=[]);for(var i=t.split(/\s+/),n=function(a){return function(o,l){var c=o;if(l&&["locator","locator-extra"].indexOf(a)>-1&&(c=l),!c[a])return!1;if(u.NUMERIC_VARIABLES.indexOf(a)>-1){if(e.tmp.shadow_numbers[a]||e.processNumber(!1,c,a,o.type),e.tmp.shadow_numbers[a].numeric)return!0}else if(["title","version"].indexOf(a)>-1&&c[a].slice(-1)===""+parseInt(c[a].slice(-1),10))return!0;return!1}},r=0;r<i.length;r+=1)this.tests.push(n(i[r]))};u.Attributes["@is-uncertain-date"]=function(e,t){this.tests||(this.tests=[]);for(var i=t.split(/\s+/),n=function(o){return function(l){return!!(l[o]&&l[o].circa)}},r=0,a=i.length;r<a;r+=1)this.tests.push(n(i[r]))};u.Attributes["@locator"]=function(e,t){this.tests||(this.tests=[]);var i=t.replace("sub verbo","sub-verbo");i=i.split(/\s+/);for(var n=function(o){return function(l,c){var f;return e.processNumber(!1,c,"locator"),f=e.tmp.shadow_numbers.locator.label,!!(f&&o===f)}},r=0,a=i.length;r<a;r+=1)this.tests.push(n(i[r]))};u.Attributes["@position"]=function(e,t){this.tests||(this.tests=[]);var i;e.opt.update_mode=u.POSITION;for(var n=t.split(/\s+/),r=function(f,p){return!!(p&&u.POSITION_MAP[p.position]>=u.POSITION_MAP[u.POSITION_SUBSEQUENT]&&p["near-note"])},a=function(f,p){return!!(p&&u.POSITION_MAP[p.position]==u.POSITION_MAP[u.POSITION_SUBSEQUENT]&&!p["near-note"])},o=function(f){return function(p,m){if(e.tmp.area==="bibliography")return!1;if(m&&typeof m.position>"u"&&(m.position=0),m&&typeof m.position=="number"){if(m.position===0&&f===0)return!0;if(f>0&&u.POSITION_MAP[m.position]>=u.POSITION_MAP[f])return!0}else if(f===0)return!0;return!1}},l=0,c=n.length;l<c;l+=1){var i=n[l];i==="first"?i=u.POSITION_FIRST:i==="container-subsequent"?i=u.POSITION_CONTAINER_SUBSEQUENT:i==="subsequent"?i=u.POSITION_SUBSEQUENT:i==="ibid"?i=u.POSITION_IBID:i==="ibid-with-locator"&&(i=u.POSITION_IBID_WITH_LOCATOR),i==="near-note"?this.tests.push(r):i==="far-note"?this.tests.push(a):this.tests.push(o(i))}};u.Attributes["@type"]=function(e,t){this.tests||(this.tests=[]);for(var i=t.split(/\s+/),n=function(l){return function(c){var f=c.type===l;return!!f}},r=[],a=0,o=i.length;a<o;a+=1)r.push(n(i[a]));this.tests.push(e.fun.match.any(this,e,r))};u.Attributes["@variable"]=function(e,t){this.tests||(this.tests=[]);var i;if(this.variables=t.split(/\s+/),this.variables_real=this.variables.slice(),this.name==="label"&&this.variables[0])this.strings.term=this.variables[0];else if(["names","date","text","number"].indexOf(this.name)>-1)i=function(o,l,c){for(var f=this.variables.length-1;f>-1;f+=-1)this.variables.pop();for(var f=0,p=this.variables_real.length;f<p;f++)o.tmp.done_vars.indexOf(this.variables_real[f])===-1&&this.variables.push(this.variables_real[f]),o.tmp.can_block_substitute&&o.tmp.done_vars.push(this.variables_real[f])},this.execs.push(i),i=function(o,l,c){for(var f=!1,p=0,m=this.variables.length;p<m;p++){var d=this.variables[p];if(["authority","committee"].indexOf(d)>-1&&typeof l[d]=="string"&&this.name==="names"){var h=!0,v=l[d].split(/\s*;\s*/),b={};if(l.multi&&l.multi._keys[d]){for(var y in l.multi._keys[d])if(b[y]=l.multi._keys[d][y].split(/\s*;\s*/),b[y].length!==v.length){h=!1;break}}h||(v=[l[d]],b=l.multi._keys[d]);for(var g=0,x=v.length;g<x;g++){var k={literal:v[g],multi:{_key:{}}};for(var y in b){var w={literal:b[y][g]};k.multi._key[y]=w}v[g]=k}l[d]=v}if(this.strings.form==="short"&&!l[d]&&(d==="title"?d="title-short":d==="container-title"&&(d="container-title-short")),d==="year-suffix"){f=!0;break}else if(u.DATE_VARIABLES.indexOf(d)>-1){if(o.opt.development_extensions.locator_date_and_revision&&d==="locator-date"){f=!0;break}if(l[d]){for(var C in l[d])if(!(this.dateparts.indexOf(C)===-1&&C!=="literal")&&l[d][C]){f=!0;break}if(f)break}}else if(d==="locator"){c&&c.locator&&(f=!0);break}else if(d==="locator-extra"){c&&c["locator-extra"]&&(f=!0);break}else if(["citation-number","citation-label"].indexOf(d)>-1){f=!0;break}else if(d==="first-reference-note-number"){c&&c["first-reference-note-number"]&&(f=!0);break}else if(d==="first-container-reference-note-number"){c&&c["first-container-reference-note-number"]&&(f=!0);break}else if(d==="hereinafter"){o.transform.abbrevs.default.hereinafter[l.id]&&o.sys.getAbbreviation&&l.id&&(f=!0);break}else{if(typeof l[d]=="object")break;if(typeof l[d]=="string"&&l[d]){f=!0;break}else if(typeof l[d]=="number"){f=!0;break}}if(f)break}if(f){for(var p=0,m=this.variables_real.length;p<m;p++){var d=this.variables_real[p];(d!=="citation-number"||o.tmp.area!=="bibliography")&&(o.tmp.cite_renders_content=!0),o.tmp.group_context.tip.variable_success=!0,o.tmp.can_substitute.value()&&o.tmp.area==="bibliography"&&typeof l[d]=="string"&&(o.tmp.name_node.top=o.output.current.value(),o.tmp.rendered_name.push(l[d]))}o.tmp.can_substitute.replace(!1,u.LITERAL)}else o.tmp.group_context.tip.variable_attempt=!0},this.execs.push(i);else if(["if","else-if","condition"].indexOf(this.name)>-1)for(var n=function(o){return function(l,c){var f=l;if(c&&["locator","locator-extra","first-reference-note-number","first-container-reference-note-number","locator-date"].indexOf(o)>-1&&(f=c),o==="hereinafter"&&e.sys.getAbbreviation&&f.id){if(e.transform.abbrevs.default.hereinafter[f.id])return!0}else if(f[o]){if(typeof f[o]=="number"||typeof f[o]=="string")return!0;if(typeof f[o]=="object"){for(var p in f[o])if(f[o][p])return!0}}return!1}},r=0,a=this.variables.length;r<a;r+=1)this.tests.push(n(this.variables[r]))};u.Attributes["@page"]=function(e,t){this.tests||(this.tests=[]);var i=t.replace("sub verbo","sub-verbo");i=i.split(/\s+/);for(var n=function(o){return function(l){var c;return e.processNumber(!1,l,"page",l.type),e.tmp.shadow_numbers.page.label?e.tmp.shadow_numbers.page.label==="sub verbo"?c="sub-verbo":c=e.tmp.shadow_numbers.page.label:c="page",e.tmp.shadow_numbers.page.values.length>0&&e.tmp.shadow_numbers.page.values[0].gotosleepability&&(e.tmp.shadow_numbers.page.values[0].labelVisibility=!1),o===c}},r=0,a=i.length;r<a;r+=1)this.tests.push(n(i[r]))};u.Attributes["@number"]=function(e,t){this.tests||(this.tests=[]);for(var i=t.split(/\s+/),n=function(o){return function(l){var c;return e.processNumber(!1,l,"number",l.type),e.tmp.shadow_numbers.number.label?c=e.tmp.shadow_numbers.number.label:c="number",o===c}},r=0,a=i.length;r<a;r+=1)this.tests.push(n(i[r]))};u.Attributes["@jurisdiction"]=function(e,t){this.tests||(this.tests=[]);var i=t.split(/\s+/),n=function(r){return function(a){if(!a.jurisdiction)return!1;for(var o=a.jurisdiction,l=0,c=r.length;l<c;l++)if(o===r[l])return!0;return!1}};this.tests.push(n(i))};u.Attributes["@country"]=function(e,t){this.tests||(this.tests=[]);var i=t.split(/\s+/),n=function(r){return function(a){if(!a.country)return!1;for(var o=a.country,l=0,c=r.length;l<c;l++)if(o===r[l])return!0;return!1}};this.tests.push(n(i))};u.Attributes["@context"]=function(e,t){this.tests||(this.tests=[]);var i=function(){if(["bibliography","citation"].indexOf(t)>-1){var n=e.tmp.area.slice(0,t.length);return n===t}else if(t==="alternative")return!!e.tmp.abort_alternative};this.tests.push(i)};u.Attributes["@has-year-only"]=function(e,t){this.tests||(this.tests=[]);for(var i=t.split(/\s+/),n=function(o){return function(l){var c=l[o];return!(!c||c.month||c.season)}},r=0,a=i.length;r<a;r+=1)this.tests.push(n(i[r]))};u.Attributes["@has-to-month-or-season"]=function(e,t){this.tests||(this.tests=[]);for(var i=t.split(/\s+/),n=function(o){return function(l){var c=l[o];return!(!c||!c.month&&!c.season||c.day)}},r=0,a=i.length;r<a;r+=1)this.tests.push(n(i[r]))};u.Attributes["@has-day"]=function(e,t){this.tests||(this.tests=[]);for(var i=t.split(/\s+/),n=function(o){return function(l){var c=l[o];return!(!c||!c.day)}},r=0,a=i.length;r<a;r+=1)this.tests.push(n(i[r]))};u.Attributes["@is-plural"]=function(e,t){this.tests||(this.tests=[]);var i=function(n){var r=n[t];if(r&&r.length){for(var a=0,o=0,l=!1,c=0,f=r.length;c<f;c+=1)e.opt.development_extensions.spoof_institutional_affiliations&&(r[c].literal||r[c].isInstitution&&r[c].family&&!r[c].given)?(o+=1,l=!1):(a+=1,l=!0);if(a>1)return!0;if(o>1)return!0;if(o&&l)return!0}return!1};this.tests.push(i)};u.Attributes["@is-multiple"]=function(e,t){this.tests||(this.tests=[]);var i=function(n){var r=""+n[t],a=r.split(/(?:,\s|\s(?:tot\sen\smet|līdz|oraz|and|bis|έως|και|och|až|do|en|et|in|ir|ja|og|sa|to|un|und|és|și|i|u|y|à|e|a|и|-|–)\s|—|\&)/);return a.length>1};this.tests.push(i)};u.Attributes["@locale"]=function(e,t){this.tests||(this.tests=[]);var i,n,r,a,o,l=e.opt["default-locale"][0];if(this.name==="layout"){if(this.locale_raw=t,this.tokentype===u.START){e.opt.multi_layout||(e.opt.multi_layout=[]);var c=[],f=t.split(/\s+/),p={},m=u.localeResolve(f[0],l);c.push(m),m.generic?p[m.generic]=m.best:p[m.best]=m.best;for(var a=1,o=f.length;a<o;a+=1){var d=u.localeResolve(f[a],l);c.push(d),d.generic?p[d.generic]=m.best:p[d.best]=m.best}e[e.build.area].opt.sort_locales.push(p),e.opt.multi_layout.push(c)}e.opt.has_layout_locale=!0}else{r=t.split(/\s+/);var h=[];for(a=0,o=r.length;a<o;a+=1)n=r[a],i=u.localeResolve(n,l),r[a].length===2&&h.push(i.bare),e.localeConfigure(i,!0),r[a]=i;var v=r.slice(),b=function(y,g,x){return function(k){var w;w=!1;var C=!1,E;for(k.language?E=k.language:E=g,C=u.localeResolve(E,g),a=0,o=y.length;a<o;a+=1)if(C.best===y[a].best){e.tmp.condition_lang_counter_arr.push(e.tmp.condition_counter),e.tmp.condition_lang_val_arr.push(e.opt.lang),e.opt.lang=y[0].best,w=!0;break}return!w&&x.indexOf(C.bare)>-1&&(e.tmp.condition_lang_counter_arr.push(e.tmp.condition_counter),e.tmp.condition_lang_val_arr.push(e.opt.lang),e.opt.lang=y[0].best,w=!0),w}};this.tests.push(b(v,l,h))}};u.Attributes["@alternative-node-internal"]=function(e){this.tests||(this.tests=[]);var t=function(){return function(){return!e.tmp.abort_alternative}};this.tests.push(t())};u.Attributes["@locale-internal"]=function(e,t){this.tests||(this.tests=[]);var i,n,r,a,o;for(r=t.split(/\s+/),this.locale_bares=[],a=0,o=r.length;a<o;a+=1)n=r[a],i=u.localeResolve(n,e.opt["default-locale"][0]),r[a].length===2&&this.locale_bares.push(i.bare),e.localeConfigure(i),r[a]=i;this.locale_default=e.opt["default-locale"][0],this.locale=r[0].best,this.locale_list=r.slice();var l=function(f){return function(p){var m;m=!1;var d=!1;if(p.language&&(n=p.language,d=u.localeResolve(n,e.opt["default-locale"][0]),d.best===e.opt["default-locale"][0]&&(d=!1)),d){for(a=0,o=f.locale_list.length;a<o;a+=1)if(d.best===f.locale_list[a].best){e.opt.lang=f.locale,e.tmp.last_cite_locale=f.locale,e.output.openLevel("empty"),e.output.current.value().new_locale=f.locale,m=!0;break}!m&&f.locale_bares.indexOf(d.bare)>-1&&(e.opt.lang=f.locale,e.tmp.last_cite_locale=f.locale,e.output.openLevel("empty"),e.output.current.value().new_locale=f.locale,m=!0)}return m}},c=this;this.tests.push(l(c))};u.Attributes["@court-class"]=function(e,t){this.tests||(this.tests=[]);for(var i=t.split(/\s+/),n=function(o){return function(l){var c=u.GET_COURT_CLASS(e,l);return c===o}},r=0,a=i.length;r<a;r++)this.tests.push(n(i[r]))};u.Attributes["@container-multiple"]=function(e,t){this.tests||(this.tests=[]);var i=t==="true",n=function(r){return function(a){if(e.tmp.container_item_count[a.container_id]){if(e.tmp.container_item_count[a.container_id]>1)return r}else return!r;return!r}};this.tests.push(n(i))};u.Attributes["@container-subsequent"]=function(e,t){this.tests||(this.tests=[]);var i=t==="true",n=function(r){return function(a){return e.tmp.container_item_pos[a.container_id]>1?r:!r}};this.tests.push(n(i))};u.Attributes["@has-subunit"]=function(e,t){this.tests||(this.tests=[]);var i=function(n){return function(r){var a=0;for(var o in r[n]){var l=r[n][o];if(!l.given){var c=l.literal?l.literal:l.family,f=c.split("|").length;(a===0||f<a)&&(a=f)}}return a>1}};this.tests.push(i(t))};u.Attributes["@cite-form"]=function(e,t){this.tests||(this.tests=[]);var i=function(n){return function(r){return r["cite-form"]===n}};this.tests.push(i(t))};u.Attributes["@disable-duplicate-year-suppression"]=function(e,t){e.opt.disable_duplicate_year_suppression=t.split(/\s+/)};u.Attributes["@consolidate-containers"]=function(e,t){u.Attributes["@track-containers"](e,t);var i=t.split(/\s+/);e.bibliography.opt.consolidate_containers=i};u.Attributes["@track-containers"]=function(e,t){var i=t.split(/\s+/);e.bibliography.opt.track_container_items||(e.bibliography.opt.track_container_items=[]),e.bibliography.opt.consolidate_containers||(e.bibliography.opt.consolidate_containers=[]),e.bibliography.opt.track_container_items=e.bibliography.opt.track_container_items.concat(i)};u.Attributes["@parallel-first"]=function(e,t){e.opt.parallel.enable=!0;var i=t.split(/\s+/);e.opt.track_repeat||(e.opt.track_repeat={}),this.parallel_first={};for(var n in i){var r=i[n];this.parallel_first[r]=!0,e.opt.track_repeat[r]=!0}};u.Attributes["@parallel-last"]=function(e,t){e.opt.parallel.enable=!0;var i=t.split(/\s+/);e.opt.track_repeat||(e.opt.track_repeat={}),this.parallel_last={};for(var n in i){var r=i[n];this.parallel_last[r]=!0,e.opt.track_repeat[r]=!0}};u.Attributes["@parallel-last-to-first"]=function(e,t){e.opt.parallel.enable=!0;var i=t.split(/\s+/);this.parallel_last_to_first={};for(var n=0,r=i.length;n<r;n++)this.parallel_last_to_first[i[n]]=!0};u.Attributes["@parallel-delimiter-override"]=function(e,t){e.opt.parallel.enable=!0,this.strings.set_parallel_delimiter_override=t};u.Attributes["@parallel-delimiter-override-on-suppress"]=function(e,t){e.opt.parallel.enable=!0,this.strings.set_parallel_delimiter_override_on_suppress=t};u.Attributes["@no-repeat"]=function(e,t){e.opt.parallel.enable=!0;var i=t.split(/\s+/);e.opt.track_repeat||(e.opt.track_repeat={}),this.non_parallel={};for(var n in i){var r=i[n];this.non_parallel[r]=!0,e.opt.track_repeat[r]=!0}};u.Attributes["@require"]=function(e,t){e.opt.use_context_condition=!0,this.strings.require=t};u.Attributes["@reject"]=function(e,t){e.opt.use_context_condition=!0,this.strings.reject=t};u.Attributes["@require-comma-on-symbol"]=function(e,t){e.opt.require_comma_on_symbol=t};u.Attributes["@gender"]=function(e,t){this.gender=t};u.Attributes["@cslid"]=function(e,t){this.cslid=parseInt(t,10)};u.Attributes["@capitalize-if-first"]=function(e,t){this.strings.capitalize_if_first_override=t};u.Attributes["@label-capitalize-if-first"]=function(e,t){this.strings.label_capitalize_if_first_override=t};u.Attributes["@label-form"]=function(e,t){this.strings.label_form_override=t};u.Attributes["@part-separator"]=function(e,t){this.strings["part-separator"]=t};u.Attributes["@leading-noise-words"]=function(e,t){this["leading-noise-words"]=t};u.Attributes["@name-never-short"]=function(e,t){this["name-never-short"]=t};u.Attributes["@class"]=function(e,t){e.opt.class=t};u.Attributes["@version"]=function(e,t){e.opt.version=t};u.Attributes["@value"]=function(e,t){this.strings.value=t};u.Attributes["@name"]=function(e,t){this.strings.name=t};u.Attributes["@form"]=function(e,t){this.strings.form=t};u.Attributes["@date-parts"]=function(e,t){this.strings["date-parts"]=t};u.Attributes["@range-delimiter"]=function(e,t){this.strings["range-delimiter"]=t};u.Attributes["@macro"]=function(e,t){this.postponed_macro=t};u.Attributes["@term"]=function(e,t){t==="sub verbo"?this.strings.term="sub-verbo":this.strings.term=t};u.Attributes["@xmlns"]=function(){};u.Attributes["@lang"]=function(e,t){t&&(e.build.lang=t)};u.Attributes["@lingo"]=function(){};u.Attributes["@macro-has-date"]=function(){this["macro-has-date"]=!0};u.Attributes["@suffix"]=function(e,t){this.strings.suffix=t};u.Attributes["@prefix"]=function(e,t){this.strings.prefix=t};u.Attributes["@delimiter"]=function(e,t){this.strings.delimiter=t};u.Attributes["@match"]=function(e,t){this.match=t};u.Attributes["@names-min"]=function(e,t){var i=parseInt(t,10);e[e.build.area].opt.max_number_of_names<i&&(e[e.build.area].opt.max_number_of_names=i),this.strings["et-al-min"]=i};u.Attributes["@names-use-first"]=function(e,t){this.strings["et-al-use-first"]=parseInt(t,10)};u.Attributes["@names-use-last"]=function(e,t){t==="true"?this.strings["et-al-use-last"]=!0:this.strings["et-al-use-last"]=!1};u.Attributes["@sort"]=function(e,t){t==="descending"&&(this.strings.sort_direction=u.DESCENDING)};u.Attributes["@plural"]=function(e,t){t==="always"||t==="true"?this.strings.plural=1:t==="never"||t==="false"?this.strings.plural=0:t==="contextual"&&(this.strings.plural=!1)};u.Attributes["@has-publisher-and-publisher-place"]=function(){this.strings["has-publisher-and-publisher-place"]=!0};u.Attributes["@publisher-delimiter-precedes-last"]=function(e,t){this.strings["publisher-delimiter-precedes-last"]=t};u.Attributes["@publisher-delimiter"]=function(e,t){this.strings["publisher-delimiter"]=t};u.Attributes["@publisher-and"]=function(e,t){this.strings["publisher-and"]=t};u.Attributes["@givenname-disambiguation-rule"]=function(e,t){u.GIVENNAME_DISAMBIGUATION_RULES.indexOf(t)>-1&&(e.citation.opt["givenname-disambiguation-rule"]=t)};u.Attributes["@collapse"]=function(e,t){t&&(e[this.name].opt.collapse=t)};u.Attributes["@cite-group-delimiter"]=function(e,t){t&&(e[e.tmp.area].opt.cite_group_delimiter=t)};u.Attributes["@names-delimiter"]=function(e,t){e.setOpt(this,"names-delimiter",t)};u.Attributes["@name-form"]=function(e,t){e.setOpt(this,"name-form",t)};u.Attributes["@subgroup-delimiter"]=function(e,t){this.strings["subgroup-delimiter"]=t};u.Attributes["@subgroup-delimiter-precedes-last"]=function(e,t){this.strings["subgroup-delimiter-precedes-last"]=t};u.Attributes["@name-delimiter"]=function(e,t){e.setOpt(this,"name-delimiter",t)};u.Attributes["@et-al-min"]=function(e,t){var i=parseInt(t,10);e[e.build.area].opt.max_number_of_names<i&&(e[e.build.area].opt.max_number_of_names=i),e.setOpt(this,"et-al-min",i)};u.Attributes["@et-al-use-first"]=function(e,t){e.setOpt(this,"et-al-use-first",parseInt(t,10))};u.Attributes["@et-al-use-last"]=function(e,t){t==="true"?e.setOpt(this,"et-al-use-last",!0):e.setOpt(this,"et-al-use-last",!1)};u.Attributes["@et-al-subsequent-min"]=function(e,t){var i=parseInt(t,10);e[e.build.area].opt.max_number_of_names<i&&(e[e.build.area].opt.max_number_of_names=i),e.setOpt(this,"et-al-subsequent-min",i)};u.Attributes["@et-al-subsequent-use-first"]=function(e,t){e.setOpt(this,"et-al-subsequent-use-first",parseInt(t,10))};u.Attributes["@suppress-min"]=function(e,t){this.strings["suppress-min"]=parseInt(t,10)};u.Attributes["@suppress-max"]=function(e,t){this.strings["suppress-max"]=parseInt(t,10)};u.Attributes["@and"]=function(e,t){e.setOpt(this,"and",t)};u.Attributes["@delimiter-precedes-last"]=function(e,t){e.setOpt(this,"delimiter-precedes-last",t)};u.Attributes["@delimiter-precedes-et-al"]=function(e,t){e.setOpt(this,"delimiter-precedes-et-al",t)};u.Attributes["@initialize-with"]=function(e,t){e.setOpt(this,"initialize-with",t)};u.Attributes["@initialize"]=function(e,t){t==="false"&&e.setOpt(this,"initialize",!1)};u.Attributes["@name-as-reverse-order"]=function(e,t){this["name-as-reverse-order"]=t};u.Attributes["@name-as-sort-order"]=function(e,t){this.name==="style-options"?this["name-as-sort-order"]=t:e.setOpt(this,"name-as-sort-order",t)};u.Attributes["@sort-separator"]=function(e,t){e.setOpt(this,"sort-separator",t)};u.Attributes["@require-match"]=function(e,t){t==="true"&&(this.requireMatch=!0)};u.Attributes["@exclude-types"]=function(e,t){e.bibliography.opt.exclude_types=t.split(/\s+/)};u.Attributes["@exclude-with-fields"]=function(e,t){e.bibliography.opt.exclude_with_fields=t.split(/\s+/)};u.Attributes["@year-suffix-delimiter"]=function(e,t){e[this.name].opt["year-suffix-delimiter"]=t};u.Attributes["@after-collapse-delimiter"]=function(e,t){e[this.name].opt["after-collapse-delimiter"]=t};u.Attributes["@subsequent-author-substitute"]=function(e,t){e[this.name].opt["subsequent-author-substitute"]=t};u.Attributes["@subsequent-author-substitute-rule"]=function(e,t){e[this.name].opt["subsequent-author-substitute-rule"]=t};u.Attributes["@disambiguate-add-names"]=function(e,t){t==="true"&&(e.opt["disambiguate-add-names"]=!0)};u.Attributes["@disambiguate-add-givenname"]=function(e,t){t==="true"&&(e.opt["disambiguate-add-givenname"]=!0)};u.Attributes["@disambiguate-add-year-suffix"]=function(e,t){t==="true"&&e.opt.xclass!=="numeric"&&(e.opt["disambiguate-add-year-suffix"]=!0)};u.Attributes["@second-field-align"]=function(e,t){(t==="flush"||t==="margin")&&(e[this.name].opt["second-field-align"]=t)};u.Attributes["@hanging-indent"]=function(e,t){t==="true"&&(e.opt.development_extensions.hanging_indent_legacy_number?e[this.name].opt.hangingindent=2:e[this.name].opt.hangingindent=!0)};u.Attributes["@line-spacing"]=function(e,t){t&&t.match(/^[.0-9]+$/)&&(e[this.name].opt["line-spacing"]=parseFloat(t,10))};u.Attributes["@entry-spacing"]=function(e,t){t&&t.match(/^[.0-9]+$/)&&(e[this.name].opt["entry-spacing"]=parseFloat(t,10))};u.Attributes["@near-note-distance"]=function(e,t){e[this.name].opt["near-note-distance"]=parseInt(t,10)};u.Attributes["@substring"]=function(e,t){this.substring=parseInt(t,10)};u.Attributes["@text-case"]=function(e,t){var i=function(n,r){t==="normal"?this.text_case_normal=!0:(this.strings["text-case"]=t,t==="title"&&r.jurisdiction&&(this.strings["text-case"]="passthrough"))};this.execs.push(i)};u.Attributes["@page-range-format"]=function(e,t){e.opt["page-range-format"]=t};u.Attributes["@year-range-format"]=function(e,t){e.opt["year-range-format"]=t};u.Attributes["@default-locale"]=function(e,t){if(this.name==="style"){var i,n,r,o,a,o=t.match(/-x-(sort|translit|translat)-/g);if(o)for(r=0,n=o.length;r<n;r+=1)o[r]=o[r].replace(/^-x-/,"").replace(/-$/,"");for(i=t.split(/-x-(?:sort|translit|translat)-/),a=[i[0]],r=1,n=i.length;r<n;r+=1)a.push(o[r-1]),a.push(i[r]);for(i=a.slice(),n=i.length,r=1;r<n;r+=2)e.opt["locale-"+i[r]].push(i[r+1].replace(/^\s*/g,"").replace(/\s*$/g,""));i.length?e.opt["default-locale"]=i.slice(0,1):e.opt["default-locale"]=["en"]}else t==="true"&&(this.default_locale=!0)};u.Attributes["@default-locale-sort"]=function(e,t){e.opt["default-locale-sort"]=t};u.Attributes["@demote-non-dropping-particle"]=function(e,t){e.opt["demote-non-dropping-particle"]=t};u.Attributes["@initialize-with-hyphen"]=function(e,t){t==="false"&&(e.opt["initialize-with-hyphen"]=!1)};u.Attributes["@institution-parts"]=function(e,t){this.strings["institution-parts"]=t};u.Attributes["@if-short"]=function(e,t){t==="true"&&(this.strings["if-short"]=!0)};u.Attributes["@substitute-use-first"]=function(e,t){this.strings["substitute-use-first"]=parseInt(t,10)};u.Attributes["@use-first"]=function(e,t){this.strings["use-first"]=parseInt(t,10)};u.Attributes["@use-last"]=function(e,t){this.strings["use-last"]=parseInt(t,10)};u.Attributes["@stop-first"]=function(e,t){this.strings["stop-first"]=parseInt(t,10)};u.Attributes["@stop-last"]=function(e,t){this.strings["stop-last"]=parseInt(t,10)*-1};u.Attributes["@reverse-order"]=function(e,t){t==="true"&&(this.strings["reverse-order"]=!0)};u.Attributes["@display"]=function(e,t){e.bibliography.tokens.length===2&&(e.opt.using_display=!0),this.strings.cls=t};u.Stack=function(e,t){this.mystack=[],(t||e)&&this.mystack.push(e),this.tip=this.mystack[0]};u.Stack.prototype.push=function(e,t){t||e?this.mystack.push(e):this.mystack.push(""),this.tip=this.mystack[this.mystack.length-1]};u.Stack.prototype.clear=function(){this.mystack=[],this.tip={}};u.Stack.prototype.replace=function(e,t){this.mystack.length===0&&u.error("Internal CSL processor error: attempt to replace nonexistent stack item with "+e),t||e?this.mystack[this.mystack.length-1]=e:this.mystack[this.mystack.length-1]="",this.tip=this.mystack[this.mystack.length-1]};u.Stack.prototype.pop=function(){var e=this.mystack.pop();return this.mystack.length?this.tip=this.mystack[this.mystack.length-1]:this.tip={},e};u.Stack.prototype.value=function(){return this.mystack.slice(-1)[0]};u.Stack.prototype.length=function(){return this.mystack.length};u.Parallel=function(e){this.state=e};u.Parallel.prototype.StartCitation=function(e,t){if(this.state.tmp.suppress_repeats=[],!(e.length<2)){for(var i=0,n=!1,r=[],a=0,o=e.length-1;a<o;a++){var l=e[a][0],c=e[a+1][0],f=!1,p={};if(e[a][0].seeAlso&&e[a][0].seeAlso.length>0&&!n){f=!0,n=[e[a][0].id].concat(e[a][0].seeAlso);var m=n.slice(),d=e.slice(a);d[0][1].parallel="first";for(var h=0,v=d.length;h<v;h++){var b=d[h][0].id,y=m.indexOf(b);if(i=!1,y===-1?i=a+h-1:a+h===e.length-1&&(i=a+h),i){r.push([a,i]);break}else m=m.slice(0,y).concat(m.slice(y+1))}}a>0&&f&&(this.state.tmp.suppress_repeats[a-1].START=!0,f=!1);for(var g in this.state.opt.track_repeat)if(!l[g]||!c[g])p[g]=!1;else if(typeof c[g]=="string"||typeof c[g]=="number"){if(g==="title"&&l["title-short"]&&c["title-short"])var x=l["title-short"],k=c["title-short"];else var x=l[g],k=c[g];x==k?p[g]=!0:p[g]=!1}else if(typeof l[g].length>"u"){p[g]=!1;var w=l[g].year,C=c[g].year;w&&C&&w==C&&(p[g]=!0)}else{var x=JSON.stringify(l[g]),k=JSON.stringify(c[g]);x===k?p[g]=!0:p[g]=!1}n||(p.ORPHAN=!0),i===a&&(p.END=!0,n=!1),this.state.tmp.suppress_repeats.push(p)}for(var h=0,v=r.length;h<v;h++){var E=e[r[h][0]][0].id;this.state.registry.registry[E].master=!0,this.state.registry.registry[E].siblings=[];for(var B=r[h][0],_=r[h][1],S=B;S<_;S++){this.state.tmp.suppress_repeats[S].SIBLING=!0;var T=e[S+1][0].id;e[S+1][1].parallel="other",this.state.registry.registry[E].siblings.push(T)}}}};u.Parallel.prototype.checkRepeats=function(e){var t=this.state.tmp.cite_index;if(this.state.tmp.suppress_repeats){if(e.parallel_first&&Object.keys(e.parallel_first).length>0){var i=[{}].concat(this.state.tmp.suppress_repeats),n=!0;for(var r in e.parallel_first)(!i[t][r]||i[t].START)&&(n=!1);return n}if(e.parallel_last&&Object.keys(e.parallel_last).length>0){var i=this.state.tmp.suppress_repeats.concat([{}]),n=Object.keys(e.parallel_last).length>0;for(var r in e.parallel_last)(!i[t][r]||i[t].END)&&(n=!1);return n}if(e.non_parallel&&Object.keys(e.non_parallel).length>0){var i=[{}].concat(this.state.tmp.suppress_repeats),n=!0;for(var r in e.non_parallel)i[t][r]||(n=!1);return n}}return!1};u.Util={};u.Util.Match=function(){this.any=function(e,t,i){return function(n,r){for(var a=0,o=i.length;a<o;a+=1){var l=i[a](n,r);if(l)return!0}return!1}},this.none=function(e,t,i){return function(n,r){for(var a=0,o=i.length;a<o;a+=1){var l=i[a](n,r);if(l)return!1}return!0}},this.all=function(e,t,i){return function(n,r){for(var a=0,o=i.length;a<o;a+=1){var l=i[a](n,r);if(!l)return!1}return!0}},this[void 0]=this.all,this.nand=function(e,t,i){return function(n,r){for(var a=0,o=i.length;a<o;a+=1){var l=i[a](n,r);if(!l)return!0}return!1}}};u.Transform=function(e){this.abbrevs={},this.abbrevs.default=new e.sys.AbbreviationSegments;function t(p,m,d){var h="";return e.sys.getHumanForm&&(p==="country"?(h=e.sys.getHumanForm(m.toLowerCase(),!1,!0),h=h.split("|")[0]):p==="jurisdiction"&&(h=e.sys.getHumanForm(m.toLowerCase(),!1,!0),d?h="":h=h.split("|").slice(1).join(", "))),h}function i(p,m,d,h,v,b,y){var g="",x=u.FIELD_CATEGORY_REMAP[b],k;if(!x)return v;var w=b,C=v;p.sys.normalizeAbbrevsKey&&(C=p.sys.normalizeAbbrevsKey(b,v));var E=!1;if(w==="jurisdiction"&&C&&(E=C.indexOf(":")===-1),["jurisdiction","country"].indexOf(b)>-1&&v===v.toLowerCase()&&(C=v.toUpperCase()),p.sys.getAbbreviation){["jurisdiction","country","language-name","language-name-original"].indexOf(w)>-1?k="default":d.jurisdiction?k=d.jurisdiction:k="default";var B=p.transform.loadAbbreviation(k,x,C,d.language);if(p.transform.abbrevs[B][x]&&C){var _=p.transform.abbrevs[B][x][C];m.strings.form==="short"&&_?E?g="":g=_:g=t(w,C,E)}}return!g&&(!p.opt.development_extensions.require_explicit_legal_case_title_short||d.type!=="legal_case")&&h&&d[h]&&y&&(g=d[h]),!g&&!p.sys.getAbbreviation&&p.sys.getHumanForm&&(g=t(w,C,E)),!g&&!E&&(!p.sys.getHumanForm||w!=="jurisdiction")&&(g=v),p.opt.development_extensions.force_title_abbrev_fallback&&w==="title"&&g===v&&d["title-short"]&&(g=d["title-short"]),g}function n(p,m){var d=e.opt["default-locale"][0].slice(0,2),h;if(e.opt.development_extensions.strict_text_case_locales?h=new RegExp("^([a-zA-Z]{2})(?:$|-.*| .*)"):h=new RegExp("^([a-zA-Z]{2})(?:$|-.*|.*)"),p.language){var v=(""+p.language).match(h);v?d=v[1]:d="tlh"}return p.multi&&p.multi&&p.multi.main&&p.multi.main[m]&&(d=p.multi.main[m]),(!e.opt.development_extensions.strict_text_case_locales||e.opt.development_extensions.normalize_lang_keys_to_lowercase)&&(d=d.toLowerCase()),d}function r(p,m,d,h,v,b){var y,g,x,k,w=v,C=!1;if(!p[m])return{name:"",usedOrig:v,token:u.Util.cloneToken(this)};var E=!1;u.VARIABLES_WITH_SHORT_FORM.indexOf(m)>-1&&b&&(m=m+"-short",E=!0);var B=!1,_=null,S=[];m.slice(-6)==="-short"?(S.push(m),S.push(m.slice(0,-6))):S.push(m);for(var T=0,D=S.length;T<D;T++){var H=!1,m=S[T];x={name:"",usedOrig:v,locale:n(p,m)},k=e.opt[d]?e.opt[d].slice():[];var V=!1;if(d==="locale-orig"?(v||(x.name=p[m],x.usedOrig=!1),V=!0,C=!0):h&&(typeof k>"u"||k.length===0)&&(x.name=p[m],x.usedOrig=!0,V=!0,C=!0),!V){for(var M=0,$=k.length;M<$;M+=1)if(y=k[M],g=y.split(/[\-_]/)[0],y&&p.multi&&p.multi._keys[m]&&p.multi._keys[m][y]){x.name=p.multi._keys[m][y],x.locale=y,V=!0,H=!0,C=!1;break}else if(g&&p.multi&&p.multi._keys[m]&&p.multi._keys[m][g]){x.name=p.multi._keys[m][g],x.locale=g,V=!0,H=!0,C=!1;break}!x.name&&h&&(x={name:p[m],usedOrig:!0,locale:n(p,m)},C=!0)}if(x.token=u.Util.cloneToken(this),T===0?(H&&(x.found_variant_ok=!0),_=x,!E&&(typeof k>"u"||k.length===0)&&(B=!0),H&&(B=!0)):!E&&!H&&_?(x=_,m=S[0]):H&&(x.found_variant_ok=!0),["title","container-title"].indexOf(m)>-1&&!w&&(!x.token.strings["text-case"]||x.token.strings["text-case"]==="sentence"||x.token.strings["text-case"]==="normal")){e.opt.lang;var P;C?P=!1:P=x.locale;var W=m.slice(0,-5),L=x.token.strings["text-case"]==="sentence";x.name=u.titlecaseSentenceOrNormal(e,p,W,P,L),delete x.token.strings["text-case"]}if(B)break}return x}this.getTextSubField=r;function a(p,m,d,h){p||(p="default");var v=p.split(":")[0],b=u.getAbbrevsDomain(e,v,h);return b&&(p+="@"+b),d?(e.sys.getAbbreviation&&(p=e.sys.getAbbreviation(e.opt.styleID,e.transform.abbrevs,p,m,d),p||(p="default",b&&(p+="@"+b))),p):(e.transform.abbrevs[p]||(e.transform.abbrevs[p]=new e.sys.AbbreviationSegments),e.transform.abbrevs[p][m]||(e.transform.abbrevs[p][m]={}),p)}this.loadAbbreviation=a;function o(p,m,d,h){var v=p.variables[0];if(e.publisherOutput&&d){if(["publisher","publisher-place"].indexOf(v)===-1)return!1;e.publisherOutput[v+"-token"]=p,e.publisherOutput.varlist.push(v);var b=d.split(/;\s*/);b.length===e.publisherOutput[v+"-list"].length&&(e.publisherOutput[v+"-list"]=b);for(var y=0,g=b.length;y<g;y+=1)b[y]=i(e,p,m,!1,b[y],h,!0);return e.tmp[v+"-token"]=p,!0}return!1}function l(p,m){var d=m.match(/^#([0-9]+).*>>>/);d&&d[1]&&(p["cite-form"]=d[1])}function c(p,m){var d=m.match(/^(?:#[0-9]+)*(?:!((?:[-_a-z]+(?:(?:.*)))(?:,(?:[-_a-z]+(?:(?:.*))))*))*>>>/);if(d&&(m=m.slice(d[0].length),d[1]))for(var h=d[1].split(","),v=0,b=h.length;v<b;v+=1){var y=h[v],g=y.match(/^([-_a-z]+)(?:\:(.*))*$/),x=g[1],k=e.tmp.abbrev_trimmer;g[2]?k&&p&&(k[p]||(k[p]={}),k[p][x]=g[2]):e.tmp.done_vars.indexOf(x)===-1&&(k&&p&&(k.QUASHES[p]||(k.QUASHES[p]={}),k.QUASHES[p][x]=!0),e.tmp.done_vars.push(x))}return m}this.quashCheck=c;function f(p,m,d,h){var v,b=u.LangPrefsMap[p[0]];return b?v=e.opt["cite-lang-prefs"][b]:v=!1,function(y,g,x){var k,w,C,E,B,_,$;if(!p[0]||!g[p[0]]&&!g[h]||!y.tmp.just_looking&&x&&x["suppress-author"]&&!y.tmp.probably_rendered_something&&y.tmp.can_substitute.length()>1)return null;var S={primary:!1,secondary:!1,tertiary:!1};if(y.tmp.area.slice(-5)==="_sort")S.primary="locale-sort";else if(v&&v.length===1&&v[0]==="locale-orig")S.primary="locale-orig",v=!1;else if(v&&!y.tmp.multi_layout)for(var T=["primary","secondary","tertiary"],D=0,H=T.length;D<H&&!(v.length-1<D);D+=1)v[D]&&(S[T[D]]="locale-"+v[D]);else S.primary="locale-orig";if((p[0]==="title-short"||y.tmp.area!=="bibliography"&&!(y.tmp.area==="citation"&&y.opt.xclass==="note"&&x&&!x.position))&&(S.secondary=!1,S.tertiary=!1),y.tmp.multi_layout&&(S.secondary=!1,S.tertiary=!1),y.tmp["publisher-list"])return p[0]==="publisher"?y.tmp["publisher-token"]=this:p[0]==="publisher-place"&&(y.tmp["publisher-place-token"]=this),null;var V=y.tmp.lang_array.slice(),M=r.call(this,g,p[0],S.primary,!0,null,m);k=M.name,w=M.locale;var $=M.token,P=M.usedOrig;if(m&&!M.found_variant_ok&&(k=i(y,$,g,h,k,m,!0),k&&(l(g,k),y.tmp.just_looking||(k=c(g.jurisdiction,k)))),o(this,g,k,m))return y.tmp.lang_array=V,null;C=!1,B=!1;var W,L;S.secondary&&(M=r.call(this,g,p[0],S.secondary,!1,M.usedOrig,null,m),C=M.name,E=M.locale,W=M.token,m&&!M.found_variant_ok&&C&&(C=i(y,W,g,!1,C,m,!0))),S.tertiary&&(M=r.call(this,g,p[0],S.tertiary,!1,M.usedOrig,null,m),B=M.name,_=M.locale,L=M.token,m&&!M.found_variant_ok&&B&&(B=i(y,L,g,!1,B,m,!0)));var Q;if(S.primary==="locale-translit"&&(Q=y.opt.citeAffixes[b][S.primary].prefix),Q==="<i>"&&p[0]==="title"&&!P){for(var j=!1,D=0,H=$.decorations.length;D<H;D+=1)$.decorations[D][0]==="@font-style"&&$.decorations[D][1]==="italic"&&(j=!0);j||$.decorations.push(["@font-style","italic"])}if(w!=="en"&&$.strings["text-case"]==="title"&&($.strings["text-case"]="passthrough"),p[0]==="title"&&(k=u.demoteNoiseWords(y,k,this["leading-noise-words"])),C||B){if(y.output.openLevel("empty"),$.strings.suffix=$.strings.suffix.replace(/[ .,]+$/,""),w&&(y.tmp.lang_array=[w].concat(V)),u.UPDATE_GROUP_CONTEXT_CONDITION(y,null,null,$,$.strings.prefix+k),y.output.append(k,$),y.tmp.probably_rendered_something=!0,k===C&&(C=!1),C){W.strings.prefix=y.opt.citeAffixes[b][S.secondary].prefix,W.strings.suffix=y.opt.citeAffixes[b][S.secondary].suffix,W.strings.prefix||(W.strings.prefix=" ");for(var D=W.decorations.length-1;D>-1;D+=-1)["@quotes/true","@font-style/italic","@font-style/oblique","@font-weight/bold"].indexOf(W.decorations[D].join("/"))>-1&&(W.decorations=W.decorations.slice(0,D).concat(W.decorations.slice(D+1)));E!=="en"&&W.strings["text-case"]==="title"&&(W.strings["text-case"]="passthrough"),E&&(y.tmp.lang_array=[E].concat(V));var O=new u.Token;O.decorations.push(["@font-style","normal"]),O.decorations.push(["@font-weight","normal"]),y.output.openLevel(O),y.output.append(C,W),y.output.closeLevel(),y.output.current.value(),y.output.current.value().blobs.length-1}if(k===B&&(B=!1),B){L.strings.prefix=y.opt.citeAffixes[b][S.tertiary].prefix,L.strings.suffix=y.opt.citeAffixes[b][S.tertiary].suffix,L.strings.prefix||(L.strings.prefix=" ");for(var D=L.decorations.length-1;D>-1;D+=-1)["@quotes/true","@font-style/italic","@font-style/oblique","@font-weight/bold"].indexOf(L.decorations[D].join("/"))>-1&&(L.decorations=L.decorations.slice(0,D).concat(L.decorations.slice(D+1)));_!=="en"&&L.strings["text-case"]==="title"&&(L.strings["text-case"]="passthrough"),_&&(y.tmp.lang_array=[_].concat(V));var R=new u.Token;R.decorations.push(["@font-style","normal"]),R.decorations.push(["@font-weight","normal"]),y.output.openLevel(R),y.output.append(B,L),y.output.closeLevel(),y.output.current.value(),y.output.current.value().blobs.length-1}y.output.closeLevel()}else w&&(y.tmp.lang_array=[w].concat(V)),u.UPDATE_GROUP_CONTEXT_CONDITION(y,null,null,$,$.strings.prefix+k),y.output.append(k,$),y.tmp.probably_rendered_something=!0;return y.tmp.lang_array=V,y.tmp.can_block_substitute&&y.tmp.name_node.children.push(y.output.current.value()),null}}this.getOutputFunction=f};u.Token=function(e,t,i){this.name=e,this.strings={},this.strings.delimiter=void 0,this.strings.prefix="",this.strings.suffix="",this.decorations=[],this.variables=[],this.execs=[],this.tokentype=t};u.Util.cloneToken=function(e){var t,i,n,r;if(typeof e=="string")return e;t=new u.Token(e.name,e.tokentype);for(var i in e.strings)e.strings.hasOwnProperty(i)&&(t.strings[i]=e.strings[i]);if(e.decorations)for(t.decorations=[],n=0,r=e.decorations.length;n<r;n+=1)t.decorations.push(e.decorations[n].slice());return e.variables&&(t.variables=e.variables.slice()),e.execs&&(t.execs=e.execs.slice(),e.tests&&(t.tests=e.tests.slice())),t};u.AmbigConfig=function(){this.maxvals=[],this.minval=1,this.names=[],this.givens=[],this.year_suffix=!1,this.disambiguate=0};u.Blob=function(e,t,i){var n,r,a;if(this.levelname=i,t){this.strings={prefix:"",suffix:""};for(var a in t.strings)t.strings.hasOwnProperty(a)&&(this.strings[a]=t.strings[a]);for(this.decorations=[],t.decorations===void 0?n=0:n=t.decorations.length,r=0;r<n;r+=1)this.decorations.push(t.decorations[r].slice())}else this.strings={},this.strings.prefix="",this.strings.suffix="",this.strings.delimiter="",this.decorations=[];typeof e=="string"?this.blobs=e:e?this.blobs=[e]:this.blobs=[],this.alldecor=[this.decorations]};u.Blob.prototype.push=function(e){typeof this.blobs=="string"?u.error("Attempt to push blob onto string object"):e!==!1&&(e.alldecor=e.alldecor.concat(this.alldecor),this.blobs.push(e))};u.NumericBlob=function(e,t,i,n,r){if(this.id=r,this.alldecor=[],this.num=i,this.particle=t,this.blobs=i.toString(),this.status=u.START,this.strings={},n){if(n.strings["text-case"]){var a=n.strings["text-case"];this.particle=u.Output.Formatters[a](e,this.particle),this.blobs=u.Output.Formatters[a](e,this.blobs)}this.gender=n.gender,this.decorations=n.decorations,this.strings.prefix=n.strings.prefix,this.strings.suffix=n.strings.suffix,this.strings["text-case"]=n.strings["text-case"],this.successor_prefix=n.successor_prefix,this.range_prefix=n.range_prefix,this.splice_prefix=n.splice_prefix,this.formatter=n.formatter,this.formatter||(this.formatter=new u.Output.DefaultFormatter),this.formatter&&(this.type=this.formatter.format(1))}else this.decorations=[],this.strings.prefix="",this.strings.suffix="",this.successor_prefix="",this.range_prefix="",this.splice_prefix="",this.formatter=new u.Output.DefaultFormatter};u.NumericBlob.prototype.setFormatter=function(e){this.formatter=e,this.type=this.formatter.format(1)};u.Output.DefaultFormatter=function(){};u.Output.DefaultFormatter.prototype.format=function(e){return e.toString()};u.NumericBlob.prototype.checkNext=function(e,t){t?(this.status=u.START,typeof e=="object"&&(e.num===this.num+1?e.status=u.SUCCESSOR:e.status=u.SEEN)):!e||!e.num||this.type!==e.type||e.num!==this.num+1?(this.status===u.SUCCESSOR_OF_SUCCESSOR&&(this.status=u.END),typeof e=="object"&&(e.status=u.SEEN)):this.status===u.START||this.status===u.SEEN?e.status=u.SUCCESSOR:(this.status===u.SUCCESSOR||this.status===u.SUCCESSOR_OF_SUCCESSOR)&&(this.range_prefix?(e.status=u.SUCCESSOR_OF_SUCCESSOR,this.status=u.SUPPRESS):e.status=u.SUCCESSOR)};u.NumericBlob.prototype.checkLast=function(e){return this.status===u.SEEN||e.num!==this.num-1&&this.status===u.SUCCESSOR?(this.status=u.SUCCESSOR,!0):!1};u.Util.fixDateNode=function(e,t,i){var n,r,a,o,l,c,f,p,m,d,h,v,b,g=this.cslXml.getAttributeValue(i,"lingo"),y=this.cslXml.getAttributeValue(i,"default-locale");this.build.date_key=!0,n=this.cslXml.getAttributeValue(i,"form");var g;if(y?g=this.opt["default-locale"][0]:g=this.cslXml.getAttributeValue(i,"lingo"),!this.getDate(n,y))return e;var x=this.cslXml.getAttributeValue(i,"date-parts");r=this.cslXml.getAttributeValue(i,"variable"),p=this.cslXml.getAttributeValue(i,"prefix"),m=this.cslXml.getAttributeValue(i,"suffix"),v=this.cslXml.getAttributeValue(i,"display"),b=this.cslXml.getAttributeValue(i,"cslid"),a=this.cslXml.nodeCopy(this.getDate(n,y)),this.cslXml.setAttribute(a,"lingo",this.opt.lang),this.cslXml.setAttribute(a,"form",n),this.cslXml.setAttribute(a,"date-parts",x),this.cslXml.setAttribute(a,"cslid",b),this.cslXml.setAttribute(a,"variable",r),this.cslXml.setAttribute(a,"default-locale",y),p&&this.cslXml.setAttribute(a,"prefix",p),m&&this.cslXml.setAttribute(a,"suffix",m),v&&this.cslXml.setAttribute(a,"display",v),d=this.cslXml.children(a);for(var k in d)o=d[k],this.cslXml.nodename(o)==="date-part"&&(l=this.cslXml.getAttributeValue(o,"name"),y&&this.cslXml.setAttributeOnNodeIdentifiedByNameAttribute(a,"date-part",l,"@default-locale","true"));d=this.cslXml.children(i);for(var k in d)if(o=d[k],this.cslXml.nodename(o)==="date-part"){l=this.cslXml.getAttributeValue(o,"name"),h=this.cslXml.attributes(o);for(c in h)c!=="@name"&&(g&&g!==this.opt.lang&&["@suffix","@prefix","@form"].indexOf(c)>-1||(f=h[c],this.cslXml.setAttributeOnNodeIdentifiedByNameAttribute(a,"date-part",l,c,f)))}if(this.cslXml.getAttributeValue(i,"date-parts")==="year")this.cslXml.deleteNodeByNameAttribute(a,"month"),this.cslXml.deleteNodeByNameAttribute(a,"day");else if(this.cslXml.getAttributeValue(i,"date-parts")==="year-month")this.cslXml.deleteNodeByNameAttribute(a,"day");else if(this.cslXml.getAttributeValue(i,"date-parts")==="month-day"){for(var w=this.cslXml.children(a),C=1,E=this.cslXml.numberofnodes(w);C<E;C++)if(this.cslXml.getAttributeValue(w[C],"name")==="year"){this.cslXml.setAttribute(w[C-1],"suffix","");break}this.cslXml.deleteNodeByNameAttribute(a,"year")}return this.cslXml.insertChildNodeAfter(e,i,t,a)};u.dateMacroAsSortKey=function(e,t){u.dateAsSortKey.call(this,e,t,!0)};u.dateAsSortKey=function(e,t,i){var n,r,a,o,l,c,f,p,m=this.variables[0],d="empty";if(i&&e.tmp.extension&&(d="macro-with-date"),n=t[m],typeof n>"u"&&(n={"date-parts":[[0]]}),typeof this.dateparts>"u"&&(this.dateparts=["year","month","day"]),n.raw?n=e.fun.dateparser.parseDateToArray(n.raw):n["date-parts"]&&(n=e.dateParseArray(n)),typeof n>"u"&&(n={}),n.year)for(f=0,p=u.DATE_PARTS_INTERNAL.length;f<p;f+=1)if(r=u.DATE_PARTS_INTERNAL[f],a=0,o=r,o.slice(-4)==="_end"&&(o=o.slice(0,-4)),n[r]&&this.dateparts.indexOf(o)>-1&&(a=n[r]),r.slice(0,4)==="year"){l=u.Util.Dates[o].numeric(e,a);var c="1";l[0]==="-"&&(c="0",l=l.slice(1),l=9999-parseInt(l,10)),e.output.append(u.Util.Dates[r.slice(0,4)].numeric(e,c+l),d)}else a=u.Util.Dates[o]["numeric-leading-zeros"](e,a),a||(a="00"),e.output.append(a,d)};u.Engine.prototype.dateParseArray=function(e){var t,i,n,r;t={};for(i in e)if(i==="date-parts"){n=e["date-parts"],n.length>1&&n[0].length!==n[1].length&&u.error("CSL data error: element mismatch in date range input."),r=["","_end"];for(var a=0,o=n.length;a<o;a+=1)for(var l=0,c=u.DATE_PARTS.length;l<c;l+=1)isNaN(parseInt(n[a][l],10))?t[u.DATE_PARTS[l]+r[a]]=void 0:t[u.DATE_PARTS[l]+r[a]]=parseInt(n[a][l],10)}else e.hasOwnProperty(i)&&(i==="literal"&&typeof e.literal=="object"&&typeof e.literal.part=="string"?(u.debug("Warning: fixing up weird literal date value"),t.literal=e.literal.part):t[i]=e[i]);return t};u.Util.Names={};u.Util.Names.compareNamesets=u.NameOutput.prototype._compareNamesets;u.Util.Names.unInitialize=function(e,t){var i,n,r,a,o;if(!t)return"";for(r=t.split(/(?:\-|\s+)/),a=t.match(/(\-|\s+)/g),o="",i=0,n=r.length;i<n;i+=1)o+=r[i],i<n-1&&(o+=a[i]);return o};u.Util.Names.initializeWith=function(e,t,i,n){var r,a,o;if(!t)return"";if(i||(i=""),["Lord","Lady"].indexOf(t)>-1||!t.replace(/^(?:<[^>]+>)*/,"").match(u.STARTSWITH_ROMANESQUE_REGEXP)&&!i.match("%s"))return t;e.opt["initialize-with-hyphen"]===!1&&(t=t.replace(/\-/g," ")),t=t.replace(/\s*\-\s*/g,"-").replace(/\s+/g," "),t=t.replace(/-([a-z])/g,"–$1");for(var r=t.length-2;r>-1;r+=-1)t.slice(r,r+1)==="."&&t.slice(r+1,r+2)!==" "&&(t=t.slice(0,r)+". "+t.slice(r+1));var l=u.Output.Formatters.nameDoppel.split(t),c=[];if(c=[l.strings[0]],l.tags.length===0){var f=c[0].match(/[^\.]+$/);f&&f[0].length===1&&f[0]!==f[0].toLowerCase()&&(c[0]+=".")}for(r=1,a=l.strings.length;r<a;r+=1)c.push(l.tags[r-1]),c.push(l.strings[r]);return n?o=this.doNormalize(e,c,i):o=this.doInitialize(e,c,i),o=o.replace(/\u2013([a-z])/g,"-$1"),o};u.Util.Names.notag=function(e){return e.replace(/^(?:<[^>]+>)*/,"")};u.Util.Names.mergetag=function(e,t,i){var n=t.match(/(?:-*<[^>]+>-*)/g);if(n)t=n.join("");else return i;return n=i.match(/^(.*[^\s])*(\s+)$/),n?(n[1]=n[1]?n[1]:"",i=n[1]+t+n[2]):i=i+t,i};u.Util.Names.tagonly=function(e,t){var i=t.match(/(?:<[^>]+>)+/);return i?i.join(""):t};u.Util.Names.doNormalize=function(e,t,i){var n,r;i=i||"";var a=[];for(n=0,r=t.length;n<r;n+=1)this.notag(t[n]).length>1&&this.notag(t[n]).slice(-1)==="."?(t[n]=t[n].replace(/^(.*)\.(.*)$/,"$1$2"),a.push(!0)):t[n].length===1&&t[n].toUpperCase()===t[n]?a.push(!0):a.push(!1);for(n=0,r=t.length;n<r;n+=2)a[n]&&(n<t.length-2&&(t[n+1]=this.tagonly(e,t[n+1]),a[n+2]||(t[n+1]=this.tagonly(e,t[n+1])+" "),t[n+2].length>1?t[n+1]=i.replace(/\ufeff$/,"")+t[n+1]:t[n+1]=this.mergetag(e,t[n+1],i)),n===t.length-1&&(t[n]=t[n]+i));return t.join("").replace(/[\u0009\u000a\u000b\u000c\u000d\u0020\ufeff\u00a0]+$/,"").replace(/\s*\-\s*/g,"-").replace(/[\u0009\u000a\u000b\u000c\u000d\u0020]+/g," ")};u.Util.Names.doInitialize=function(e,t,i){var n,r,a,o,l,c,f;for(n=0,r=t.length;n<r;n+=2)if(f=t[n],!!f)if(a=f.match(u.NAME_INITIAL_REGEXP),!a&&!f.match(u.STARTSWITH_ROMANESQUE_REGEXP)&&f.length>1&&i.match("%s")&&(a=f.match(/(.)(.*)/)),a&&a[2]&&a[3]&&(a[1]=a[1]+a[2],a[2]=""),a&&a[1].slice(0,1)===a[1].slice(0,1).toUpperCase()){var p="";if(a[2]){var m="";for(c=a[2].split(""),o=0,l=c.length;o<l;o+=1){var d=c[o];if(d===d.toUpperCase())m+=d;else break}m.length<a[2].length&&(p=u.toLocaleLowerCase.call(e,m))}t[n]=a[1]+p,n<r-1?i.match("%s")?t[n]=i.replace("%s",t[n]):t[n+1].indexOf("-")>-1?t[n+1]=this.mergetag(e,t[n+1].replace("-",""),i)+"-":t[n+1]=this.mergetag(e,t[n+1],i):i.match("%s")?t[n]=i.replace("%s",t[n]):t.push(i)}else f.match(u.ROMANESQUE_REGEXP)&&(!a||!a[3])&&(t[n]=" "+f);var h=t.join("");return h=h.replace(/[\u0009\u000a\u000b\u000c\u000d\u0020\ufeff\u00a0]+$/,"").replace(/\s*\-\s*/g,"-").replace(/[\u0009\u000a\u000b\u000c\u000d\u0020]+/g," "),h};u.Util.Names.getRawName=function(e){var t=[];return e.literal?t.push(e.literal):(e.given&&t.push(e.given),e.family&&t.push(e.family)),t.join(" ")};u.Util.Dates={};u.Util.Dates.year={};u.Util.Dates.year.long=function(e,t){return t||(typeof t=="boolean"?t="":t=0),t.toString()};u.Util.Dates.year.imperial=function(e,t,i){var n="";t||(typeof t=="boolean"?t="":t=0),i=i?"_end":"";var r=e.tmp.date_object["month"+i];for(r=r?""+r:"1";r.length<2;)r="0"+r;var a=e.tmp.date_object["day"+i];for(a=a?""+a:"1";a.length<2;)a="0"+a;var o=parseInt(t+r+a,10),l,c;if(o>=18680908&&o<19120730?(l="明治",c=1867):o>=19120730&&o<19261225?(l="大正",c=1911):o>=19261225&&o<19890108?(l="昭和",c=1925):o>=19890108&&(l="平成",c=1988),l&&c){var f=l;e.sys.normalizeAbbrevsKey&&(f=e.sys.normalizeAbbrevsKey("number",l)),e.transform.abbrevs.default.number[f]||e.transform.loadAbbreviation("default","number",f,null),e.transform.abbrevs.default.number[f]&&(l=e.transform.abbrevs.default.number[f]),n=l+(t-c)}return n};u.Util.Dates.year.short=function(e,t){if(t=t.toString(),t&&t.length===4)return t.substr(2)};u.Util.Dates.year.numeric=function(e,t){var n,i;t=""+t;var n=t.match(/([0-9]*)$/);for(n?(i=t.slice(0,n[1].length*-1),t=n[1]):(i=t,t="");t.length<4;)t="0"+t;return i+t};u.Util.Dates.normalizeMonth=function(e,t){var i;if(e||(e=0),e=""+e,e.match(/^[0-9]+$/)||(e=0),e=parseInt(e,10),t){var n={stub:"month-",num:e};if(n.num<1||n.num>24)n.num=0;else{for(;n.num>16;)n.num=n.num-4;n.num>12&&(n.stub="season-",n.num=n.num-12)}i=n}else(e<1||e>12)&&(e=0),i=e;return i};u.Util.Dates.month={};u.Util.Dates.month.numeric=function(e,i){var i=u.Util.Dates.normalizeMonth(i);return i||(i=""),i};u.Util.Dates.month["numeric-leading-zeros"]=function(e,i){var i=u.Util.Dates.normalizeMonth(i);if(!i)i="";else for(i=""+i;i.length<2;)i="0"+i;return i};u.Util.Dates.month.long=function(e,a,i,n){var r=u.Util.Dates.normalizeMonth(a,!0),a=r.num;if(!a)a="";else{for(a=""+a;a.length<2;)a="0"+a;a=e.getTerm(r.stub+a,"long",0,0,!1,n)}return a};u.Util.Dates.month.short=function(e,a,i,n){var r=u.Util.Dates.normalizeMonth(a,!0),a=r.num;if(!a)a="";else{for(a=""+a;a.length<2;)a="0"+a;a=e.getTerm(r.stub+a,"short",0,0,!1,n)}return a};u.Util.Dates.day={};u.Util.Dates.day.numeric=function(e,t){return t.toString()};u.Util.Dates.day.long=u.Util.Dates.day.numeric;u.Util.Dates.day["numeric-leading-zeros"]=function(e,t){for(t||(t=0),t=t.toString();t.length<2;)t="0"+t;return t.toString()};u.Util.Dates.day.ordinal=function(e,t,i){return e.fun.ordinalizer.format(t,i)};u.Util.Sort={};u.Util.Sort.strip_prepositions=function(e){var t;return typeof e=="string"&&(t=e.match(/^(([aA]|[aA][nN]|[tT][hH][eE])\s+)/)),t&&(e=e.substr(t[1].length)),e};u.Util.substituteStart=function(e,t){var i,n,r,a,o,l,c;a=function(f,p,m){for(var d=0,h=this.decorations.length;d<h;d+=1)if(this.decorations[d][0]==="@strip-periods"&&this.decorations[d][1]==="true"){f.tmp.strip_periods+=1;break}},this.execs.push(a),this.decorations&&e.opt.development_extensions.csl_reverse_lookup_support&&(this.decorations.reverse(),this.decorations.push(["@showid","true",this.cslid]),this.decorations.reverse()),c=["number","date","names"],(this.name==="text"&&!this.postponed_macro||c.indexOf(this.name)>-1)&&(i=function(f,p,m){f.tmp.element_trace.value()==="author"||this.name==="names"?(!f.tmp.just_looking&&m&&m["author-only"]&&f.tmp.area!=="intext"&&f.tmp.probably_rendered_something&&f.tmp.element_trace.push("suppress-me"),!f.tmp.just_looking&&m&&m["suppress-author"]&&(f.tmp.probably_rendered_something||f.tmp.element_trace.push("suppress-me"))):this.name==="date"?!f.tmp.just_looking&&m&&m["author-only"]&&f.tmp.area!=="intext"&&f.tmp.probably_rendered_something&&f.tmp.element_trace.push("suppress-me"):!f.tmp.just_looking&&m&&m["author-only"]&&f.tmp.area!=="intext"?!f.tmp.probably_rendered_something&&f.tmp.can_block_substitute||f.tmp.element_trace.push("suppress-me"):m&&m["suppress-author"]&&f.tmp.element_trace.push("do-not-suppress-me")},this.execs.push(i)),n=this.strings.cls,this.strings.cls=!1,e.build.render_nesting_level===0&&(e.build.area==="bibliography"&&e.bibliography.opt["second-field-align"]?(r=new u.Token("group",u.START),r.decorations=[["@display","left-margin"]],a=function(f,p){f.tmp.render_seen||(r.strings.first_blob=p.id,f.output.startTag("bib_first",r))},r.execs.push(a),t.push(r)):u.DISPLAY_CLASSES.indexOf(n)>-1&&(r=new u.Token("group",u.START),r.decorations=[["@display",n]],a=function(f,p){r.strings.first_blob=p.id,f.output.startTag("bib_first",r)},r.execs.push(a),t.push(r)),e.build.cls=n),e.build.render_nesting_level+=1,e.build.substitute_level.value()===1&&(o=new u.Token("choose",u.START),u.Node.choose.build.call(o,e,t),l=new u.Token("if",u.START),a=function(){return!!e.tmp.can_substitute.value()},l.tests||(l.tests=[]),l.tests.push(a),l.test=e.fun.match.any(this,e,l.tests),t.push(l)),e.sys.variableWrapper&&this.variables_real&&this.variables_real.length&&(a=function(f,p,m){if(!f.tmp.just_looking&&!f.tmp.suppress_decorations){var d=new u.Token("text",u.START);d.decorations=[["@showid","true"]],f.output.startTag("variable_entry",d);var h=null;m&&(h=m.position),h||(h=0);var v=["first","container-subsequent","subsequent","ibid","ibid-with-locator"],b=0;m&&m.noteIndex&&(b=m.noteIndex);var y=0;m&&m["first-reference-note-number"]&&(y=m["first-reference-note-number"]);var g=0;m&&m["first-container-reference-note-number"]&&(g=m["first-container-reference-note-number"]);var x=0;m&&m["citation-number"]&&(x=m["citation-number"]);var k=0;m&&m.index&&(k=m.index);var w={itemData:p,variableNames:this.variables,context:f.tmp.area,xclass:f.opt.xclass,position:v[h],"note-number":b,"first-reference-note-number":y,"first-container-reference-note-number":g,"citation-number":x,index:k,mode:f.opt.mode};f.output.current.value().params=w}},this.execs.push(a))};u.Util.substituteEnd=function(e,t){var i,n,r,a,o,l;if(e.sys.variableWrapper&&(this.hasVariable||this.variables_real&&this.variables_real.length)&&(i=function(f){!f.tmp.just_looking&&!f.tmp.suppress_decorations&&f.output.endTag("variable_entry")},this.execs.push(i)),i=function(f){for(var p=0,m=this.decorations.length;p<m;p+=1)if(this.decorations[p][0]==="@strip-periods"&&this.decorations[p][1]==="true"){f.tmp.strip_periods+=-1;break}},this.execs.push(i),e.build.render_nesting_level+=-1,e.build.render_nesting_level===0&&(e.build.cls?(i=function(f){f.output.endTag("bib_first")},this.execs.push(i),e.build.cls=!1):e.build.area==="bibliography"&&e.bibliography.opt["second-field-align"]&&(n=new u.Token("group",u.END),i=function(f){f.tmp.render_seen||f.output.endTag("bib_first")},n.execs.push(i),t.push(n),r=new u.Token("group",u.START),r.decorations=[["@display","right-inline"]],i=function(f){f.tmp.render_seen||(f.tmp.render_seen=!0,f.output.startTag("bib_other",r))},r.execs.push(i),t.push(r))),e.build.substitute_level.value()===1&&(a=new u.Token("if",u.END),t.push(a),o=new u.Token("choose",u.END),u.Node.choose.build.call(o,e,t)),this.name==="names"||this.name==="text"&&this.variables_real!=="title"){new u.Token("text",u.SINGLETON);var c=this.name;i=function(f,p){if(f.tmp.area==="bibliography"&&typeof f.bibliography.opt["subsequent-author-substitute"]=="string"&&!(this.variables_real&&!p[this.variables_real])&&!(this.variables_real&&c==="names")){var m=f.bibliography.opt["subsequent-author-substitute-rule"],d,h,v=!f.tmp.suppress_decorations;if(v&&f.tmp.subsequent_author_substitute_ok&&f.tmp.rendered_name){if(m==="partial-each"||m==="partial-first"){var b=!0,y=[];for(d=0,h=f.tmp.name_node.children.length;d<h;d+=1){var g=f.tmp.rendered_name[d];b&&f.tmp.last_rendered_name&&f.tmp.last_rendered_name.length>d-1&&g&&!g.localeCompare(f.tmp.last_rendered_name[d])?(l=new u.Blob(f[f.tmp.area].opt["subsequent-author-substitute"]),f.tmp.name_node.children[d].blobs=[l],m==="partial-first"&&(b=!1)):b=!1,y.push(g)}f.tmp.last_rendered_name=y}else if(m==="complete-each"){var y=f.tmp.rendered_name.join(",");if(y){if(f.tmp.last_rendered_name&&!y.localeCompare(f.tmp.last_rendered_name))for(d=0,h=f.tmp.name_node.children.length;d<h;d+=1)l=new u.Blob(f[f.tmp.area].opt["subsequent-author-substitute"]),f.tmp.name_node.children[d].blobs=[l];f.tmp.last_rendered_name=y}}else{var y=f.tmp.rendered_name.join(",");y&&(f.tmp.last_rendered_name&&!y.localeCompare(f.tmp.last_rendered_name)&&(l=new u.Blob(f[f.tmp.area].opt["subsequent-author-substitute"]),f.tmp.label_blob?f.tmp.name_node.top.blobs=[l,f.tmp.label_blob]:f.tmp.name_node.top.blobs.length?f.tmp.name_node.top.blobs[0].blobs=[l]:f.tmp.name_node.top.blobs=[l],f.tmp.substituted_variable=c),f.tmp.last_rendered_name=y)}f.tmp.subsequent_author_substitute_ok=!1}}},this.execs.push(i)}(this.name==="text"&&!this.postponed_macro||["number","date","names"].indexOf(this.name)>-1)&&(i=function(f,p){f.tmp.element_trace.mystack.length>1&&f.tmp.element_trace.pop()},this.execs.push(i))};u.Util.padding=function(e){var t=e.match(/\s*(-{0,1}[0-9]+)/);if(t)for(e=parseInt(t[1],10),e<0&&(e=1e20+e),e=""+e;e.length<20;)e="0"+e;return e};u.Util.LongOrdinalizer=function(){};u.Util.LongOrdinalizer.prototype.init=function(e){this.state=e};u.Util.LongOrdinalizer.prototype.format=function(e,t){e<10&&(e="0"+e);var i=u.Engine.getField(u.LOOSE,this.state.locale[this.state.opt.lang].terms,"long-ordinal-"+e,"long",0,t);return i||(i=this.state.fun.ordinalizer.format(e,t)),this.state.tmp.cite_renders_content=!0,i};u.Util.Ordinalizer=function(e){this.state=e,this.suffixes={}};u.Util.Ordinalizer.prototype.init=function(){if(!this.suffixes[this.state.opt.lang]){this.suffixes[this.state.opt.lang]={};for(var e=0,t=3;e<t;e+=1){var i=[void 0,"masculine","feminine"][e];this.suffixes[this.state.opt.lang][i]=[];for(var n=1;n<5;n+=1){var r=this.state.getTerm("ordinal-0"+n,"long",!1,i);if(typeof r>"u"){delete this.suffixes[this.state.opt.lang][i];break}this.suffixes[this.state.opt.lang][i].push(r)}}}};u.Util.Ordinalizer.prototype.format=function(e,t){var i;e=parseInt(e,10),i=""+e;var n="",r=[];if(t&&r.push(t),r.push("neuter"),this.state.locale[this.state.opt.lang].ord["1.0.1"]){n=this.state.getTerm("ordinal",!1,0,t);for(var a,o=0,l=r.length;o<l;o+=1){a=r[o];var c=this.state.locale[this.state.opt.lang].ord["1.0.1"];if(c["whole-number"][i]&&c["whole-number"][i][a]?n=this.state.getTerm(this.state.locale[this.state.opt.lang].ord["1.0.1"]["whole-number"][i][a],!1,0,t):c["last-two-digits"][i.slice(i.length-2)]&&c["last-two-digits"][i.slice(i.length-2)][a]?n=this.state.getTerm(this.state.locale[this.state.opt.lang].ord["1.0.1"]["last-two-digits"][i.slice(i.length-2)][a],!1,0,t):c["last-digit"][i.slice(i.length-1)]&&c["last-digit"][i.slice(i.length-1)][a]&&(n=this.state.getTerm(this.state.locale[this.state.opt.lang].ord["1.0.1"]["last-digit"][i.slice(i.length-1)][a],!1,0,t)),n)break}}else t||(t=void 0),this.state.fun.ordinalizer.init(),e/10%10===1||e>10&&e<20?n=this.suffixes[this.state.opt.lang][t][3]:e%10===1&&e%100!==11?n=this.suffixes[this.state.opt.lang][t][0]:e%10===2&&e%100!==12?n=this.suffixes[this.state.opt.lang][t][1]:e%10===3&&e%100!==13?n=this.suffixes[this.state.opt.lang][t][2]:n=this.suffixes[this.state.opt.lang][t][3];return i=i+=n,i};u.Util.Romanizer=function(){};u.Util.Romanizer.prototype.format=function(e){var t,i,n,r,a;if(t="",e<6e3)for(r=e.toString().split(""),r.reverse(),i=0,n=0,a=r.length,i=0;i<a;i+=1)n=parseInt(r[i],10),t=u.ROMAN_NUMERALS[i][n]+t;return t};u.Util.Suffixator=function(e){e||(e=u.SUFFIX_CHARS),this.slist=e.split(",")};u.Util.Suffixator.prototype.format=function(e){var t;e+=1;var i="";do{t=e%26===0?26:e%26;var i=this.slist[t-1]+i;e=(e-t)/26}while(e!==0);return i};u.Engine.prototype.processNumber=function(e,t,i){var n,r=this,a=i;i=i==="page-first"?"page":i;var o=",\\s+and\\s+|\\s+and\\s+";this.opt.lang.slice(0,2)!=="en"&&(o+="|,\\s+"+this.getTerm("and")+"\\s+|\\s+"+this.getTerm("and")+"\\s+");var l="\\s*&\\s*",c=new RegExp("^"+l+"$"),f=new RegExp("("+l+"|"+o+"|;\\s+|,\\s+|\\s*\\\\*[\\-\\u2013]+\\s*)","g"),p=new RegExp("(?:"+l+"|"+o+"|;\\s+|,\\s+|\\s*\\\\*[\\-\\u2013]+\\s*)"),m=this.getTerm("and"),d=this.getTerm("and","symbol");m===d&&(d="&");function h(O){O=O.trim();var R=O.match(/^([^ ]+)/);if(R&&!u.STATUTE_SUBDIV_STRINGS[R[1]]){var U=null;["locator","locator-extra","page"].indexOf(i)>-1?t.label?U=u.STATUTE_SUBDIV_STRINGS_REVERSE[t.label]:U="p.":U=u.STATUTE_SUBDIV_STRINGS_REVERSE[i],U&&(O=U+" "+O)}return O}function v(O,R,U,oe,ie){oe=oe||"";var ee={};if(!R&&!u.STATUTE_SUBDIV_STRINGS_REVERSE[i]&&(R="var:"+i),R){var te=R.match(/(\s*)([^\s]+)(\s*)/);a==="page"&&ie===0&&["p.","pp."].indexOf(te[2])===-1?(ee.gotosleepability=!0,ee.labelVisibility=!0):ee.labelVisibility=!1,ee.label=te[2],ee.origLabel=O,ee.labelSuffix=te[3]?te[3]:"",ee.plural=0}var te=U.match(/^([0-9]*[a-zA-Z]+0*)?([0-9]+(?:[a-zA-Z]*|[-,a-zA-Z]+))$/);return te?(ee.particle=te[1]?te[1]:"",ee.value=te[2]):(ee.particle="",ee.value=U),ee.joiningSuffix=oe.replace(/\s*-\s*/,"-"),ee}function b(O){for(var R=O.length-2;R>-1;R-=2)O[R]==="-"&&O[R-1].match(/^(?:(?:[a-z]|[a-z][a-z]|[a-z][a-z][a-z]|[a-z][a-z][a-z][a-z])\. *)*[0-9]+[,a-zA-Z]+$/)&&O[R+1].match(/^[,a-zA-Z]+$/)&&(O[R-1]=O.slice(R-1,R+2).join(""),O=O.slice(0,R).concat(O.slice(R+2)));return O}function y(O,R){R=R||"",O=h(O);var U,oe,ie;if(i==="page"&&O.indexOf("–")>-1&&(O=O.replace(/\u2013/g,"-")),O.indexOf("\\-")>-1){U=new RegExp(f.source.replace("\\-","")),oe=new RegExp(p.source.replace("\\-",""));for(var ee=O.split("\\-"),te=0,X=ee.length;te<X;te++)ee[te]=ee[te].replace(/\-/g,"–");ie=ee.join("\\-"),ie=ie.replace(/\\/g,"")}else U=f,oe=p,ie=O;var F=[],q=ie.match(U);if(q){for(var ee=ie.split(oe),te=0,X=q.length;te<X;te++)q[te].match(c)&&(ee[te].match(/[a-zA-Z]$/)&&ee[te].match(/^[a-zA-Z]/)?q[te]=d:q[te]=" "+d+" ");var ne=!1;for(var te in ee)if((""+ee[te]).replace(/^[a-z]\.\s+/,"").match(/[^\s0-9ivxlcmIVXLCM]/))break;if(ne)F=[ie];else{for(var te=0,X=ee.length-1;te<X;te++)F.push(ee[te]),F.push(q[te]);F.push(ee[ee.length-1]),F=b(F)}}else var F=[ie];for(var se=[],Se=R,Ae="",te=0,X=F.length;te<X;te+=2){var q=F[te].match(/((?:^| )(?:[a-z]|[a-z][a-z]|[a-z][a-z][a-z]|[a-z][a-z][a-z][a-z]|subpara|subch|amend|bibliog|annot|illus|princ|intro|sched|subdiv|subsec)(?:\.| ) *)/g);if(q){for(var ee=F[te].split(/(?:(?:^| )(?:[a-z]|[a-z][a-z]|[a-z][a-z][a-z]|[a-z][a-z][a-z][a-z]|subpara|subch|amend|bibliog|annot|illus|princ|intro|sched|subdiv|subsec)(?:\.| ) *)/),fe=ee.length-1;fe>0;fe--)ee[fe-1]&&(!ee[fe].match(/^[0-9]+([-;,:a-zA-Z]*)$/)||!ee[fe-1].match(/^[0-9]+([-;,:a-zA-Z]*)$/))&&(ee[fe-1]=ee[fe-1]+q[fe-1]+ee[fe],ee=ee.slice(0,fe).concat(ee.slice(fe+1)),q=q.slice(0,fe-1).concat(q.slice(fe)));if(q.length>0){var ke=q[0].trim(),G=!u.STATUTE_SUBDIV_STRINGS[ke]||typeof r.getTerm(u.STATUTE_SUBDIV_STRINGS[ke])>"u"||["locator","number","locator-extra","page"].indexOf(i)===-1&&u.STATUTE_SUBDIV_STRINGS[ke]!==i;G?te===0&&(q=q.slice(1),ee[0]=ee[0]+" "+ke+" "+ee[1],ee=ee.slice(0,1).concat(ee.slice(2))):Ae=ke}for(var fe=0,yt=ee.length;fe<yt;fe++)if(ee[fe]||fe===ee.length-1){var we;Se=q[fe-1]?q[fe-1]:Se,Ae===Se.trim()?we="":we=Ae,ie=ee[fe]?ee[fe].trim():"",fe===ee.length-1?se.push(v(we,Se,ie,F[te+1],te)):se.push(v(we,Se,ie,null,te))}}else{var we;Ae===Se.trim()?we="":we=Ae,se.push(v(we,Se,F[te],F[te+1]))}}return se}function g(O){for(var R=0,U=O.length-1;R<U;R++)!O[R].joiningSuffix&&O[R+1].label&&(O[R].joiningSuffix=" ")}function x(O,R,U){var oe=O[U.pos],ie=O[R].value,ee=oe.joiningSuffix==="\\-";ie.particle&&ie.particle!==oe.particle&&(U.collapsible=!1);var te=ie.match(/^[0-9]+([-,:a-zA-Z]*)$/),X=oe.value.match(/^(?:[0-9]+|[ixv]+)([-,:a-zA-Z]*|\-[\-0-9]+)$/);if((!ie||!te||!X||ee)&&(U.collapsible=!1,(!ie||!X)&&(U.numeric=!1),ee&&U.count--),(te&&te[1]||X&&X[1])&&(U.collapsible=!1),O[R].collapsible===void 0){for(var F=R,q=R+U.count;F<q;F++)isNaN(parseInt(O[F].value))&&!O[F].value.match(/^[ivxlcmIVXLCM]+$/)?O[F].collapsible=!1:O[F].collapsible=!0;U.collapsible=O[R].collapsible}for(var ne=U.collapsible,F=U.pos,q=U.pos+U.count;F<q;F++)U.count>1&&ne&&(O[F].plural=1),O[F].numeric=U.numeric,O[F].collapsible=U.collapsible}function k(O,R,U){U.label.slice(0,4)!=="var:"&&(U.pos===0?(["locator","number","locator-extra","page"].indexOf(i)>-1&&typeof r.getTerm(u.STATUTE_SUBDIV_STRINGS[U.label])>"u"&&(O[U.pos].labelVisibility=!0),["locator","number","locator-extra","page"].indexOf(i)===-1&&u.STATUTE_SUBDIV_STRINGS[U.label]!==i&&(O[0].labelVisibility=!0)):O[U.pos].labelVisibility=!0)}function w(O){if(O.length!==0){for(var R=0,U=1,oe=1,ie=O.length;oe<ie;oe++){var ee=O[oe-1],te=O[oe];if(ee.label===te.label&&ee.particle===ee.particle)U++;else{var X=JSON.parse(JSON.stringify(O[R]));X.pos=R,X.count=U,X.numeric=!0,x(O,R,X),ee.label!==te.label&&k(O,R,X),R=oe,U=1}}var X=JSON.parse(JSON.stringify(O[R]));X.pos=R,X.count=U,X.numeric=!0,x(O,R,X),k(O,R,X),O.length&&O[0].numeric&&i.slice(0,10)==="number-of-"&&parseInt(t[a],10)>1&&(O[0].plural=1)}}function C(O){return O.replace("\\-","-")}function E(O){var R=u.Util.cloneToken(e),U=new u.Token;r.tmp.just_looking||(U.decorations=R.decorations,R.decorations=[],U.strings.prefix=R.strings.prefix,R.strings.prefix="",U.strings.suffix=R.strings.suffix,R.strings.suffix="");var oe=O.length?O[0].label:null;if(O.length){for(var ie=0,ee=O.length;ie<ee;ie++){var te=O[ie],X=u.Util.cloneToken(R);X.gender=e.gender,oe===te.label&&(X.formatter=e.formatter),te.numeric&&(X.successor_prefix=te.successor_prefix),X.strings.suffix=X.strings.suffix+C(te.joiningSuffix),te.styling=X}r.tmp.just_looking||O[0].value.slice(0,1)==='"'&&O[O.length-1].value.slice(-1)==='"'&&(O[0].value=O[0].value.slice(1),O[O.length-1].value=O[O.length-1].value.slice(0,-1),U.decorations.push(["@quotes",!0]))}return U}function B(O,R){var U=!0;if(["locator","locator-extra","page"].indexOf(O)>-1){var oe;R.origLabel?oe=R.origLabel:oe=R.label,U=!!r.getTerm(u.STATUTE_SUBDIV_STRINGS[oe])}return U}function _(O,R){return O==="page"||["locator","locator-extra"].indexOf(O)>-1&&(["p."].indexOf(R.label)>-1||["p."].indexOf(R.origLabel)>-1)}function S(O,R,U,oe){var ie=_(O,R),ee=B(O,R);return ee&&U==="-"&&oe&&((ie||["locator","locator-extra","issue","volume","edition","number"].indexOf(O)>-1)&&(U=r.getTerm("page-range-delimiter"),U||(U="–")),O==="collection-number"&&(U=r.getTerm("year-range-delimiter"),U||(U="–"))),U}function T(O,R,U){if(!(R<1)&&U.count===2&&O[R-1].particle===O[R].particle){if(O[R-1].joiningSuffix!=="-"){U.count=1;return}if(!r.opt["page-range-format"]&&parseInt(O[R-1].value,10)>parseInt(O[R].value,10)){O[R-1].joiningSuffix=S(i,O[R],O[R-1].joiningSuffix,!0);return}var oe=O[R],ie=_(i,oe),ee;ie&&!isNaN(parseInt(O[R-1].value))&&!isNaN(parseInt(O[R].value))?(ee=O[R-1].particle+O[R-1].value+" - "+O[R].particle+O[R].value,ee=r.fun.page_mangler(ee)):((""+O[R-1].value).match(/^([0-9]+|[ivxlcmIVXLCM]+)$/)&&(""+O[R].value).match(/^([0-9]+|[ivxlcmIVXLCM]+)$/)&&(O[R-1].joiningSuffix=r.getTerm("page-range-delimiter")),ee=O[R-1].value+C(O[R-1].joiningSuffix)+O[R].value);var te=ee.match(/^((?:[0-9]*[a-zA-Z]+0*))?([0-9]+[a-z]*)(\s*[^0-9]+\s*)([-,a-zA-Z]?0*)([0-9]+[a-z]*)$/);if(te){var X=te[3];X=S(i,oe,X,O[R].numeric),O[R-1].particle=te[1],O[R-1].value=te[2],O[R-1].joiningSuffix=X,O[R].particle=te[4],O[R].value=te[5]}U.count=0}}function D(O){if(e&&["page","chapter-number","collection-number","edition","issue","number","number-of-pages","number-of-volumes","volume","locator","locator-extra"].indexOf(i)!==-1){for(var R={count:0,label:null},U=0,oe=O.length;U<oe;U++){var ie=O[U];if(ie.collapsible)R.label===ie.label&&ie.joiningSuffix==="-"?R.count=1:R.label===ie.label&&ie.joiningSuffix!=="-"?(R.count++,R.count===2&&T(O,U,R)):R.label!==ie.label?(R.label=ie.label,R.count=1):(R.count=1,R.label=ie.label);else{R.count=0,R.label=null;var ee=ie.numeric;ie.joiningSuffix=S(i,ie,ie.joiningSuffix,ee)}}R.count===2&&T(O,O.length-1,R)}}function H(O,R,U){var oe=O[R];U.length&&(oe.numeric=U[0].numeric,oe.collapsible=U[0].collapsible,oe.plural=U[0].plural,oe.label=u.STATUTE_SUBDIV_STRINGS[U[0].label],i==="number"&&oe.label==="issue"&&r.getTerm("number")&&(oe.label="number"))}if(e&&this.tmp.shadow_numbers[a]&&this.tmp.shadow_numbers[a].values.length){var V=this.tmp.shadow_numbers[a].values;D(V),this.tmp.shadow_numbers[a].masterStyling=E(V);return}if(this.tmp.shadow_numbers[a]||(this.tmp.shadow_numbers[a]={values:[]}),!!t){var M=u.LangPrefsMap[i];if(M){var $=this.opt["cite-lang-prefs"][M][0];n=this.transform.getTextSubField(t,a,"locale-"+$,!0),n=n.name}else n=t[a];if(n&&a==="number"&&t.type==="legal_case"&&(n=n.replace(/[\\]*-/g,"\\-")),n&&this.sys.getAbbreviation){if(this.sys.normalizeAbbrevsKey)var P=this.sys.normalizeAbbrevsKey(a,n);else var P=n;var W=this.transform.loadAbbreviation(t.jurisdiction,"number",P,t.language);this.transform.abbrevs[W].number&&(this.transform.abbrevs[W].number[P]?n=this.transform.abbrevs[W].number[P]:typeof this.transform.abbrevs[W].number[P]<"u"&&delete this.transform.abbrevs[W].number[P])}if(typeof n<"u"&&(typeof n=="string"||typeof n=="number")){typeof n=="number"&&(n=""+n);var L=u.STATUTE_SUBDIV_STRINGS_REVERSE[i];if(this.tmp.shadow_numbers[a].values.length===0){var V=y(n,L);g(V),w(V);for(var Q of V)Q.numeric||(Q.plural=0);this.tmp.shadow_numbers[a].values=V,e&&(D(V),this.tmp.shadow_numbers[a].masterStyling=E(V)),H(this.tmp.shadow_numbers,a,V)}var j=this.tmp.shadow_numbers[a];i==="number"&&j.values.length===1&&j.values[0].value.indexOf("|")>-1&&(j.values[0].value=j.values[0].value.replace(/\|/g,", "),j.values[0].numeric=!0,j.values[0].plural=1,j.values[0].collapsible=!1,j.numeric=!0,j.plural=1,j.collapsible=!1),j.values.length===1&&j.values[0].value.match(/^[0-9]+(?:\/[0-9]+)+$/)&&(j.values[0].numeric=!0,j.values[0].plural=0,j.values[0].collapsible=!1,j.numeric=!0,j.plural=0,j.collapsible=!1),i==="page"&&j.values.length>0&&j.values[0].gotosleepability&&(j.labelForm="short")}}};u.Util.outputNumericField=function(e,t,i){e.output.openLevel(e.tmp.shadow_numbers[t].masterStyling);var n=e.tmp.shadow_numbers[t].masterStyling,r=e.tmp.shadow_numbers[t].values,a=r.length?r[0].label:null,o=e.tmp.shadow_numbers[t].labelForm,l=e.tmp.group_context.tip.label_static,c;o?c=o:c="short";for(var f=e.tmp.shadow_numbers[t].labelCapitalizeIfFirst,p=e.tmp.shadow_numbers[t].labelDecorations,m=null,d=0,h=r.length;d<h;d++){var v=r[d],b="",y;v.label&&(v.label.slice(0,4)==="var:"?y=v.label.slice(4):y=u.STATUTE_SUBDIV_STRINGS[v.label],y&&(v.label===a?(l&&(b=e.getTerm(y,"static",v.plural),b.indexOf("%s")===-1&&(b="")),b||(b=e.getTerm(y,o,v.plural))):(l&&(b=e.getTerm(y,"static",v.plural),b.indexOf("%s")===-1&&(b="")),b||(b=e.getTerm(y,c,v.plural))),f&&(b=u.Output.Formatters["capitalize-first"](e,b))));var g=-1;b&&(g=b.indexOf("%s"));var x=u.Util.cloneToken(v.styling);if(x.formatter=v.styling.formatter,x.type=v.styling.type,x.num=v.styling.num,x.gender=v.styling.gender,g>0&&g<b.length-2)x.strings.prefix+=b.slice(0,g),x.strings.suffix=b.slice(g+2)+x.strings.suffix;else if(v.labelVisibility)if(b||(b=v.label,y=v.label),g>0){var k=new u.Token;k.decorations=p,e.output.append(b.slice(0,g),k)}else(g===b.length-2||g===-1)&&e.output.append(b+v.labelSuffix,"empty");if(u.UPDATE_GROUP_CONTEXT_CONDITION(e,n.strings.prefix,null,n,`${v.particle}${v.value}`),v.collapsible){var w;v.value.match(/^[1-9][0-9]*$/)&&Number.isSafeInteger(parseInt(v.value,10))?w=new u.NumericBlob(e,v.particle,parseInt(v.value,10),x,i):w=new u.NumericBlob(e,v.particle,v.value,x,i),typeof w.gender>"u"&&(w.gender=e.locale[e.opt.lang]["noun-genders"][t]),e.output.append(w,"literal")}else e.output.append(v.particle+v.value,x);if(g===0&&g<b.length-2&&(m===null&&(m=y),y!==m||d===r.length-1)){var C=new u.Token;C.decorations=p,e.output.append(b.slice(g+2),C)}m=y,e.tmp.term_predecessor=!0}e.output.closeLevel()};u.Util.PageRangeMangler={};u.Util.PageRangeMangler.getFunction=function(e,t){var i,n,r,a,o,l,c,f,p,m,d,h,v,b,y,g,x,k,w=e.getTerm(t+"-range-delimiter");i=/([0-9]*[a-zA-Z]+0*)?([0-9]+[a-z]*)\s*(?:\u2013|-)\s*([0-9]*[a-zA-Z]+0*)?([0-9]+[a-z]*)/,a=function(E){for(r=E.length,n=1;n<r;n+=2)typeof E[n]=="object"&&(E[n]=E[n].join(""));var B=E.join("");return B=B.replace(/([^\\])\-/g,"$1"+e.getTerm(t+"-range-delimiter")),B},o=function(E){var B,_,S,T="\\s+\\-\\s+",D=w==="-"?"":w,H=new RegExp("([^\\\\])[-"+D+"\\u2013]","g");E=E.replace(H,"$1 - ").replace(/\s+-\s+/g," - ");var V=new RegExp("((?:[0-9]*[a-zA-Z]+0*)?[0-9]+[a-z]*"+T+"(?:[0-9]*[a-zA-Z]+0*)?[0-9]+[a-z]*)","g"),M=new RegExp("(?:[0-9]*[a-zA-Z]+0*)?[0-9]+[a-z]*"+T+"(?:[0-9]*[a-zA-Z]+0*)?[0-9]+[a-z]*");if(B=E.match(V),_=E.split(M),_.length===0)S=B;else for(S=[_[0]],n=1,r=_.length;n<r;n+=1)S.push(B[n-1].replace(/\s*\-\s*/g,"-")),S.push(_[n]);return S},l=function(E){for(E=""+E,d=o(E),r=d.length,n=1;n<r;n+=2)h=d[n].match(i),h&&(!h[3]||h[1]===h[3])&&(h[4].length<h[2].length&&(h[4]=h[2].slice(0,h[2].length-h[4].length)+h[4]),parseInt(h[2],10)<parseInt(h[4],10)&&(h[3]=w+(h[1]?h[1]:""),d[n]=h.slice(1))),typeof d[n]=="string"&&(d[n]=d[n].replace(/\-/g,w));return d},c=function(E,B,_){r=E.length;for(var S=1,T=E.length;S<T;S+=2)typeof E[S]=="object"&&(E[S][3]=f(E[S][1],E[S][3],B,_),E[S][2].slice(1)===E[S][0]&&(E[S][2]=w));return a(E)},f=function(E,B,_,S){if(_||(_=0),v=(""+E).split(""),b=(""+B).split(""),y=b.slice(),y.reverse(),v.length===b.length)for(var T=0,D=v.length;T<D;T+=1)if(v[T]===b[T]&&y.length>_)y.pop();else{if(_&&S&&y.length===3){var H=v.slice(0,T);H.reverse(),y=y.concat(H)}break}return y.reverse(),y.join("")},p=function(E){for(r=E.length,n=1;n<r;n+=2)typeof E[n]=="object"&&(h=E[n],g=parseInt(h[1],10),x=parseInt(h[3],10),g>100&&g%100&&parseInt(g/100,10)===parseInt(x/100,10)?h[3]=""+x%100:g>=1e4&&(h[3]=""+x%1e3)),h[2].slice(1)===h[0]&&(h[2]=w);return a(E)},m=function(E){for(r=E.length,n=1;n<r;n+=2){if(typeof E[n]=="object"&&(h=E[n],g=parseInt(h[1],10),x=parseInt(h[3],10),b=""+x,g>100&&g%100))for(var B=2;B<b.length;B++){var _=Math.pow(10,B);if(Math.floor(g/_)===Math.floor(x/_)){h[3]=""+x%_;break}}h[2].slice(1)===h[0]&&(h[2]=w)}return a(E)};var C=function(E,B,_,S){var D;E=""+E;var T=l(E),D=B(T,_,S);return D};return e.opt[t+"-range-format"]?e.opt[t+"-range-format"]==="expanded"?k=function(E){return C(E,a)}:e.opt[t+"-range-format"]==="minimal"?k=function(E){return C(E,c)}:e.opt[t+"-range-format"]==="minimal-two"?k=function(E,B){return C(E,c,2,B)}:e.opt[t+"-range-format"]==="chicago"?k=function(E){return C(E,p)}:e.opt[t+"-range-format"]==="chicago-15"?k=function(E){return C(E,p)}:e.opt[t+"-range-format"]==="chicago-16"&&(k=function(E){return C(E,m)}):k=function(E){return C(E,a)},k};u.Util.FlipFlopper=function(e){var t=[],i={'<span class="nocase">':{type:"nocase",opener:'<span class="nocase">',closer:"</span>",attr:null,outer:null,flipflop:null},'<span class="nodecor">':{type:"nodecor",opener:'<span class="nodecor">',closer:"</span>",attr:"@class",outer:"nodecor",flipflop:{nodecor:"nodecor"}},'<span style="font-variant:small-caps;">':{type:"tag",opener:'<span style="font-variant:small-caps;">',closer:"</span>",attr:"@font-variant",outer:"small-caps",flipflop:{"small-caps":"normal",normal:"small-caps"}},"<sc>":{type:"tag",opener:"<sc>",closer:"</sc>",attr:"@font-variant",outer:"small-caps",flipflop:{"small-caps":"normal",normal:"small-caps"}},"<i>":{type:"tag",opener:"<i>",closer:"</i>",attr:"@font-style",outer:"italic",flipflop:{italic:"normal",normal:"italic"}},"<b>":{type:"tag",opener:"<b>",closer:"</b>",attr:"@font-weight",outer:"bold",flipflop:{bold:"normal",normal:"bold"}},"<sup>":{type:"tag",opener:"<sup>",closer:"</sup>",attr:"@vertical-align",outer:"sup",flipflop:{sub:"sup",sup:"sup"}},"<sub>":{type:"tag",opener:"<sub>",closer:"</sub>",attr:"@vertical-align",outer:"sub",flipflop:{sup:"sub",sub:"sub"}},' "':{type:"quote",opener:' "',closer:'"',attr:"@quotes",outer:"true",flipflop:{true:"inner",inner:"true",false:"true"}}," '":{type:"quote",opener:" '",closer:"'",attr:"@quotes",outer:"inner",flipflop:{true:"inner",inner:"true",false:"true"}}};i['("']=i[' "'],i["('"]=i[" '"];var n=e.getTerm("open-quote"),r=e.getTerm("close-quote"),a=e.getTerm("open-inner-quote"),o=e.getTerm("close-inner-quote");n&&r&&[' "'," '",'"',"'"].indexOf(n)===-1&&(i[n]=JSON.parse(JSON.stringify(i[' "'])),i[n].opener=n,i[n].closer=r),a&&o&&[' "'," '",'"',"'"].indexOf(a)===-1&&(i[a]=JSON.parse(JSON.stringify(i[" '"])),i[a].opener=a,i[a].closer=o);function l(x){var k={" '":' "',' "':" '",'("':"('","('":'("'};i[x].outer="true",i[k[x]].outer="inner"}function c(x){for(var k=[],w=Object.keys(i),C=0,E=w.length;C<E;C++){var B=w[C];(i[x].type!=="quote"||!i[x])&&k.push(B)}var _=i[x];return _.opener=new RegExp("^(?:"+k.map(function(S){return S.replace("(","\\(")}).join("|")+")"),_}var f=function(){for(var x={},k=Object.keys(i),w=0,C=k.length;w<C;w++){var E=k[w];x[E]=c(E)}return x}(),p=function(){var x=[],k=[],w={};for(var C in f)x.push(C),w[f[C].closer]=!0;for(var E=Object.keys(w),B=0,_=E.length;B<_;B++){var S=E[B];k.push(S)}var T=x.concat(k).map(function(D){return D.replace("(","\\(")}).join("|");return{matchAll:new RegExp("((?:"+T+"))","g"),splitAll:new RegExp("(?:"+T+")","g"),open:new RegExp("(^(?:"+x.map(function(D){return D.replace("(","\\(")}).join("|")+")$)"),close:new RegExp("(^(?:"+k.join("|")+")$)")}}();function m(x,k){var w=t[t.length-1];return!w||x.match(w.opener)?(t.push({type:f[x].type,opener:f[x].opener,closer:f[x].closer,pos:k}),!1):(t.pop(),t.push({type:f[x].type,opener:f[x].opener,closer:f[x].closer,pos:k}),{fixtag:w.pos})}function d(x,k){var w=t[t.length-1];return w&&x===w.closer?(t.pop(),w.type==="nocase"?{nocase:{open:w.pos,close:k}}:!1):w?{fixtag:w.pos}:{fixtag:k}}function h(x,k){return x.match(p.open)?m(x,k):d(x,k)}function v(x){var k=[];x=x.replace(/(<span)\s+(style=\"font-variant:)\s*(small-caps);?\"[^>]*(>)/g,'$1 $2$3;"$4'),x=x.replace(/(<span)\s+(class=\"no(?:case|decor)\")[^>]*(>)/g,"$1 $2$3");var w=x.match(p.matchAll);if(!w)return{tags:[],strings:[x],forcedSpaces:[]};for(var C=x.split(p.splitAll),E=0,B=w.length-1;E<B;E++)i[w[E]]&&(C[E+1]===""&&['"',"'"].indexOf(w[E+1])>-1?(w[E+1]=" "+w[E+1],k.push(!0)):k.push(!1));return{tags:w,strings:C,forcedSpaces:k}}var b=function(x){var k=[];this.set=function(w){for(var C=i[w].attr,E=null,B=k.length-1;B>-1;B--){var _=k[B];if(_[0]===C){E=_;break}}if(!E){var S=[e[e.tmp.area].opt.layout_decorations].concat(x.alldecor);e:for(var B=S.length-1;B>-1;B--){var T=S[B];if(T)for(var D=T.length-1;D>-1;D--){var _=T[D];if(_[0]===C){E=_;break e}}}}E?E=[C,i[w].flipflop[E[1]]]:E=[C,i[w].outer],k.push(E)},this.pair=function(){return k[k.length-1]},this.pop=function(){k.pop()}};function y(x,k){if(x==="'"){if(k&&k.match(/^[^\,\.\?\:\;\ ]/))return"’"}else if(x===" '"&&k&&k.match(/^[\ ]/))return" ’";return!1}function g(x,k,w){var C=!0,E=new b(x);x.blobs=[];function B(V){this.stack=[V],this.latest=V,this.addStyling=function(M,$){if(C&&(M.slice(0,1)===" "&&(M=M.slice(1)),M.slice(0,1)===" "&&(M=M.slice(1)),C=!1),this.latest=this.stack[this.stack.length-1],$){if(typeof this.latest.blobs=="string"){var P=new u.Blob;P.blobs=this.latest.blobs,P.alldecor=this.latest.alldecor.slice(),this.latest.blobs=[P]}var W=new u.Token,L=new u.Blob(null,W);if(L.alldecor=this.latest.alldecor.slice(),$[0]==="@class"&&$[1]==="nodecor"){for(var Q=[],j={},O=[e[e.tmp.area].opt.layout_decorations].concat(L.alldecor),R=O.length-1;R>-1;R--){var U=O[R];if(U)for(var oe=U.length-1;oe>-1;oe--){var ie=U[oe];["@font-weight","@font-style","@font-variant"].indexOf(ie[0])>-1&&!j[ie[0]]&&($[1]!=="normal"&&(L.decorations.push([ie[0],"normal"]),Q.push([ie[0],"normal"])),j[ie[0]]=!0)}}L.alldecor.push(Q)}else L.decorations.push($),L.alldecor.push([$]);if(this.latest.blobs.push(L),this.stack.push(L),this.latest=L,M){var W=new u.Token,L=new u.Blob(null,W);L.blobs=M,L.alldecor=this.latest.alldecor.slice(),this.latest.blobs.push(L)}}else if(M){var P=new u.Blob;P.blobs=M,P.alldecor=this.latest.alldecor.slice(),this.latest.blobs.push(P)}},this.popStyling=function(){this.stack.pop()}}var _=new B(x);if(k.strings.length){var S=k.strings[0];w&&(S=" "+S),_.addStyling(S)}for(var T=0,D=k.tags.length;T<D;T++){var H=k.tags[T],S=k.strings[T+1];H.match(p.open)?(E.set(H),_.addStyling(S,E.pair())):(E.pop(),_.popStyling(),_.addStyling(S))}}this.processTags=function(x){var C=x.blobs,k=!1;C.slice(0,1)===" "&&!C.match(/^\s+[\'\"]/)&&(k=!0);var w=new RegExp("("+u.ROMANESQUE_REGEXP.source+")’("+u.ROMANESQUE_REGEXP.source+")","g"),C=" "+C.replace(w,"$1'$2"),E=v(C);if(E.tags.length!==0){for(var B=!1,_=0,S=E.tags.length;_<S;_++){var T=E.tags[_],C=E.strings[_+1],D=y(T,C);if(D)E.strings[_+1]=D+E.strings[_+1],E.tags[_]="";else{for(var H;H=h(T,_),H;)if(Object.keys(H).indexOf("fixtag")>-1){if(T.match(p.close)&&T==="'")E.strings[_+1]="’"+E.strings[_+1],E.tags[_]="";else{var V=E.tags[H.fixtag];E.forcedSpaces[H.fixtag-1]&&(V=V.slice(1)),E.strings[H.fixtag+1]=V+E.strings[H.fixtag+1],E.tags[H.fixtag]=""}if(t.length>0)if(T!=="'")t.pop();else break;else break}else if(H.nocase){E.tags[H.nocase.open]="",E.tags[H.nocase.close]="";break}else break;H&&(H.fixtag||H.fixtag===0)&&(E.strings[_+1]=E.tags[_]+E.strings[_+1],E.tags[_]="")}}for(var _=t.length-1;_>-1;_--){var M=t[_].pos,T=E.tags[M];T===" '"||T==="'"?E.strings[M+1]=" ’"+E.strings[M+1]:E.strings[M+1]=E.tags[M]+E.strings[M+1],E.tags[M]="",t.pop()}for(var _=E.tags.length-1;_>-1;_--)E.tags[_]||(E.tags=E.tags.slice(0,_).concat(E.tags.slice(_+1)),E.strings[_]=E.strings[_]+E.strings[_+1],E.strings=E.strings.slice(0,_+1).concat(E.strings.slice(_+2)));for(var _=0,S=E.tags.length;_<S;_++){var T=E.tags[_],$=E.forcedSpaces[_-1];[' "'," '",'("',"('"].indexOf(T)>-1&&(B||(l(T),B=!0),$||(E.strings[_]+=T.slice(0,1)))}g(x,E,k)}}};u.Output.Formatters=function(){var e=`(?:‘|’|“|”| "| '|"|'|[-–—/.,;?!:]|\\[|\\]|\\(|\\)|<span style="font-variant: small-caps;">|<span class="no(?:case|decor)">|</span>|</?(?:i|sc|b|sub|sup)>)`,t=new u.Doppeler(e,function(b){return b.replace(/(<span)\s+(class=\"no(?:case|decor)\")[^>]*(>)/g,"$1 $2$3").replace(/(<span)\s+(style=\"font-variant:)\s*(small-caps);?(\")[^>]*(>)/g,"$1 $2 $3;$4$5")}),i='(?:[-\\s]*<\\/*(?:spans+class="no(?:case|decor)"|i|sc|b|sub|sup)>[-\\s]*|[-\\s]+)',n=new u.Doppeler(i),r=new u.Doppeler("(?:[    -​  ]+)"),a={'<span style="font-variant: small-caps;">':"</span>",'<span class="nocase">':"</span>",'<span class="nodecor">':"</span>","<sc>":"</sc>","<sub>":"</sub>","<sup>":"</sup>"};function o(b){var y=b.match(/(^\s*)((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))(.*)/);return y&&!(y[2].match(/^[\u0370-\u03FF]$/)&&!y[3])?y[1]+u.toLocaleUpperCase.call(this,y[2])+y[3]:b}function l(b,y){if(!y)return"";b.doppel=t.split(y);var g={' "':{opener:" '",closer:'"'}," '":{opener:' "',closer:"'"},"‘":{opener:"‘",closer:"’"},"“":{opener:"“",closer:"”"}};function x(M,$){if(b.quoteState.length===0||M===b.quoteState[b.quoteState.length-1].opener)return b.quoteState.push({opener:g[M].opener,closer:g[M].closer,pos:$}),!1;var P=b.quoteState[b.quoteState.length-1].pos;return b.quoteState.pop(),b.quoteState.push({opener:g[M].opener,closer:g[M].closer,positions:$}),P}function k(M,$){if(b.quoteState.length>0&&M===b.quoteState[b.quoteState.length-1].closer)b.quoteState.pop();else return $}function w(M,$){var P=["“","‘",' "'," '"].indexOf(M)>-1;return P?x(M,$):k(M,$)}function C(M,$){var P=M.match(/(^(?:\u2018|\u2019|\u201C|\u201D|\"|\')|(?: \"| \')$)/);if(P)return w(P[1],$)}b.doppel.strings.length&&b.doppel.strings[0].trim()&&(b.doppel.strings[0]=b.capitaliseWords(b.doppel.strings[0],0,b.doppel.tags[0]));for(var E=0,B=b.doppel.tags.length;E<B;E++){var _=b.doppel.tags[E],S=b.doppel.strings[E+1];if(b.tagState!==null&&(a[_]?b.tagState.push(a[_]):b.tagState.length&&_===b.tagState[b.tagState.length-1]&&b.tagState.pop()),b.afterPunct!==null&&_.match(/[\!\?\:]$/)&&(b.afterPunct=!0),b.tagState.length===0?b.doppel.strings[E+1]=b.capitaliseWords(S,E+1,b.doppel,b.doppel.tags[E+1]):b.doppel.strings[E+1].trim()&&(b.lastWordPos=null),b.quoteState!==null){var T=C(_,E);if(T||T===0){var D=b.doppel.origStrings[T+1].slice(0,1);b.doppel.strings[T+1]=D+b.doppel.strings[T+1].slice(1),b.lastWordPos=null}}b.isFirst&&S.trim()&&(b.isFirst=!1),b.afterPunct&&S.trim()&&(b.afterPunct=!1)}if(b.quoteState)for(var E=0,B=b.quoteState.length;E<B;E++){var T=b.quoteState[E].pos;if(typeof T<"u"){var D=b.doppel.origStrings[T+1].slice(0,1);b.doppel.strings[T+1]=D+b.doppel.strings[T+1].slice(1)}}if(b.lastWordPos){var H=r.split(b.doppel.strings[b.lastWordPos.strings]),V=H.strings[b.lastWordPos.words];V.length>1&&u.toLocaleLowerCase.call(this,V).match(b.skipWordsRex)&&(V=o.call(this,V),H.strings[b.lastWordPos.words]=V),b.doppel.strings[b.lastWordPos.strings]=r.join(H)}return t.join(b.doppel)}function c(b,y){return y}function f(b,y){var g={quoteState:null,capitaliseWords:function(x){for(var k=x.split(" "),w=0,C=k.length;w<C;w++){var E=k[w];E&&(k[w]=u.toLocaleLowerCase.call(b,E))}return k.join(" ")},skipWordsRex:null,tagState:[],afterPunct:null,isFirst:null};return l.call(b,g,y)}function p(b,y){var g={quoteState:null,capitaliseWords:function(x){for(var k=x.split(" "),w=0,C=k.length;w<C;w++){var E=k[w];E&&(k[w]=u.toLocaleUpperCase.call(b,E))}return k.join(" ")},skipWordsRex:null,tagState:[],afterPunct:null,isFirst:null};return l.call(b,g,y)}function m(b,y){var g={quoteState:[],capitaliseWords:function(x){for(var k=x.split(" "),w=0,C=k.length;w<C;w++){var E=k[w];E&&(g.isFirst?(k[w]=o.call(b,E),g.isFirst=!1):k[w]=u.toLocaleLowerCase.call(b,E))}return k.join(" ")},skipWordsRex:null,tagState:[],afterPunct:null,isFirst:!0};return l.call(b,g,y)}function d(b,y){var g={quoteState:[],capitaliseWords:function(x,k,w){if(x.trim()){for(var C=r.split(x),E=C.strings,B=0,_=E.length;B<_;B++){var S=E[B];if(!S)continue;let T=u.toLocaleLowerCase.call(b,S),D=!1;(S.length>1&&!T.match(g.skipWordsRex)||B===E.length-1&&w==="-"||g.isFirst||g.afterPunct)&&(D=!0),D&&S===T&&(E[B]=o.call(b,S)),g.afterPunct=!1,g.isFirst=!1,g.lastWordPos={strings:k,words:B}}x=r.join(C)}return x},skipWordsRex:b.locale[b.opt.lang].opts["skip-words-regexp"],tagState:[],afterPunct:!1,isFirst:!0};return l.call(b,g,y)}function h(b,y){var g={quoteState:[],capitaliseWords:function(x){for(var k=r.split(x),w=k.strings,C=0,E=w.length;C<E;C++){var B=w[C];if(B&&g.isFirst){B===u.toLocaleLowerCase.call(b,B)&&(w[C]=o.call(b,B)),g.isFirst=!1;break}}return r.join(k)},skipWordsRex:null,tagState:[],afterPunct:null,isFirst:!0};return l.call(b,g,y)}function v(b,y){var g={quoteState:[],capitaliseWords:function(x){for(var k=r.split(x),w=k.strings,C=0,E=w.length;C<E;C++){var B=w[C];B&&B===u.toLocaleLowerCase.call(b,B)&&(w[C]=o.call(b,B))}return r.join(k)},skipWordsRex:null,tagState:[],afterPunct:null,isFirst:null};return l.call(b,g,y)}return{nameDoppel:n,passthrough:c,lowercase:f,uppercase:p,sentence:m,title:d,"capitalize-first":h,"capitalize-all":v}}();u.Output.Formats=function(){};u.Output.Formats.prototype.html={text_escape:function(e){return e||(e=""),e.replace(/&/g,"&#38;").replace(/</g,"&#60;").replace(/>/g,"&#62;").replace(/\s\s/g,"  ").replace(u.SUPERSCRIPTS_REGEXP,function(t){return"<sup>"+u.SUPERSCRIPTS[t]+"</sup>"})},bibstart:`<div class="csl-bib-body">
454
454
  `,bibend:"</div>","@font-style/italic":"<i>%%STRING%%</i>","@font-style/oblique":"<em>%%STRING%%</em>","@font-style/normal":'<span style="font-style:normal;">%%STRING%%</span>',"@font-variant/small-caps":'<span style="font-variant:small-caps;">%%STRING%%</span>',"@passthrough/true":u.Output.Formatters.passthrough,"@font-variant/normal":'<span style="font-variant:normal;">%%STRING%%</span>',"@font-weight/bold":"<b>%%STRING%%</b>","@font-weight/normal":'<span style="font-weight:normal;">%%STRING%%</span>',"@font-weight/light":!1,"@text-decoration/none":'<span style="text-decoration:none;">%%STRING%%</span>',"@text-decoration/underline":'<span style="text-decoration:underline;">%%STRING%%</span>',"@vertical-align/sup":"<sup>%%STRING%%</sup>","@vertical-align/sub":"<sub>%%STRING%%</sub>","@vertical-align/baseline":'<span style="baseline">%%STRING%%</span>',"@strip-periods/true":u.Output.Formatters.passthrough,"@strip-periods/false":u.Output.Formatters.passthrough,"@quotes/true":function(e,t){return typeof t>"u"?e.getTerm("open-quote"):e.getTerm("open-quote")+t+e.getTerm("close-quote")},"@quotes/inner":function(e,t){return typeof t>"u"?"’":e.getTerm("open-inner-quote")+t+e.getTerm("close-inner-quote")},"@quotes/false":!1,"@cite/entry":function(e,t){return e.sys.wrapCitationEntry(t,this.item_id,this.locator_txt,this.suffix_txt)},"@bibliography/entry":function(e,t){var i="";return e.sys.embedBibliographyEntry&&(i=e.sys.embedBibliographyEntry(this.item_id)+`
455
455
  `),' <div class="csl-entry">'+t+`</div>
456
456
  `+i},"@display/block":function(e,t){return`
@@ -491,8 +491,8 @@
491
491
  `},"@display/block":function(e,t){return`
492
492
  `+t},"@display/left-margin":function(e,t){return t},"@display/right-inline":function(e,t){return t},"@display/indent":function(e,t){return`
493
493
  `+t},"@showid/true":function(e,t,i){return t},"@URL/true":function(e,t){return t},"@DOI/true":function(e,t){return t}};u.Output.Formats=new u.Output.Formats;u.Registry=function(e){this.debug=!1,this.state=e,this.registry={},this.reflist=[],this.refhash={},this.namereg=new u.Registry.NameReg(e),this.citationreg=new u.Registry.CitationReg(e),this.authorstrings={},this.masterMap={},this.mylist=[],this.myhash={},this.deletes=[],this.inserts=[],this.uncited={},this.refreshes={},this.akeys={},this.oldseq={},this.return_data={},this.ambigcites={},this.ambigresets={},this.sorter=new u.Registry.Comparifier(e,"bibliography_sort"),this.getSortedIds=function(){for(var t=[],i=0,n=this.reflist.length;i<n;i+=1)t.push(""+this.reflist[i].id);return t},this.getSortedRegistryItems=function(){for(var t=[],i=0,n=this.reflist.length;i<n;i+=1)t.push(this.reflist[i]);return t}};u.Registry.prototype.init=function(e,t){var i,n;if(this.oldseq={},t){this.uncited={};for(var i=0,n=e.length;i<n;i+=1)this.myhash[e[i]]||this.mylist.push(""+e[i]),this.uncited[e[i]]=!0,this.myhash[e[i]]=!0}else{for(var r in this.uncited)e.push(r);var a={};for(i=e.length-1;i>-1;i+=-1)a[e[i]]?e=e.slice(0,i).concat(e.slice(i+1)):a[e[i]]=!0;this.mylist=e,this.myhash=a}this.refreshes={},this.touched={},this.ambigsTouched={},this.ambigresets={}};u.Registry.prototype.dopurge=function(e){for(var t=this.mylist.length-1;t>-1;t+=-1)this.citationreg.citationsByItemId&&(!this.citationreg.citationsByItemId||!this.citationreg.citationsByItemId[this.mylist[t]])&&!e[this.mylist[t]]&&(delete this.myhash[this.mylist[t]],delete this.uncited[this.mylist[t]],this.mylist=this.mylist.slice(0,t).concat(this.mylist.slice(t+1)));this.dodeletes(this.myhash)};u.Registry.prototype.dodeletes=function(e){var t,i,n,r,a,o,l,c,f;if(typeof e=="string"){var i=e;e={},e[i]=!0}for(var i in this.registry)if(!e[i]){if(this.uncited[i])continue;t=this.namereg.delitems(i);for(l in t)this.refreshes[l]=!0;for(n=this.registry[i].ambig,c=this.ambigcites[n].indexOf(i),c>-1&&(o=this.ambigcites[n].slice(),this.ambigcites[n]=o.slice(0,c).concat(o.slice(c+1,o.length)),this.ambigresets[n]=this.ambigcites[n].length),a=this.ambigcites[n].length,r=0;r<a;r+=1)f=""+this.ambigcites[n][r],this.refreshes[f]=!0;if(this.registry[i].siblings){if(this.registry[i].siblings.length==1){var p=this.registry[i].siblings[0];this.registry[p].siblings&&(this.registry[p].siblings.pop(),this.registry[p].master=!0)}else if(this.registry[i].siblings.length>1){var m=[i];if(this.registry[i].master){var d=this.registry[i].siblings[0],h=this.registry[d];h.master=!0,m.push(d)}for(var v=[],b=this.registry[i].siblings.length-1;b>-1;b+=-1){var y=this.registry[i].siblings.pop();m.indexOf(y)===-1&&v.push(y)}for(var b=v.length-1;b>-1;b+=-1)this.registry[i].siblings.push(v[b])}}for(var g=this.reflist.length-1;g>-1;g--)this.reflist[g].id===i&&(this.reflist=this.reflist.slice(0,g).concat(this.reflist.slice(g+1)));delete this.registry[i],delete this.refhash[i],this.return_data.bibchange=!0}};u.Registry.prototype.doinserts=function(e){var t,i,n,r,a,o,l;typeof e=="string"&&(e=[e]);for(var o=0,l=e.length;o<l;o+=1)t=e[o],this.registry[t]||(i=this.state.retrieveItem(t),n=u.getAmbiguousCite.call(this.state,i),this.ambigsTouched[n]=!0,i.legislation_id||(this.akeys[n]=!0),r={id:""+t,seq:0,offset:0,sortkeys:!1,ambig:!1,rendered:!1,disambig:!1,ref:i,newItem:!0},this.registry[t]=r,this.citationreg.citationsByItemId&&this.citationreg.citationsByItemId[t]&&(this.registry[t]["first-reference-note-number"]=this.citationreg.citationsByItemId[t][0].properties.noteIndex),a=u.getAmbigConfig.call(this.state),this.registerAmbigToken(n,t,a),this.touched[t]=!0,this.return_data.bibchange=!0)};u.Registry.prototype.rebuildlist=function(e){var t,i,n,r;if(e)for(this.reflist=[],t=this.mylist.length,i=0;i<t;i+=1)n=this.mylist[i],r=this.registry[n],this.reflist.push(r),this.oldseq[n]=this.registry[n].seq,this.registry[n].seq=i+1;else for(this.reflist_inserts=[],t=this.mylist.length,i=0;i<t;i+=1)n=this.mylist[i],r=this.registry[n],r.newItem&&this.reflist_inserts.push(r),this.oldseq[n]=this.registry[n].seq,this.registry[n].seq=i+1};u.Registry.prototype.dorefreshes=function(){var e,t,i,n,r;for(var e in this.refreshes)if(t=this.registry[e],!!t){t.sortkeys=void 0,i=this.state.refetchItem(e);var n=t.ambig;typeof n>"u"&&(this.state.tmp.disambig_settings=!1,n=u.getAmbiguousCite.call(this.state,i),r=u.getAmbigConfig.call(this.state),this.registerAmbigToken(n,e,r));for(var a in this.ambigresets)if(this.ambigresets[a]===1){var o=this.ambigcites[n][0],i=this.state.refetchItem(o);this.registry[o].disambig=new u.AmbigConfig,this.state.tmp.disambig_settings=!1;var n=u.getAmbiguousCite.call(this.state,i),r=u.getAmbigConfig.call(this.state);this.registerAmbigToken(n,o,r)}this.state.tmp.taintedItemIDs[e]=!0,this.ambigsTouched[n]=!0,i.legislation_id||(this.akeys[n]=!0),this.touched[e]=!0}};u.Registry.prototype.setdisambigs=function(){for(var e in this.ambigsTouched)this.state.disambiguate.run(e);this.ambigsTouched={},this.akeys={}};u.Registry.prototype.renumber=function(){var e,t,i;for(this.state.bibliography_sort.opt.citation_number_sort_direction===u.DESCENDING&&(this.state.bibliography_sort.tmp.citation_number_map={}),e=this.reflist.length,t=0;t<e;t+=1)i=this.reflist[t],i.seq=t+1,this.state.bibliography_sort.opt.citation_number_sort_direction===u.DESCENDING&&(this.state.bibliography_sort.tmp.citation_number_map[i.seq]=this.reflist.length-i.seq+1),this.state.opt.update_mode===u.NUMERIC&&i.seq!=this.oldseq[i.id]&&(this.state.tmp.taintedItemIDs[i.id]=!0),i.seq!=this.oldseq[i.id]&&(this.return_data.bibchange=!0)};u.Registry.prototype.setsortkeys=function(){for(var e,t=0,i=this.mylist.length;t<i;t+=1){var e=this.mylist[t];(this.touched[e]||this.state.tmp.taintedItemIDs[e]||!this.registry[e].sortkeys)&&(this.registry[e].sortkeys=u.getSortKeys.call(this.state,this.state.retrieveItem(e),"bibliography_sort"))}};u.Registry.prototype._insertItem=function(e,t){return t.splice(this._locationOf(e,t)+1,0,e),t};u.Registry.prototype._locationOf=function(e,t,i,n){if(t.length===0)return-1;i=i||0,n=n||t.length;var r=i+n>>1,a=this.sorter.compareKeys(e,t[r]);if(n-i<=1)return a==-1?r-1:r;switch(a){case-1:return this._locationOf(e,t,i,r);case 0:return r;case 1:return this._locationOf(e,t,r,n)}};u.Registry.prototype.sorttokens=function(e){var t,i,n,r;if(!e){for(this.reflist_inserts=[],t=this.mylist.length,r=0;r<t;r+=1)i=this.mylist[r],n=this.registry[i],n.newItem&&this.reflist_inserts.push(n);for(var a in this.state.tmp.taintedItemIDs)if(this.registry[a]&&!this.registry[a].newItem)for(var o=this.reflist.length-1;o>-1;o--)this.reflist[o].id===a&&(this.reflist_inserts.push(this.reflist[o]),this.reflist=this.reflist.slice(0,o).concat(this.reflist.slice(o+1)));for(var o=0,l=this.reflist_inserts.length;o<l;o++){var n=this.reflist_inserts[o];delete n.newItem,this.reflist=this._insertItem(n,this.reflist)}for(r=0;r<t;r+=1)i=this.mylist[r],n=this.registry[i],this.registry[i].seq=r+1}};u.Registry.Comparifier=function(e,t){var i,n,r,a,o=u.getSortCompare.call(e,e.opt["default-locale-sort"]);i=e[t].opt.sort_directions,this.compareKeys=function(l,c){for(n=l.sortkeys?l.sortkeys.length:0,r=0;r<n;r+=1){var f=0;if(l.sortkeys[r]===c.sortkeys[r]?f=0:typeof l.sortkeys[r]>"u"?f=i[r][1]:typeof c.sortkeys[r]>"u"?f=i[r][0]:f=o(l.sortkeys[r],c.sortkeys[r]),0<f)return i[r][1];if(0>f)return i[r][0]}return l.seq>c.seq?1:l.seq<c.seq?-1:0},a=this.compareKeys,this.compareCompositeKeys=function(l,c){return a(l[1],c[1])}};u.Registry.prototype.compareRegistryTokens=function(e,t){return e.seq>t.seq?1:e.seq<t.seq?-1:0};u.Registry.prototype.registerAmbigToken=function(e,t,i){if(this.registry[t]||u.debug("Warning: unregistered item: itemID=("+t+"), akey=("+e+")"),this.registry[t]&&this.registry[t].disambig&&this.registry[t].disambig.names)for(var n=0,r=i.names.length;n<r;n+=1){var a=i.names[n],o=this.registry[t].disambig.names[n];if(a!==o)this.state.tmp.taintedItemIDs[t]=!0;else if(i.givens[n])for(var l=0,c=i.givens[n].length;l<c;l+=1){var f=i.givens[n][l],p=this.registry[t].disambig.givens[n][l];f!==p&&(this.state.tmp.taintedItemIDs[t]=!0)}}this.ambigcites[e]||(this.ambigcites[e]=[]),this.ambigcites[e].indexOf(""+t)===-1&&this.ambigcites[e].push(""+t),this.registry[t].ambig=e,this.registry[t].disambig=u.cloneAmbigConfig(i)};u.getSortKeys=function(e,t){var i,n,r,a,o,l;for(i=this.tmp.area,n=this.tmp.root,r=this.tmp.extension,a=u.Util.Sort.strip_prepositions,this.tmp.area=t,this.tmp.root=t.indexOf("_")>-1?t.slice(0,-5):t,this.tmp.extension="_sort",this.tmp.disambig_override=!0,this.tmp.disambig_request=!1,this.tmp.suppress_decorations=!0,u.getCite.call(this,e),this.tmp.suppress_decorations=!1,this.tmp.disambig_override=!1,o=this[t].keys.length,l=0;l<o;l+=1)this[t].keys[l]=a(this[t].keys[l]);return this.tmp.area=i,this.tmp.root=n,this.tmp.extension=r,this[t].keys};u.Registry.NameReg=function(e){var t,i,n,r,a,o,l,c,f,p,m,d;this.state=e,this.namereg={},this.nameind={},this.nameindpkeys={},this.itemkeyreg={},l=function(h){return h||(h=""),h.replace(/\./g," ").replace(/\s+/g," ").replace(/\s+$/,"")},c=function(h,v,b){t=l(b.family),h.opt["demote-non-dropping-particle"]==="never"&&b["non-dropping-particle"]&&b.family&&(t=`${t} ${b["non-dropping-particle"]}`),n=l(b.given);var y=n.match(/[,\!]* ([^,]+)$/);y&&y[1]===y[1].toLowerCase()&&(n=n.replace(/[,\!]* [^,]+$/,"")),i=u.Util.Names.initializeWith(h,n,"%s"),h.citation.opt["givenname-disambiguation-rule"]==="by-cite"&&(t=""+v+t)},f=function(h,v,b,y,g,x){var k;if(e.tmp.area.slice(0,12)==="bibliography"&&!g)return typeof x=="string"?1:2;var w=e.nameOutput.getName(v,"locale-translit",!0);v=w.name,c(this.state,""+h,v),k=2,r=e.opt["disambiguate-add-givenname"],a=e.citation.opt["givenname-disambiguation-rule"];var C=a;if(a==="by-cite"&&(a="all-names"),g==="short"?k=0:typeof x=="string"&&(k=1),typeof this.namereg[t]>"u"||typeof this.namereg[t].ikey[i]>"u")return k;if(C==="by-cite"&&k<=y)return y;if(!r||typeof a=="string"&&a.slice(0,12)==="primary-name"&&b>0||(!a||a==="all-names"||a==="primary-name"?(this.namereg[t].count>1&&(k=1),(this.namereg[t].ikey&&this.namereg[t].ikey[i].count>1||this.namereg[t].count>1&&typeof x!="string")&&(k=2)):(a==="all-names-with-initials"||a==="primary-name-with-initials")&&(this.namereg[t].count>1?k=1:k=0),e.registry.registry[h]))return k;if(g=="short")return 0;if(typeof x=="string")return 1},p=function(h){var v,b,y,g,x;(typeof h=="string"||typeof h=="number")&&(h=[""+h]);var k={};for(b=h.length,v=0;v<b;v+=1)if(g=""+h[v],!!this.nameind[g]){for(x in this.nameind[g])if(this.nameind[g].hasOwnProperty(x)){var w=x.split("::");if(t=w[0],i=w[1],n=w[2],typeof this.namereg[t]>"u")continue;if(o=this.namereg[t].items,n&&this.namereg[t].ikey[i]&&this.namereg[t].ikey[i].skey[n]&&(d=this.namereg[t].ikey[i].skey[n].items,y=d.indexOf(""+g),y>-1&&(this.namereg[t].ikey[i].skey[n].items=d.slice(0,y).concat(d.slice([y+1]))),this.namereg[t].ikey[i].skey[n].items.length===0&&(delete this.namereg[t].ikey[i].skey[n],this.namereg[t].ikey[i].count+=-1,this.namereg[t].ikey[i].count<2)))for(var C=0,E=this.namereg[t].ikey[i].items.length;C<E;C+=1)e.tmp.taintedItemIDs[this.namereg[t].ikey[i].items[C]]=!0;if(i&&this.namereg[t].ikey[i]&&(y=this.namereg[t].ikey[i].items.indexOf(""+g),y>-1&&(o=this.namereg[t].ikey[i].items.slice(),this.namereg[t].ikey[i].items=o.slice(0,y).concat(o.slice([y+1]))),this.namereg[t].ikey[i].items.length===0&&(delete this.namereg[t].ikey[i],this.namereg[t].count+=-1,this.namereg[t].count<2)))for(var C=0,E=this.namereg[t].items.length;C<E;C+=1)e.tmp.taintedItemIDs[this.namereg[t].items[C]]=!0;t&&(y=this.namereg[t].items.indexOf(""+g),y>-1&&(o=this.namereg[t].items.slice(),this.namereg[t].items=o.slice(0,y).concat(o.slice([y+1],o.length))),this.namereg[t].items.length<2&&delete this.namereg[t]),delete this.nameind[g][x]}delete this.nameind[g],delete this.nameindpkeys[g]}return k},m=function(h,v,b){var y,g,x=e.nameOutput.getName(v,"locale-translit",!0);if(v=x.name,!(e.citation.opt["givenname-disambiguation-rule"]&&e.citation.opt["givenname-disambiguation-rule"].slice(0,8)==="primary-"&&b!==0)){if(c(this.state,""+h,v),t&&(typeof this.namereg[t]>"u"?(this.namereg[t]={},this.namereg[t].count=0,this.namereg[t].ikey={},this.namereg[t].items=[h]):this.namereg[t].items.indexOf(h)===-1&&this.namereg[t].items.push(h)),t&&i)if(typeof this.namereg[t].ikey[i]>"u"){if(this.namereg[t].ikey[i]={},this.namereg[t].ikey[i].count=0,this.namereg[t].ikey[i].skey={},this.namereg[t].ikey[i].items=[h],this.namereg[t].count+=1,this.namereg[t].count===2)for(var y=0,g=this.namereg[t].items.length;y<g;y+=1)e.tmp.taintedItemIDs[this.namereg[t].items[y]]=!0}else this.namereg[t].ikey[i].items.indexOf(h)===-1&&this.namereg[t].ikey[i].items.push(h);if(t&&i&&n)if(typeof this.namereg[t].ikey[i].skey[n]>"u"){if(this.namereg[t].ikey[i].skey[n]={},this.namereg[t].ikey[i].skey[n].items=[h],this.namereg[t].ikey[i].count+=1,this.namereg[t].ikey[i].count===2)for(var y=0,g=this.namereg[t].ikey[i].items.length;y<g;y+=1)e.tmp.taintedItemIDs[this.namereg[t].ikey[i].items[y]]=!0}else this.namereg[t].ikey[i].skey[n].items.indexOf(h)===-1&&this.namereg[t].ikey[i].skey[n].items.push(h);typeof this.nameind[h]>"u"&&(this.nameind[h]={},this.nameindpkeys[h]={}),t&&(this.nameind[h][t+"::"+i+"::"+n]=!0,this.nameindpkeys[h][t]=this.namereg[t])}},this.addname=m,this.delitems=p,this.evalname=f};u.Registry.CitationReg=function(){this.citationById={},this.citationByIndex=[]};u.Disambiguation=function(e){this.state=e,this.sys=this.state.sys,this.registry=e.registry.registry,this.ambigcites=e.registry.ambigcites,this.configModes(),this.debug=!1};u.Disambiguation.prototype.run=function(e){this.modes.length&&(this.debug&&this.state.sys.print("[A] === RUN ==="),this.akey=e,this.initVars(e)&&this.runDisambig())};u.Disambiguation.prototype.runDisambig=function(){var e;for(this.debug&&this.state.sys.print("[C] === runDisambig() ==="),this.initGivens=!0;this.lists.length;){for(this.gnameset=0,this.gname=0,this.clashes=[1,0];this.lists[0][1].length;)this.listpos=0,this.base||(this.base=this.lists[0][0]),e=this.incrementDisambig(),this.scanItems(this.lists[0]),this.evalScan(e);this.lists=this.lists.slice(1)}};u.Disambiguation.prototype.scanItems=function(e){var t,i,n;this.debug&&this.state.sys.print("[2] === scanItems() ==="),this.Item=e[1][0],this.ItemCite=u.getAmbiguousCite.call(this.state,this.Item,this.base,!0),this.scanlist=e[1],this.partners=[],this.partners.push(this.Item),this.nonpartners=[];for(var r=0,t=1,i=e[1].length;t<i;t+=1){n=e[1][t];var a=u.getAmbiguousCite.call(this.state,n,this.base,!0);this.debug&&t>1&&this.state.sys.print(" -----------"),this.ItemCite===a?(this.debug&&(this.state.sys.print(" [CLASH]--> "+this.Item.id+": "+this.ItemCite),this.state.sys.print(" "+n.id+": "+a)),r+=1,this.partners.push(n)):(this.debug&&(this.state.sys.print(" [clear]--> "+this.Item.id+": "+this.ItemCite),this.state.sys.print(" "+n.id+": "+a)),this.nonpartners.push(n))}this.clashes[0]=this.clashes[1],this.clashes[1]=r};u.Disambiguation.prototype.evalScan=function(e){this[this.modes[this.modeindex]](e),e&&(this.modeindex<this.modes.length-1?this.modeindex+=1:this.lists[this.listpos+1]=[this.base,[]])};u.Disambiguation.prototype.disNames=function(e){var t,i;if(this.debug&&this.state.sys.print("[3] == disNames() =="),this.clashes[1]===0&&this.nonpartners.length===1)this.captureStepToBase(),this.debug&&(this.state.sys.print(" ** RESOLUTION [a]: lone partner, one nonpartner"),this.state.sys.print(" registering "+this.partners[0].id+" and "+this.nonpartners[0].id)),this.state.registry.registerAmbigToken(this.akey,""+this.nonpartners[0].id,this.betterbase),this.state.registry.registerAmbigToken(this.akey,""+this.partners[0].id,this.betterbase),this.lists[this.listpos]=[this.betterbase,[]];else if(this.clashes[1]===0)this.captureStepToBase(),this.debug&&(this.state.sys.print(" ** RESOLUTION [b]: lone partner, unknown number of remaining nonpartners"),this.state.sys.print(" registering "+this.partners[0].id)),this.state.registry.registerAmbigToken(this.akey,""+this.partners[0].id,this.betterbase),this.lists[this.listpos]=[this.betterbase,this.nonpartners],this.nonpartners.length&&(this.initGivens=!0);else if(this.nonpartners.length===1)this.captureStepToBase(),this.debug&&(this.state.sys.print(" ** RESOLUTION [c]: lone nonpartner, unknown number of partners remaining"),this.state.sys.print(" registering "+this.nonpartners[0].id)),this.state.registry.registerAmbigToken(this.akey,""+this.nonpartners[0].id,this.betterbase),this.lists[this.listpos]=[this.betterbase,this.partners];else if(this.clashes[1]<this.clashes[0])this.captureStepToBase(),this.debug&&this.state.sys.print(" ** RESOLUTION [d]: better result, but no entries safe to register"),this.lists[this.listpos]=[this.betterbase,this.partners],this.lists.push([this.betterbase,this.nonpartners]);else if(this.debug&&this.state.sys.print(" ** RESOLUTION [e]: no improvement, and clashes remain"),e&&(this.lists[this.listpos]=[this.betterbase,this.nonpartners],this.lists.push([this.betterbase,this.partners]),this.modeindex===this.modes.length-1)){this.debug&&this.state.sys.print(" (registering clashing entries because we've run out of options)");for(var t=0,i=this.partners.length;t<i;t+=1)this.state.registry.registerAmbigToken(this.akey,""+this.partners[t].id,this.betterbase);this.lists[this.listpos]=[this.betterbase,[]]}};u.Disambiguation.prototype.disExtraText=function(){this.debug&&this.state.sys.print("[3] === disExtraText ==");var e=!1;if(this.clashes[1]===0&&this.nonpartners.length<2&&(e=!0),!e&&(!this.base.disambiguate||this.state.tmp.disambiguate_count!==this.state.tmp.disambiguate_maxMax))if(this.modeindex=0,this.base.disambiguate=this.state.tmp.disambiguate_count,this.betterbase.disambiguate=this.state.tmp.disambiguate_count,this.base.disambiguate)this.disNames();else{this.initGivens=!0,this.base.disambiguate=1;for(var t=0,i=this.lists[this.listpos][1].length;t<i;t+=1)this.state.tmp.taintedItemIDs[this.lists[this.listpos][1][t].id]=!0}else if(e||this.state.tmp.disambiguate_count===this.state.tmp.disambiguate_maxMax)if(e||this.modeindex===this.modes.length-1){for(var n=this.lists[this.listpos][0],t=0,i=this.lists[this.listpos][1].length;t<i;t+=1)this.state.tmp.taintedItemIDs[this.lists[this.listpos][1][t].id]=!0,this.state.registry.registerAmbigToken(this.akey,""+this.lists[this.listpos][1][t].id,n);this.lists[this.listpos]=[this.betterbase,[]]}else{this.modeindex=this.modes.length-1;var n=this.lists[this.listpos][0];n.disambiguate=!0;for(var t=0,i=this.lists[this.listpos][1].length;t<i;t+=1)this.state.tmp.taintedItemIDs[this.lists[this.listpos][1][t].id]=!0,this.state.registry.registerAmbigToken(this.akey,""+this.lists[this.listpos][1][t].id,n)}};u.Disambiguation.prototype.disYears=function(){var e,t,i,n;this.debug&&this.state.sys.print("[3] === disYears =="),i=[];var r=this.lists[this.listpos][0];if(this.clashes[1])for(var a=0,o=this.state.registry.mylist.length;a<o;a+=1)for(var l=this.state.registry.mylist[a],c=0,f=this.lists[this.listpos][1].length;c<f;c+=1){var n=this.lists[this.listpos][1][c];if(n.id==l){i.push(this.registry[n.id]);break}}i.sort(this.state.registry.sorter.compareKeys);for(var e=0,t=i.length;e<t;e+=1){r.year_suffix=""+e;var p=this.state.registry.registry[i[e].id].disambig;this.state.registry.registerAmbigToken(this.akey,""+i[e].id,r),u.ambigConfigDiff(p,r)&&(this.state.tmp.taintedItemIDs[i[e].id]=!0)}this.lists[this.listpos]=[this.betterbase,[]]};u.Disambiguation.prototype.incrementDisambig=function(){if(this.debug&&this.state.sys.print(`
494
- [1] === incrementDisambig() ===`),this.initGivens)return this.initGivens=!1,!1;var e=!1,t=!0;if(this.modes[this.modeindex]==="disNames"){t=!1,typeof this.givensMax!="number"&&(t=!0);var i=!1;typeof this.namesMax!="number"&&(i=!0),typeof this.givensMax=="number"&&(this.base.givens.length&&this.base.givens[this.gnameset][this.gname]<this.givensMax?this.base.givens[this.gnameset][this.gname]+=1:t=!0),typeof this.namesMax=="number"&&t&&(this.state.opt["disambiguate-add-names"]?(i=!1,this.gname<this.namesMax?(this.base.names[this.gnameset]+=1,this.gname+=1):i=!0):i=!0),typeof this.namesetsMax=="number"&&i&&this.gnameset<this.namesetsMax&&(this.gnameset+=1,this.base.names[this.gnameset]=1,this.gname=0),this.debug&&(this.state.sys.print(" ------------------"),this.state.sys.print(" incremented values"),this.state.sys.print(" ------------------"),this.state.sys.print(" | gnameset: "+this.gnameset),this.state.sys.print(" | gname: "+this.gname),this.state.sys.print(" | names value: "+this.base.names[this.gnameset]),this.base.givens.length?this.state.sys.print(" | givens value: "+this.base.givens[this.gnameset][this.gname]):this.state.sys.print(" | givens value: nil"),this.state.sys.print(" | namesetsMax: "+this.namesetsMax),this.state.sys.print(" | namesMax: "+this.namesMax),this.state.sys.print(" | givensMax: "+this.givensMax)),(typeof this.namesetsMax!="number"||this.namesetsMax===-1||this.gnameset===this.namesetsMax)&&(!this.state.opt["disambiguate-add-names"]||typeof this.namesMax!="number"||this.gname===this.namesMax)&&(typeof this.givensMax!="number"||typeof this.base.givens[this.gnameset]>"u"||typeof this.base.givens[this.gnameset][this.gname]>"u"||this.base.givens[this.gnameset][this.gname]===this.givensMax)&&(e=!0,this.debug&&this.state.sys.print(" MAXED"))}else this.modes[this.modeindex]==="disExtraText"&&(this.base.disambiguate+=1,this.betterbase.disambiguate+=1);return e};u.Disambiguation.prototype.initVars=function(e){var a,o,t,i,n;if(this.debug&&this.state.sys.print("[B] === initVars() ==="),this.lists=[],this.base=!1,this.betterbase=!1,this.akey=e,this.maxNamesByItemId={},i=[],t=this.ambigcites[e],!t||!t.length)return!1;var r=this.state.refetchItem(""+t[0]);if(this.getCiteData(r),this.base=u.getAmbigConfig.call(this.state),t&&t.length>1){i.push([this.maxNamesByItemId[r.id],r]);for(var a=1,o=t.length;a<o;a+=1)r=this.state.refetchItem(""+t[a]),this.getCiteData(r,this.base),i.push([this.maxNamesByItemId[r.id],r]);i.sort(function(l,c){return l[0]>c[0]?1:l[0]<c[0]?-1:l[1].id>c[1].id?1:l[1].id<c[1].id?-1:0}),n=[];for(var a=0,o=i.length;a<o;a+=1)n.push(i[a][1]);this.lists.push([this.base,n]),this.Item=this.lists[0][1][0]}else this.Item=this.state.refetchItem(""+t[0]);this.modeindex=0;var a,o;return this.state.citation.opt["disambiguate-add-names"],this.namesMax=this.maxNamesByItemId[this.Item.id][0],this.padBase(this.base),this.padBase(this.betterbase),this.base.year_suffix=!1,this.base.disambiguate=!1,this.betterbase.year_suffix=!1,this.betterbase.disambiguate=!1,this.state.citation.opt["givenname-disambiguation-rule"]==="by-cite"&&this.state.opt["disambiguate-add-givenname"]&&(this.givensMax=2),!0};u.Disambiguation.prototype.padBase=function(e){for(var t=0,i=e.names.length;t<i;t+=1){e.givens[t]||(e.givens[t]=[]);for(var n=0,r=e.names[t];n<r;n+=1)e.givens[t][n]||(e.givens[t][n]=0)}};u.Disambiguation.prototype.configModes=function(){var e,t;this.modes=[],e=this.state.opt["disambiguate-add-givenname"],t=this.state.citation.opt["givenname-disambiguation-rule"],(this.state.opt["disambiguate-add-names"]||e&&t==="by-cite")&&this.modes.push("disNames"),this.state.opt.development_extensions.prioritize_disambiguate_condition?(this.state.opt.has_disambiguate&&this.modes.push("disExtraText"),this.state.opt["disambiguate-add-year-suffix"]&&this.modes.push("disYears")):(this.state.opt["disambiguate-add-year-suffix"]&&this.modes.push("disYears"),this.state.opt.has_disambiguate&&this.modes.push("disExtraText"))};u.Disambiguation.prototype.getCiteData=function(e,t){if(!this.maxNamesByItemId[e.id]){u.getAmbiguousCite.call(this.state,e,t),t=u.getAmbigConfig.call(this.state),this.maxNamesByItemId[e.id]=u.getMaxVals.call(this.state),this.state.registry.registry[e.id].disambig.givens=this.state.tmp.disambig_settings.givens.slice();for(var i=0,n=this.state.registry.registry[e.id].disambig.givens.length;i<n;i+=1)this.state.registry.registry[e.id].disambig.givens[i]=this.state.tmp.disambig_settings.givens[i].slice();this.namesetsMax=this.state.registry.registry[e.id].disambig.names.length-1,this.base||(this.base=t,this.betterbase=u.cloneAmbigConfig(t)),t.names.length<this.base.names.length&&(this.base=t);for(var i=0,n=t.names.length;i<n;i+=1)t.names[i]>this.base.names[i]&&(this.base.givens[i]=t.givens[i].slice(),this.base.names[i]=t.names[i],this.betterbase.names=this.base.names.slice(),this.betterbase.givens=this.base.givens.slice(),this.padBase(this.base),this.padBase(this.betterbase));this.betterbase.givens=this.base.givens.slice();for(var r=0,a=this.base.givens.length;r<a;r+=1)this.betterbase.givens[r]=this.base.givens[r].slice()}};u.Disambiguation.prototype.captureStepToBase=function(){this.state.citation.opt["givenname-disambiguation-rule"]==="by-cite"&&this.base.givens&&this.base.givens.length&&typeof this.base.givens[this.gnameset][this.gname]<"u"&&(this.betterbase.givens.length<this.base.givens.length&&(this.betterbase.givens=JSON.parse(JSON.stringify(this.base.givens))),this.betterbase.givens[this.gnameset][this.gname]=this.base.givens[this.gnameset][this.gname]),this.betterbase.names[this.gnameset]=this.base.names[this.gnameset]};u.Engine.prototype.getJurisdictionList=function(e){for(var t=[],i=e.split(":"),n=i.length;n>0;n--){var r=i.slice(0,n).join(":");if(t.push(r),this.opt.jurisdiction_fallbacks[r]){var a=this.opt.jurisdiction_fallbacks[r];t.push(a)}}return t.indexOf("us")===-1&&t.push("us"),t};u.Engine.prototype.loadStyleModule=function(e,t,i){var n=null;this.juris[e]={};var r=u.setupXml(t);r.addMissingNameNodes(r.dataObj),r.addInstitutionNodes(r.dataObj),r.insertPublisherAndPlace(r.dataObj),r.flagDateMacros(r.dataObj);for(var m=r.getNodesByName(r.dataObj,"law-module"),a=0,o=m.length;a<o;a++){var l=r.getAttributeValue(m[a],"types");if(l){this.juris[e].types={},l=l.split(/\s+/);for(var c=0,f=l.length;c<f;c++)this.juris[e].types[l[c]]=!0}i||(n=r.getAttributeValue(m[a],"fallback"),n&&e!=="us"&&(this.opt.jurisdiction_fallbacks[e]=n))}var p=this.opt.lang?this.opt.lang:this.opt["default-locale"][0];u.SET_COURT_CLASSES(this,p,r,r.dataObj),this.juris[e].types||(this.juris[e].types=u.MODULE_TYPES);for(var m=r.getNodesByName(r.dataObj,"macro"),a=0,o=m.length;a<o;a++){var d=r.getAttributeValue(m[a],"name");if(!u.MODULE_MACROS[d]){u.debug('CSL: skipping non-modular macro name "'+d+'" in module context');continue}this.juris[e][d]=[],this.buildTokenLists(m[a],this.juris[e][d]),this.configureTokenList(this.juris[e][d])}return n};u.Engine.prototype.retrieveAllStyleModules=function(e){var t={},i=this.locale[this.opt.lang].opts["jurisdiction-preference"];i=i||[],i=[""].concat(i);for(var n=i.length-1;n>-1;n--)for(var r=i[n],a=0,o=e.length;a<o;a++){var l=e[a];if(!this.opt.jurisdictions_seen[l]){var c=this.sys.retrieveStyleModule(l,r);(!c&&!r||c)&&(this.opt.jurisdictions_seen[l]=!0),c&&(t[l]=c)}}return t};u.ParticleList=function(){var e=[[[0,1],null]],t=[[[0,3],null]],i=[[null,[0,1]]],n=[[null,[0,2]]],r=[[null,[0,3]]],a=[[null,[0,1]],[[0,1],null]],o=[[null,[0,2]],[[0,2],null]],l=[[[0,1],null],[null,[0,1]]],c=[[[0,2],null],[null,[0,2]]],f=[[[0,3],null],[null,[0,3]]],p=[[null,[0,2]],[[0,1],[1,2]]],m=[["'s",i],["'s-",i],["'t",i],["a",i],["aan 't",n],["aan de",n],["aan den",n],["aan der",n],["aan het",n],["aan t",n],["aan",i],["ad-",a],["adh-",a],["af",a],["al",a],["al-",a],["am de",n],["am",i],["an-",a],["ar-",a],["as-",a],["ash-",a],["at-",a],["ath-",a],["auf dem",c],["auf den",c],["auf der",c],["auf ter",n],["auf",l],["aus 'm",c],["aus dem",c],["aus den",c],["aus der",c],["aus m",c],["aus",l],["aus'm",c],["az-",a],["aš-",a],["aḍ-",a],["aḏ-",a],["aṣ-",a],["aṭ-",a],["aṯ-",a],["aẓ-",a],["ben",i],["bij 't",n],["bij de",n],["bij den",n],["bij het",n],["bij t",n],["bij",i],["bin",i],["boven d",n],["boven d'",n],["d",i],["d'",a],["da",a],["dal",i],["dal'",i],["dall'",i],["dalla",i],["das",a],["de die le",r],["de die",n],["de l",n],["de l'",n],["de la",p],["de las",p],["de le",n],["de li",o],["de van der",r],["de",a],["de'",a],["deca",i],["degli",a],["dei",a],["del",a],["dela",e],["dell'",a],["della",a],["delle",a],["dello",a],["den",a],["der",a],["des",a],["di",a],["die le",n],["do",i],["don",i],["dos",a],["du",a],["ed-",a],["edh-",a],["el",a],["el-",a],["en-",a],["er-",a],["es-",a],["esh-",a],["et-",a],["eth-",a],["ez-",a],["eš-",a],["eḍ-",a],["eḏ-",a],["eṣ-",a],["eṭ-",a],["eṯ-",a],["eẓ-",a],["het",i],["i",i],["il",e],["im",i],["in 't",n],["in de",n],["in den",n],["in der",o],["in het",n],["in t",n],["in",i],["l",i],["l'",i],["la",i],["las",i],["le",i],["les",a],["lo",a],["los",i],["lou",i],["of",i],["onder 't",n],["onder de",n],["onder den",n],["onder het",n],["onder t",n],["onder",i],["op 't",n],["op de",o],["op den",n],["op der",n],["op gen",n],["op het",n],["op t",n],["op ten",n],["op",i],["over 't",n],["over de",n],["over den",n],["over het",n],["over t",n],["over",i],["s",i],["s'",i],["sen",e],["t",i],["te",i],["ten",i],["ter",i],["tho",i],["thoe",i],["thor",i],["to",i],["toe",i],["tot",i],["uijt 't",n],["uijt de",n],["uijt den",n],["uijt te de",r],["uijt ten",n],["uijt",i],["uit 't",n],["uit de",n],["uit den",n],["uit het",n],["uit t",n],["uit te de",r],["uit ten",n],["uit",i],["unter",i],["v",i],["v.",i],["v.d.",i],["van 't",n],["van de l",r],["van de l'",r],["van de",n],["van de",n],["van den",n],["van der",n],["van gen",n],["van het",n],["van la",n],["van t",n],["van ter",n],["van van de",r],["van",a],["vander",i],["vd",i],["ver",i],["vom und zum",t],["vom",a],["von 't",n],["von dem",c],["von den",c],["von der",c],["von t",n],["von und zu",f],["von zu",c],["von",l],["voor 't",n],["voor de",n],["voor den",n],["voor in 't",r],["voor in t",r],["voor",i],["vor der",c],["vor",l],["z",e],["ze",e],["zu",l],["zum",a],["zur",a]];return m}();u.parseParticles=function(){function e(n,r,a){var o=n;n=n;var l=[],c,f;r?(n=n.split("").reverse().join(""),c=u.PARTICLE_GIVEN_REGEXP):c=u.PARTICLE_FAMILY_REGEXP;for(var p=n.match(c);p;){var m=r?p[1].split("").reverse().join(""):p[1],d=p?m:!1,d=d?m.replace(/^[-\'\u02bb\u2019\s]*(.).*$/,"$1"):!1;if(f=d?d.toUpperCase()!==d:!1,!f)break;r?(l.push(o.slice(m.length*-1)),o=o.slice(0,m.length*-1)):(l.push(o.slice(0,m.length)),o=o.slice(m.length)),n=p[2],p=n.match(c)}if(r){n=n.split("").reverse().join(""),l.reverse();for(var h=1,v=l.length;h<v;h++)l[h].slice(0,1)==" "&&(l[h-1]+=" ");for(var h=0,v=l.length;h<v;h++)l[h].slice(0,1)==" "&&(l[h]=l[h].slice(1));n=o.slice(0,n.length)}else n=o.slice(n.length*-1);return[f,n,l]}function t(n){var r=n.slice(-1);return n=n.trim(),r===" "&&["'","’"].indexOf(n.slice(-1))>-1&&(n+=" "),n}function i(n){if(!n.suffix&&n.given){var r=n.given.match(/(\s*,!*\s*)/);if(r){var a=n.given.indexOf(r[1]),o=n.given.slice(a+r[1].length),l=n.given.slice(a,a+r[1].length).replace(/\s*/g,"");o.replace(/\./g,"")==="et al"&&!n["dropping-particle"]?(n["dropping-particle"]=o,n["comma-dropping-particle"]=","):(l.length===2&&(n["comma-suffix"]=!0),n.suffix=o),n.given=n.given.slice(0,a)}}}return function(n){var l=e(n.family),r=l[1],a=l[2];n.family=r;var o=t(a.join(""));o&&(n["non-dropping-particle"]=o),i(n);var l=e(n.given,!0),c=l[1],f=l[2];n.given=c;var p=f.join("").trim();p&&(n["dropping-particle"]=p)}}();var Iv=u;const Dv=zv(Iv),Eu=65535,Nu=Math.pow(2,16);function Rv(e,t){return e+t*Nu}function Ml(e){return e&Eu}function Lv(e){return(e-(e&Eu))/Nu}const Au=1,Ou=2,Vr=4,Tu=8;class Do{constructor(t,i,n){this.pos=t,this.delInfo=i,this.recover=n}get deleted(){return(this.delInfo&Tu)>0}get deletedBefore(){return(this.delInfo&(Au|Vr))>0}get deletedAfter(){return(this.delInfo&(Ou|Vr))>0}get deletedAcross(){return(this.delInfo&Vr)>0}}class xt{constructor(t,i=!1){if(this.ranges=t,this.inverted=i,!t.length&&xt.empty)return xt.empty}recover(t){let i=0,n=Ml(t);if(!this.inverted)for(let r=0;r<n;r++)i+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[n*3]+i+Lv(t)}mapResult(t,i=1){return this._map(t,i,!1)}map(t,i=1){return this._map(t,i,!0)}_map(t,i,n){let r=0,a=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>t)break;let f=this.ranges[l+a],p=this.ranges[l+o],m=c+f;if(t<=m){let d=f?t==c?-1:t==m?1:i:i,h=c+r+(d<0?0:p);if(n)return h;let v=t==(i<0?c:m)?null:Rv(l/3,t-c),b=t==c?Ou:t==m?Au:Vr;return(i<0?t!=c:t!=m)&&(b|=Tu),new Do(h,b,v)}r+=p-f}return n?t+r:new Do(t+r,0,null)}touches(t,i){let n=0,r=Ml(i),a=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?n:0);if(c>t)break;let f=this.ranges[l+a],p=c+f;if(t<=p&&l==r*3)return!0;n+=this.ranges[l+o]-f}return!1}forEach(t){let i=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,a=0;r<this.ranges.length;r+=3){let o=this.ranges[r],l=o-(this.inverted?a:0),c=o+(this.inverted?0:a),f=this.ranges[r+i],p=this.ranges[r+n];t(l,l+f,c,c+p),a+=p-f}}invert(){return new xt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?xt.empty:new xt(t<0?[0,-t,0]:[0,0,t])}}xt.empty=new xt([]);class ea{constructor(t,i,n=0,r=t?t.length:0){this.mirror=i,this.from=n,this.to=r,this._maps=t||[],this.ownData=!(t||i)}get maps(){return this._maps}slice(t=0,i=this.maps.length){return new ea(this._maps,this.mirror,t,i)}appendMap(t,i){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),i!=null&&this.setMirror(this._maps.length-1,i)}appendMapping(t){for(let i=0,n=this._maps.length;i<t._maps.length;i++){let r=t.getMirror(i);this.appendMap(t._maps[i],r!=null&&r<i?n+r:void 0)}}getMirror(t){if(this.mirror){for(let i=0;i<this.mirror.length;i++)if(this.mirror[i]==t)return this.mirror[i+(i%2?-1:1)]}}setMirror(t,i){this.mirror||(this.mirror=[]),this.mirror.push(t,i)}appendMappingInverted(t){for(let i=t.maps.length-1,n=this._maps.length+t._maps.length;i>=0;i--){let r=t.getMirror(i);this.appendMap(t._maps[i].invert(),r!=null&&r>i?n-r-1:void 0)}}invert(){let t=new ea;return t.appendMappingInverted(this),t}map(t,i=1){if(this.mirror)return this._map(t,i,!0);for(let n=this.from;n<this.to;n++)t=this._maps[n].map(t,i);return t}mapResult(t,i=1){return this._map(t,i,!1)}_map(t,i,n){let r=0;for(let a=this.from;a<this.to;a++){let o=this._maps[a],l=o.mapResult(t,i);if(l.recover!=null){let c=this.getMirror(a);if(c!=null&&c>a&&c<this.to){a=c,t=this._maps[c].recover(l.recover);continue}}r|=l.delInfo,t=l.pos}return n?t:new Do(t,r,null)}}const io=Object.create(null);class at{getMap(){return xt.empty}merge(t){return null}static fromJSON(t,i){if(!i||!i.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=io[i.stepType];if(!n)throw new RangeError(`No step type ${i.stepType} defined`);return n.fromJSON(t,i)}static jsonID(t,i){if(t in io)throw new RangeError("Duplicate use of step JSON ID "+t);return io[t]=i,i.prototype.jsonID=t,i}}class je{constructor(t,i){this.doc=t,this.failed=i}static ok(t){return new je(t,null)}static fail(t){return new je(null,t)}static fromReplace(t,i,n,r){try{return je.ok(t.replace(i,n,r))}catch(a){if(a instanceof Pn)return je.fail(a.message);throw a}}}function ps(e,t,i){let n=[];for(let r=0;r<e.childCount;r++){let a=e.child(r);a.content.size&&(a=a.copy(ps(a.content,t,a))),a.isInline&&(a=t(a,i,r)),n.push(a)}return Z.fromArray(n)}class hi extends at{constructor(t,i,n){super(),this.from=t,this.to=i,this.mark=n}apply(t){let i=t.slice(this.from,this.to),n=t.resolve(this.from),r=n.node(n.sharedDepth(this.to)),a=new ae(ps(i.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),r),i.openStart,i.openEnd);return je.fromReplace(t,this.from,this.to,a)}invert(){return new Vt(this.from,this.to,this.mark)}map(t){let i=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return i.deleted&&n.deleted||i.pos>=n.pos?null:new hi(i.pos,n.pos,this.mark)}merge(t){return t instanceof hi&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new hi(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,i){if(typeof i.from!="number"||typeof i.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new hi(i.from,i.to,t.markFromJSON(i.mark))}}at.jsonID("addMark",hi);class Vt extends at{constructor(t,i,n){super(),this.from=t,this.to=i,this.mark=n}apply(t){let i=t.slice(this.from,this.to),n=new ae(ps(i.content,r=>r.mark(this.mark.removeFromSet(r.marks)),t),i.openStart,i.openEnd);return je.fromReplace(t,this.from,this.to,n)}invert(){return new hi(this.from,this.to,this.mark)}map(t){let i=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return i.deleted&&n.deleted||i.pos>=n.pos?null:new Vt(i.pos,n.pos,this.mark)}merge(t){return t instanceof Vt&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Vt(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,i){if(typeof i.from!="number"||typeof i.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Vt(i.from,i.to,t.markFromJSON(i.mark))}}at.jsonID("removeMark",Vt);class bi extends at{constructor(t,i){super(),this.pos=t,this.mark=i}apply(t){let i=t.nodeAt(this.pos);if(!i)return je.fail("No node at mark step's position");let n=i.type.create(i.attrs,null,this.mark.addToSet(i.marks));return je.fromReplace(t,this.pos,this.pos+1,new ae(Z.from(n),0,i.isLeaf?0:1))}invert(t){let i=t.nodeAt(this.pos);if(i){let n=this.mark.addToSet(i.marks);if(n.length==i.marks.length){for(let r=0;r<i.marks.length;r++)if(!i.marks[r].isInSet(n))return new bi(this.pos,i.marks[r]);return new bi(this.pos,this.mark)}}return new Hi(this.pos,this.mark)}map(t){let i=t.mapResult(this.pos,1);return i.deletedAfter?null:new bi(i.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,i){if(typeof i.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new bi(i.pos,t.markFromJSON(i.mark))}}at.jsonID("addNodeMark",bi);class Hi extends at{constructor(t,i){super(),this.pos=t,this.mark=i}apply(t){let i=t.nodeAt(this.pos);if(!i)return je.fail("No node at mark step's position");let n=i.type.create(i.attrs,null,this.mark.removeFromSet(i.marks));return je.fromReplace(t,this.pos,this.pos+1,new ae(Z.from(n),0,i.isLeaf?0:1))}invert(t){let i=t.nodeAt(this.pos);return!i||!this.mark.isInSet(i.marks)?this:new bi(this.pos,this.mark)}map(t){let i=t.mapResult(this.pos,1);return i.deletedAfter?null:new Hi(i.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,i){if(typeof i.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Hi(i.pos,t.markFromJSON(i.mark))}}at.jsonID("removeNodeMark",Hi);class He extends at{constructor(t,i,n,r=!1){super(),this.from=t,this.to=i,this.slice=n,this.structure=r}apply(t){return this.structure&&Ro(t,this.from,this.to)?je.fail("Structure replace would overwrite content"):je.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new xt([this.from,this.to-this.from,this.slice.size])}invert(t){return new He(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let i=t.mapResult(this.to,-1),n=this.from==this.to&&He.MAP_BIAS<0?i:t.mapResult(this.from,1);return n.deletedAcross&&i.deletedAcross?null:new He(n.pos,Math.max(n.pos,i.pos),this.slice,this.structure)}merge(t){if(!(t instanceof He)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let i=this.slice.size+t.slice.size==0?ae.empty:new ae(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new He(this.from,this.to+(t.to-t.from),i,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let i=this.slice.size+t.slice.size==0?ae.empty:new ae(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new He(t.from,this.to,i,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,i){if(typeof i.from!="number"||typeof i.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new He(i.from,i.to,ae.fromJSON(t,i.slice),!!i.structure)}}He.MAP_BIAS=1;at.jsonID("replace",He);class Ge extends at{constructor(t,i,n,r,a,o,l=!1){super(),this.from=t,this.to=i,this.gapFrom=n,this.gapTo=r,this.slice=a,this.insert=o,this.structure=l}apply(t){if(this.structure&&(Ro(t,this.from,this.gapFrom)||Ro(t,this.gapTo,this.to)))return je.fail("Structure gap-replace would overwrite content");let i=t.slice(this.gapFrom,this.gapTo);if(i.openStart||i.openEnd)return je.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,i.content);return n?je.fromReplace(t,this.from,this.to,n):je.fail("Content does not fit in gap")}getMap(){return new xt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let i=this.gapTo-this.gapFrom;return new Ge(this.from,this.from+this.slice.size+i,this.from+this.insert,this.from+this.insert+i,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let i=t.mapResult(this.from,1),n=t.mapResult(this.to,-1),r=this.from==this.gapFrom?i.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?n.pos:t.map(this.gapTo,1);return i.deletedAcross&&n.deletedAcross||r<i.pos||a>n.pos?null:new Ge(i.pos,n.pos,r,a,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,i){if(typeof i.from!="number"||typeof i.to!="number"||typeof i.gapFrom!="number"||typeof i.gapTo!="number"||typeof i.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ge(i.from,i.to,i.gapFrom,i.gapTo,ae.fromJSON(t,i.slice),i.insert,!!i.structure)}}at.jsonID("replaceAround",Ge);function Ro(e,t,i){let n=e.resolve(t),r=i-t,a=n.depth;for(;r>0&&a>0&&n.indexAfter(a)==n.node(a).childCount;)a--,r--;if(r>0){let o=n.node(a).maybeChild(n.indexAfter(a));for(;r>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,r--}}return!1}function Bv(e,t,i,n){let r=[],a=[],o,l;e.doc.nodesBetween(t,i,(c,f,p)=>{if(!c.isInline)return;let m=c.marks;if(!n.isInSet(m)&&p.type.allowsMarkType(n.type)){let d=Math.max(f,t),h=Math.min(f+c.nodeSize,i),v=n.addToSet(m);for(let b=0;b<m.length;b++)m[b].isInSet(v)||(o&&o.to==d&&o.mark.eq(m[b])?o.to=h:r.push(o=new Vt(d,h,m[b])));l&&l.to==d?l.to=h:a.push(l=new hi(d,h,n))}}),r.forEach(c=>e.step(c)),a.forEach(c=>e.step(c))}function Pv(e,t,i,n){let r=[],a=0;e.doc.nodesBetween(t,i,(o,l)=>{if(!o.isInline)return;a++;let c=null;if(n instanceof Pa){let f=o.marks,p;for(;p=n.isInSet(f);)(c||(c=[])).push(p),f=p.removeFromSet(f)}else n?n.isInSet(o.marks)&&(c=[n]):c=o.marks;if(c&&c.length){let f=Math.min(l+o.nodeSize,i);for(let p=0;p<c.length;p++){let m=c[p],d;for(let h=0;h<r.length;h++){let v=r[h];v.step==a-1&&m.eq(r[h].style)&&(d=v)}d?(d.to=f,d.step=a):r.push({style:m,from:Math.max(l,t),to:f,step:a})}}}),r.forEach(o=>e.step(new Vt(o.from,o.to,o.style)))}function ds(e,t,i,n=i.contentMatch,r=!0){let a=e.doc.nodeAt(t),o=[],l=t+1;for(let c=0;c<a.childCount;c++){let f=a.child(c),p=l+f.nodeSize,m=n.matchType(f.type);if(!m)o.push(new He(l,p,ae.empty));else{n=m;for(let d=0;d<f.marks.length;d++)i.allowsMarkType(f.marks[d].type)||e.step(new Vt(l,p,f.marks[d]));if(r&&f.isText&&i.whitespace!="pre"){let d,h=/\r?\n|\r/g,v;for(;d=h.exec(f.text);)v||(v=new ae(Z.from(i.schema.text(" ",i.allowedMarks(f.marks))),0,0)),o.push(new He(l+d.index,l+d.index+d[0].length,v))}}l=p}if(!n.validEnd){let c=n.fillBefore(Z.empty,!0);e.replace(l,l,new ae(c,0,0))}for(let c=o.length-1;c>=0;c--)e.step(o[c])}function Vv(e,t,i){return(t==0||e.canReplace(t,e.childCount))&&(i==e.childCount||e.canReplace(0,i))}function pn(e){let i=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,a=0;;--n){let o=e.$from.node(n),l=e.$from.index(n)+r,c=e.$to.indexAfter(n)-a;if(n<e.depth&&o.canReplace(l,c,i))return n;if(n==0||o.type.spec.isolating||!Vv(o,l,c))break;l&&(r=1),c<o.childCount&&(a=1)}return null}function Fv(e,t,i){let{$from:n,$to:r,depth:a}=t,o=n.before(a+1),l=r.after(a+1),c=o,f=l,p=Z.empty,m=0;for(let v=a,b=!1;v>i;v--)b||n.index(v)>0?(b=!0,p=Z.from(n.node(v).copy(p)),m++):c--;let d=Z.empty,h=0;for(let v=a,b=!1;v>i;v--)b||r.after(v+1)<r.end(v)?(b=!0,d=Z.from(r.node(v).copy(d)),h++):f++;e.step(new Ge(c,f,o,l,new ae(p.append(d),m,h),p.size-m,!0))}function ms(e,t,i=null,n=e){let r=Uv(e,t),a=r&&Hv(n,t);return a?r.map(zl).concat({type:t,attrs:i}).concat(a.map(zl)):null}function zl(e){return{type:e,attrs:null}}function Uv(e,t){let{parent:i,startIndex:n,endIndex:r}=e,a=i.contentMatchAt(n).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return i.canReplaceWith(n,r,o)?a:null}function Hv(e,t){let{parent:i,startIndex:n,endIndex:r}=e,a=i.child(n),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let c=(o.length?o[o.length-1]:t).contentMatch;for(let f=n;c&&f<r;f++)c=c.matchType(i.child(f).type);return!c||!c.validEnd?null:o}function jv(e,t,i){let n=Z.empty;for(let o=i.length-1;o>=0;o--){if(n.size){let l=i[o].type.contentMatch.matchFragment(n);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=Z.from(i[o].type.create(i[o].attrs,n))}let r=t.start,a=t.end;e.step(new Ge(r,a,r,a,new ae(n,0,0),i.length,!0))}function qv(e,t,i,n,r){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=e.steps.length;e.doc.nodesBetween(t,i,(o,l)=>{let c=typeof r=="function"?r(o):r;if(o.isTextblock&&!o.hasMarkup(n,c)&&$v(e.doc,e.mapping.slice(a).map(l),n)){let f=null;if(n.schema.linebreakReplacement){let h=n.whitespace=="pre",v=!!n.contentMatch.matchType(n.schema.linebreakReplacement);h&&!v?f=!1:!h&&v&&(f=!0)}f===!1&&zu(e,o,l,a),ds(e,e.mapping.slice(a).map(l,1),n,void 0,f===null);let p=e.mapping.slice(a),m=p.map(l,1),d=p.map(l+o.nodeSize,1);return e.step(new Ge(m,d,m+1,d-1,new ae(Z.from(n.create(c,null,o.marks)),0,0),1,!0)),f===!0&&Mu(e,o,l,a),!1}})}function Mu(e,t,i,n){t.forEach((r,a)=>{if(r.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(r.text);){let c=e.mapping.slice(n).map(i+1+a+o.index);e.replaceWith(c,c+1,t.type.schema.linebreakReplacement.create())}}})}function zu(e,t,i,n){t.forEach((r,a)=>{if(r.type==r.type.schema.linebreakReplacement){let o=e.mapping.slice(n).map(i+1+a);e.replaceWith(o,o+1,t.type.schema.text(`
495
- `))}})}function $v(e,t,i){let n=e.resolve(t),r=n.index();return n.parent.canReplaceWith(r,r+1,i)}function Wv(e,t,i,n,r){let a=e.doc.nodeAt(t);if(!a)throw new RangeError("No node at given position");i||(i=a.type);let o=i.create(n,null,r||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!i.validContent(a.content))throw new RangeError("Invalid content for node type "+i.name);e.step(new Ge(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new ae(Z.from(o),0,0),1,!0))}function ii(e,t,i=1,n){let r=e.resolve(t),a=r.depth-i,o=n&&n[n.length-1]||r.parent;if(a<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!o.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let f=r.depth-1,p=i-2;f>a;f--,p--){let m=r.node(f),d=r.index(f);if(m.type.spec.isolating)return!1;let h=m.content.cutByIndex(d,m.childCount),v=n&&n[p+1];v&&(h=h.replaceChild(0,v.type.create(v.attrs)));let b=n&&n[p]||m;if(!m.canReplace(d+1,m.childCount)||!b.type.validContent(h))return!1}let l=r.indexAfter(a),c=n&&n[0];return r.node(a).canReplaceWith(l,l,c?c.type:r.node(a+1).type)}function Gv(e,t,i=1,n){let r=e.doc.resolve(t),a=Z.empty,o=Z.empty;for(let l=r.depth,c=r.depth-i,f=i-1;l>c;l--,f--){a=Z.from(r.node(l).copy(a));let p=n&&n[f];o=Z.from(p?p.type.create(p.attrs,o):r.node(l).copy(o))}e.step(new He(t,t,new ae(a.append(o),i,i),!0))}function ki(e,t){let i=e.resolve(t),n=i.index();return Iu(i.nodeBefore,i.nodeAfter)&&i.parent.canReplace(n,n+1)}function Kv(e,t){t.content.size||e.type.compatibleContent(t.type);let i=e.contentMatchAt(e.childCount),{linebreakReplacement:n}=e.type.schema;for(let r=0;r<t.childCount;r++){let a=t.child(r),o=a.type==n?e.type.schema.nodes.text:a.type;if(i=i.matchType(o),!i||!e.type.allowsMarks(a.marks))return!1}return i.validEnd}function Iu(e,t){return!!(e&&t&&!e.isLeaf&&Kv(e,t))}function Va(e,t,i=-1){let n=e.resolve(t);for(let r=n.depth;;r--){let a,o,l=n.index(r);if(r==n.depth?(a=n.nodeBefore,o=n.nodeAfter):i>0?(a=n.node(r+1),l++,o=n.node(r).maybeChild(l)):(a=n.node(r).maybeChild(l-1),o=n.node(r+1)),a&&!a.isTextblock&&Iu(a,o)&&n.node(r).canReplace(l,l+1))return t;if(r==0)break;t=i<0?n.before(r):n.after(r)}}function Xv(e,t,i){let n=null,{linebreakReplacement:r}=e.doc.type.schema,a=e.doc.resolve(t-i),o=a.node().type;if(r&&o.inlineContent){let p=o.whitespace=="pre",m=!!o.contentMatch.matchType(r);p&&!m?n=!1:!p&&m&&(n=!0)}let l=e.steps.length;if(n===!1){let p=e.doc.resolve(t+i);zu(e,p.node(),p.before(),l)}o.inlineContent&&ds(e,t+i-1,o,a.node().contentMatchAt(a.index()),n==null);let c=e.mapping.slice(l),f=c.map(t-i);if(e.step(new He(f,c.map(t+i,-1),ae.empty,!0)),n===!0){let p=e.doc.resolve(f);Mu(e,p.node(),p.before(),e.steps.length)}return e}function Jv(e,t,i){let n=e.resolve(t);if(n.parent.canReplaceWith(n.index(),n.index(),i))return t;if(n.parentOffset==0)for(let r=n.depth-1;r>=0;r--){let a=n.index(r);if(n.node(r).canReplaceWith(a,a,i))return n.before(r+1);if(a>0)return null}if(n.parentOffset==n.parent.content.size)for(let r=n.depth-1;r>=0;r--){let a=n.indexAfter(r);if(n.node(r).canReplaceWith(a,a,i))return n.after(r+1);if(a<n.node(r).childCount)return null}return null}function Zv(e,t,i){let n=e.resolve(t);if(!i.content.size)return t;let r=i.content;for(let a=0;a<i.openStart;a++)r=r.firstChild.content;for(let a=1;a<=(i.openStart==0&&i.size?2:1);a++)for(let o=n.depth;o>=0;o--){let l=o==n.depth?0:n.pos<=(n.start(o+1)+n.end(o+1))/2?-1:1,c=n.index(o)+(l>0?1:0),f=n.node(o),p=!1;if(a==1)p=f.canReplace(c,c,r);else{let m=f.contentMatchAt(c).findWrapping(r.firstChild.type);p=m&&f.canReplaceWith(c,c,m[0])}if(p)return l==0?n.pos:l<0?n.before(o+1):n.after(o+1)}return null}function Fa(e,t,i=t,n=ae.empty){if(t==i&&!n.size)return null;let r=e.resolve(t),a=e.resolve(i);return Du(r,a,n)?new He(t,i,n):new Qv(r,a,n).fit()}function Du(e,t,i){return!i.openStart&&!i.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),i.content)}class Qv{constructor(t,i,n){this.$from=t,this.$to=i,this.unplaced=n,this.frontier=[],this.placed=Z.empty;for(let r=0;r<=t.depth;r++){let a=t.node(r);this.frontier.push({type:a.type,match:a.contentMatchAt(t.indexAfter(r))})}for(let r=t.depth;r>0;r--)this.placed=Z.from(t.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let f=this.findFittable();f?this.placeNodes(f):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),i=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(t<0?this.$to:n.doc.resolve(t));if(!r)return null;let a=this.placed,o=n.depth,l=r.depth;for(;o&&l&&a.childCount==1;)a=a.firstChild.content,o--,l--;let c=new ae(a,o,l);return t>-1?new Ge(n.pos,t,this.$to.pos,this.$to.end(),c,i):c.size||n.pos!=this.$to.pos?new He(n.pos,r.pos,c):null}findFittable(){let t=this.unplaced.openStart;for(let i=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<t;n++){let a=i.firstChild;if(i.childCount>1&&(r=0),a.type.spec.isolating&&r<=n){t=n;break}i=a.content}for(let i=1;i<=2;i++)for(let n=i==1?t:this.unplaced.openStart;n>=0;n--){let r,a=null;n?(a=no(this.unplaced.content,n-1).firstChild,r=a.content):r=this.unplaced.content;let o=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:f}=this.frontier[l],p,m=null;if(i==1&&(o?f.matchType(o.type)||(m=f.fillBefore(Z.from(o),!1)):a&&c.compatibleContent(a.type)))return{sliceDepth:n,frontierDepth:l,parent:a,inject:m};if(i==2&&o&&(p=f.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:l,parent:a,wrap:p};if(a&&f.matchType(a.type))break}}}openMore(){let{content:t,openStart:i,openEnd:n}=this.unplaced,r=no(t,i);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new ae(t,i+1,Math.max(n,r.size+i>=t.size-n?i+1:0)),!0)}dropNode(){let{content:t,openStart:i,openEnd:n}=this.unplaced,r=no(t,i);if(r.childCount<=1&&i>0){let a=t.size-i<=i+r.size;this.unplaced=new ae(En(t,i-1,1),i-1,a?i-1:n)}else this.unplaced=new ae(En(t,i,1),i,n)}placeNodes({sliceDepth:t,frontierDepth:i,parent:n,inject:r,wrap:a}){for(;this.depth>i;)this.closeFrontierNode();if(a)for(let b=0;b<a.length;b++)this.openFrontierNode(a[b]);let o=this.unplaced,l=n?n.content:o.content,c=o.openStart-t,f=0,p=[],{match:m,type:d}=this.frontier[i];if(r){for(let b=0;b<r.childCount;b++)p.push(r.child(b));m=m.matchFragment(r)}let h=l.size+t-(o.content.size-o.openEnd);for(;f<l.childCount;){let b=l.child(f),y=m.matchType(b.type);if(!y)break;f++,(f>1||c==0||b.content.size)&&(m=y,p.push(Ru(b.mark(d.allowedMarks(b.marks)),f==1?c:0,f==l.childCount?h:-1)))}let v=f==l.childCount;v||(h=-1),this.placed=Nn(this.placed,i,Z.from(p)),this.frontier[i].match=m,v&&h<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let b=0,y=l;b<h;b++){let g=y.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),y=g.content}this.unplaced=v?t==0?ae.empty:new ae(En(o.content,t-1,1),t-1,h<0?o.openEnd:t-1):new ae(En(o.content,t,f),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],i;if(!t.type.isTextblock||!ro(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(i=this.findCloseLevel(this.$to))&&i.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(t){e:for(let i=Math.min(this.depth,t.depth);i>=0;i--){let{match:n,type:r}=this.frontier[i],a=i<t.depth&&t.end(i+1)==t.pos+(t.depth-(i+1)),o=ro(t,i,r,n,a);if(o){for(let l=i-1;l>=0;l--){let{match:c,type:f}=this.frontier[l],p=ro(t,l,f,c,!0);if(!p||p.childCount)continue e}return{depth:i,fit:o,move:a?t.doc.resolve(t.after(i+1)):t}}}}close(t){let i=this.findCloseLevel(t);if(!i)return null;for(;this.depth>i.depth;)this.closeFrontierNode();i.fit.childCount&&(this.placed=Nn(this.placed,i.depth,i.fit)),t=i.move;for(let n=i.depth+1;n<=t.depth;n++){let r=t.node(n),a=r.type.contentMatch.fillBefore(r.content,!0,t.index(n));this.openFrontierNode(r.type,r.attrs,a)}return t}openFrontierNode(t,i=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=Nn(this.placed,this.depth,Z.from(t.create(i,n))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let i=this.frontier.pop().match.fillBefore(Z.empty,!0);i.childCount&&(this.placed=Nn(this.placed,this.frontier.length,i))}}function En(e,t,i){return t==0?e.cutByIndex(i,e.childCount):e.replaceChild(0,e.firstChild.copy(En(e.firstChild.content,t-1,i)))}function Nn(e,t,i){return t==0?e.append(i):e.replaceChild(e.childCount-1,e.lastChild.copy(Nn(e.lastChild.content,t-1,i)))}function no(e,t){for(let i=0;i<t;i++)e=e.firstChild.content;return e}function Ru(e,t,i){if(t<=0)return e;let n=e.content;return t>1&&(n=n.replaceChild(0,Ru(n.firstChild,t-1,n.childCount==1?i-1:0))),t>0&&(n=e.type.contentMatch.fillBefore(n).append(n),i<=0&&(n=n.append(e.type.contentMatch.matchFragment(n).fillBefore(Z.empty,!0)))),e.copy(n)}function ro(e,t,i,n,r){let a=e.node(t),o=r?e.indexAfter(t):e.index(t);if(o==a.childCount&&!i.compatibleContent(a.type))return null;let l=n.fillBefore(a.content,!0,o);return l&&!Yv(i,a.content,o)?l:null}function Yv(e,t,i){for(let n=i;n<t.childCount;n++)if(!e.allowsMarks(t.child(n).marks))return!0;return!1}function ey(e){return e.spec.defining||e.spec.definingForContent}function ty(e,t,i,n){if(!n.size)return e.deleteRange(t,i);let r=e.doc.resolve(t),a=e.doc.resolve(i);if(Du(r,a,n))return e.step(new He(t,i,n));let o=Bu(r,a);o[o.length-1]==0&&o.pop();let l=-(r.depth+1);o.unshift(l);for(let d=r.depth,h=r.pos-1;d>0;d--,h--){let v=r.node(d).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;o.indexOf(d)>-1?l=d:r.before(d)==h&&o.splice(1,0,-d)}let c=o.indexOf(l),f=[],p=n.openStart;for(let d=n.content,h=0;;h++){let v=d.firstChild;if(f.push(v),h==n.openStart)break;d=v.content}for(let d=p-1;d>=0;d--){let h=f[d],v=ey(h.type);if(v&&!h.sameMarkup(r.node(Math.abs(l)-1)))p=d;else if(v||!h.type.isTextblock)break}for(let d=n.openStart;d>=0;d--){let h=(d+p+1)%(n.openStart+1),v=f[h];if(v)for(let b=0;b<o.length;b++){let y=o[(b+c)%o.length],g=!0;y<0&&(g=!1,y=-y);let x=r.node(y-1),k=r.index(y-1);if(x.canReplaceWith(k,k,v.type,v.marks))return e.replace(r.before(y),g?a.after(y):i,new ae(Lu(n.content,0,n.openStart,h),h,n.openEnd))}}let m=e.steps.length;for(let d=o.length-1;d>=0&&(e.replace(t,i,n),!(e.steps.length>m));d--){let h=o[d];h<0||(t=r.before(h),i=a.after(h))}}function Lu(e,t,i,n,r){if(t<i){let a=e.firstChild;e=e.replaceChild(0,a.copy(Lu(a.content,t+1,i,n,a)))}if(t>n){let a=r.contentMatchAt(0),o=a.fillBefore(e).append(e);e=o.append(a.matchFragment(o).fillBefore(Z.empty,!0))}return e}function iy(e,t,i,n){if(!n.isInline&&t==i&&e.doc.resolve(t).parent.content.size){let r=Jv(e.doc,t,n.type);r!=null&&(t=i=r)}e.replaceRange(t,i,new ae(Z.from(n),0,0))}function ny(e,t,i){let n=e.doc.resolve(t),r=e.doc.resolve(i);if(n.parent.isTextblock&&r.parent.isTextblock&&n.start()!=r.start()&&n.parentOffset==0&&r.parentOffset==0){let o=n.sharedDepth(i),l=!1;for(let c=n.depth;c>o;c--)n.node(c).type.spec.isolating&&(l=!0);for(let c=r.depth;c>o;c--)r.node(c).type.spec.isolating&&(l=!0);if(!l){for(let c=n.depth;c>0&&t==n.start(c);c--)t=n.before(c);for(let c=r.depth;c>0&&i==r.start(c);c--)i=r.before(c);n=e.doc.resolve(t),r=e.doc.resolve(i)}}let a=Bu(n,r);for(let o=0;o<a.length;o++){let l=a[o],c=o==a.length-1;if(c&&l==0||n.node(l).type.contentMatch.validEnd)return e.delete(n.start(l),r.end(l));if(l>0&&(c||n.node(l-1).canReplace(n.index(l-1),r.indexAfter(l-1))))return e.delete(n.before(l),r.after(l))}for(let o=1;o<=n.depth&&o<=r.depth;o++)if(t-n.start(o)==n.depth-o&&i>n.end(o)&&r.end(o)-i!=r.depth-o&&n.start(o-1)==r.start(o-1)&&n.node(o-1).canReplace(n.index(o-1),r.index(o-1)))return e.delete(n.before(o),i);e.delete(t,i)}function Bu(e,t){let i=[],n=Math.min(e.depth,t.depth);for(let r=n;r>=0;r--){let a=e.start(r);if(a<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(a==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==a-1)&&i.push(r)}return i}class ln extends at{constructor(t,i,n){super(),this.pos=t,this.attr=i,this.value=n}apply(t){let i=t.nodeAt(this.pos);if(!i)return je.fail("No node at attribute step's position");let n=Object.create(null);for(let a in i.attrs)n[a]=i.attrs[a];n[this.attr]=this.value;let r=i.type.create(n,null,i.marks);return je.fromReplace(t,this.pos,this.pos+1,new ae(Z.from(r),0,i.isLeaf?0:1))}getMap(){return xt.empty}invert(t){return new ln(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let i=t.mapResult(this.pos,1);return i.deletedAfter?null:new ln(i.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,i){if(typeof i.pos!="number"||typeof i.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ln(i.pos,i.attr,i.value)}}at.jsonID("attr",ln);class Un extends at{constructor(t,i){super(),this.attr=t,this.value=i}apply(t){let i=Object.create(null);for(let r in t.attrs)i[r]=t.attrs[r];i[this.attr]=this.value;let n=t.type.create(i,t.content,t.marks);return je.ok(n)}getMap(){return xt.empty}invert(t){return new Un(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,i){if(typeof i.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Un(i.attr,i.value)}}at.jsonID("docAttr",Un);let cn=class extends Error{};cn=function e(t){let i=Error.call(this,t);return i.__proto__=e.prototype,i};cn.prototype=Object.create(Error.prototype);cn.prototype.constructor=cn;cn.prototype.name="TransformError";class Pu{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new ea}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let i=this.maybeStep(t);if(i.failed)throw new cn(i.failed);return this}maybeStep(t){let i=t.apply(this.doc);return i.failed||this.addStep(t,i.doc),i}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,i=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(t=r.map(t,1),i=r.map(i,-1)),r.forEach((a,o,l,c)=>{t=Math.min(t,l),i=Math.max(i,c)})}return t==1e9?null:{from:t,to:i}}addStep(t,i){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=i}replace(t,i=t,n=ae.empty){let r=Fa(this.doc,t,i,n);return r&&this.step(r),this}replaceWith(t,i,n){return this.replace(t,i,new ae(Z.from(n),0,0))}delete(t,i){return this.replace(t,i,ae.empty)}insert(t,i){return this.replaceWith(t,t,i)}replaceRange(t,i,n){return ty(this,t,i,n),this}replaceRangeWith(t,i,n){return iy(this,t,i,n),this}deleteRange(t,i){return ny(this,t,i),this}lift(t,i){return Fv(this,t,i),this}join(t,i=1){return Xv(this,t,i),this}wrap(t,i){return jv(this,t,i),this}setBlockType(t,i=t,n,r=null){return qv(this,t,i,n,r),this}setNodeMarkup(t,i,n=null,r){return Wv(this,t,i,n,r),this}setNodeAttribute(t,i,n){return this.step(new ln(t,i,n)),this}setDocAttribute(t,i){return this.step(new Un(t,i)),this}addNodeMark(t,i){return this.step(new bi(t,i)),this}removeNodeMark(t,i){let n=this.doc.nodeAt(t);if(!n)throw new RangeError("No node at position "+t);if(i instanceof Re)i.isInSet(n.marks)&&this.step(new Hi(t,i));else{let r=n.marks,a,o=[];for(;a=i.isInSet(r);)o.push(new Hi(t,a)),r=a.removeFromSet(r);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(t,i=1,n){return Gv(this,t,i,n),this}addMark(t,i,n){return Bv(this,t,i,n),this}removeMark(t,i,n){return Pv(this,t,i,n),this}clearIncompatible(t,i,n){return ds(this,t,i,n),this}}const ao=Object.create(null);class ve{constructor(t,i,n){this.$anchor=t,this.$head=i,this.ranges=n||[new Vu(t.min(i),t.max(i))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let i=0;i<t.length;i++)if(t[i].$from.pos!=t[i].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,i=ae.empty){let n=i.content.lastChild,r=null;for(let l=0;l<i.openEnd;l++)r=n,n=n.lastChild;let a=t.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:c,$to:f}=o[l],p=t.mapping.slice(a);t.replaceRange(p.map(c.pos),p.map(f.pos),l?ae.empty:i),l==0&&Rl(t,a,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(t,i){let n=t.steps.length,r=this.ranges;for(let a=0;a<r.length;a++){let{$from:o,$to:l}=r[a],c=t.mapping.slice(n),f=c.map(o.pos),p=c.map(l.pos);a?t.deleteRange(f,p):(t.replaceRangeWith(f,p,i),Rl(t,n,i.isInline?-1:1))}}static findFrom(t,i,n=!1){let r=t.parent.inlineContent?new he(t):nn(t.node(0),t.parent,t.pos,t.index(),i,n);if(r)return r;for(let a=t.depth-1;a>=0;a--){let o=i<0?nn(t.node(0),t.node(a),t.before(a+1),t.index(a),i,n):nn(t.node(0),t.node(a),t.after(a+1),t.index(a)+1,i,n);if(o)return o}return null}static near(t,i=1){return this.findFrom(t,i)||this.findFrom(t,-i)||new wt(t.node(0))}static atStart(t){return nn(t,t,0,0,1)||new wt(t)}static atEnd(t){return nn(t,t,t.content.size,t.childCount,-1)||new wt(t)}static fromJSON(t,i){if(!i||!i.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=ao[i.type];if(!n)throw new RangeError(`No selection type ${i.type} defined`);return n.fromJSON(t,i)}static jsonID(t,i){if(t in ao)throw new RangeError("Duplicate use of selection JSON ID "+t);return ao[t]=i,i.prototype.jsonID=t,i}getBookmark(){return he.between(this.$anchor,this.$head).getBookmark()}}ve.prototype.visible=!0;class Vu{constructor(t,i){this.$from=t,this.$to=i}}let Il=!1;function Dl(e){!Il&&!e.parent.inlineContent&&(Il=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class he extends ve{constructor(t,i=t){Dl(t),Dl(i),super(t,i)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,i){let n=t.resolve(i.map(this.head));if(!n.parent.inlineContent)return ve.near(n);let r=t.resolve(i.map(this.anchor));return new he(r.parent.inlineContent?r:n,n)}replace(t,i=ae.empty){if(super.replace(t,i),i==ae.empty){let n=this.$from.marksAcross(this.$to);n&&t.ensureMarks(n)}}eq(t){return t instanceof he&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Ua(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,i){if(typeof i.anchor!="number"||typeof i.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new he(t.resolve(i.anchor),t.resolve(i.head))}static create(t,i,n=i){let r=t.resolve(i);return new this(r,n==i?r:t.resolve(n))}static between(t,i,n){let r=t.pos-i.pos;if((!n||r)&&(n=r>=0?1:-1),!i.parent.inlineContent){let a=ve.findFrom(i,n,!0)||ve.findFrom(i,-n,!0);if(a)i=a.$head;else return ve.near(i,n)}return t.parent.inlineContent||(r==0?t=i:(t=(ve.findFrom(t,-n,!0)||ve.findFrom(t,n,!0)).$anchor,t.pos<i.pos!=r<0&&(t=i))),new he(t,i)}}ve.jsonID("text",he);class Ua{constructor(t,i){this.anchor=t,this.head=i}map(t){return new Ua(t.map(this.anchor),t.map(this.head))}resolve(t){return he.between(t.resolve(this.anchor),t.resolve(this.head))}}class de extends ve{constructor(t){let i=t.nodeAfter,n=t.node(0).resolve(t.pos+i.nodeSize);super(t,n),this.node=i}map(t,i){let{deleted:n,pos:r}=i.mapResult(this.anchor),a=t.resolve(r);return n?ve.near(a):new de(a)}content(){return new ae(Z.from(this.node),0,0)}eq(t){return t instanceof de&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new hs(this.anchor)}static fromJSON(t,i){if(typeof i.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new de(t.resolve(i.anchor))}static create(t,i){return new de(t.resolve(i))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}de.prototype.visible=!1;ve.jsonID("node",de);class hs{constructor(t){this.anchor=t}map(t){let{deleted:i,pos:n}=t.mapResult(this.anchor);return i?new Ua(n,n):new hs(n)}resolve(t){let i=t.resolve(this.anchor),n=i.nodeAfter;return n&&de.isSelectable(n)?new de(i):ve.near(i)}}class wt extends ve{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,i=ae.empty){if(i==ae.empty){t.delete(0,t.doc.content.size);let n=ve.atStart(t.doc);n.eq(t.selection)||t.setSelection(n)}else super.replace(t,i)}toJSON(){return{type:"all"}}static fromJSON(t){return new wt(t)}map(t){return new wt(t)}eq(t){return t instanceof wt}getBookmark(){return ry}}ve.jsonID("all",wt);const ry={map(){return this},resolve(e){return new wt(e)}};function nn(e,t,i,n,r,a=!1){if(t.inlineContent)return he.create(e,i);for(let o=n-(r>0?0:1);r>0?o<t.childCount:o>=0;o+=r){let l=t.child(o);if(l.isAtom){if(!a&&de.isSelectable(l))return de.create(e,i-(r<0?l.nodeSize:0))}else{let c=nn(e,l,i+r,r<0?l.childCount:0,r,a);if(c)return c}i+=l.nodeSize*r}return null}function Rl(e,t,i){let n=e.steps.length-1;if(n<t)return;let r=e.steps[n];if(!(r instanceof He||r instanceof Ge))return;let a=e.mapping.maps[n],o;a.forEach((l,c,f,p)=>{o==null&&(o=p)}),e.setSelection(ve.near(e.doc.resolve(o),i))}function Ll(e,t){return!t||!e?e:e.bind(t)}class Sr{constructor(t,i,n){this.name=t,this.init=Ll(i.init,n),this.apply=Ll(i.apply,n)}}new Sr("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Sr("selection",{init(e,t){return e.selection||ve.atStart(t.doc)},apply(e){return e.selection}}),new Sr("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,i,n){return n.selection.$cursor?e.storedMarks:null}}),new Sr("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}});function Fu(e,t,i){for(let n in e){let r=e[n];r instanceof Function?r=r.bind(t):n=="handleDOMEvents"&&(r=Fu(r,t,{})),i[n]=r}return i}class ft{constructor(t){this.spec=t,this.props={},t.props&&Fu(t.props,this,this.props),this.key=t.key?t.key.key:Uu("plugin")}getState(t){return t[this.key]}}const oo=Object.create(null);function Uu(e){return e in oo?e+"$"+ ++oo[e]:(oo[e]=0,e+"$")}class ot{constructor(t="key"){this.key=Uu(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const $i=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Hu=function(e,t,i,n){return i&&(Bl(e,t,i,n,-1)||Bl(e,t,i,n,1))},ay=/^(img|br|input|textarea|hr)$/i;function Bl(e,t,i,n,r){for(var a;;){if(e==i&&t==n)return!0;if(t==(r<0?0:ta(e))){let o=e.parentNode;if(!o||o.nodeType!=1||bs(e)||ay.test(e.nodeName)||e.contentEditable=="false")return!1;t=$i(e)+(r<0?0:1),e=o}else if(e.nodeType==1){let o=e.childNodes[t+(r<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((a=o.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)t+=r;else return!1;else e=o,t=r<0?ta(e):0}else return!1}}function ta(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function oy(e,t,i){for(let n=t==0,r=t==ta(e);n||r;){if(e==i)return!0;let a=$i(e);if(e=e.parentNode,!e)return!1;n=n&&a==0,r=r&&a==ta(e)}}function bs(e){let t;for(let i=e;i&&!(t=i.pmViewDesc);i=i.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const ju=function(e){return e.focusNode&&Hu(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function qu(e,t){let i=document.createEvent("Event");return i.initEvent("keydown",!0,!0),i.keyCode=e,i.key=i.code=t,i}const Ft=typeof navigator<"u"?navigator:null,Pl=typeof document<"u"?document:null,wi=Ft&&Ft.userAgent||"",Lo=/Edge\/(\d+)/.exec(wi),$u=/MSIE \d/.exec(wi),Bo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(wi),Xn=!!($u||Bo||Lo),Wu=$u?document.documentMode:Bo?+Bo[1]:Lo?+Lo[1]:0,Ha=!Xn&&/gecko\/(\d+)/i.test(wi);Ha&&+(/Firefox\/(\d+)/.exec(wi)||[0,0])[1];const Po=!Xn&&/Chrome\/(\d+)/.exec(wi),ni=!!Po,Gu=Po?+Po[1]:0,Wi=!Xn&&!!Ft&&/Apple Computer/.test(Ft.vendor),gs=Wi&&(/Mobile\/\w+/.test(wi)||!!Ft&&Ft.maxTouchPoints>2),Nt=gs||(Ft?/Mac/.test(Ft.platform):!1),Ku=Ft?/Win/.test(Ft.platform):!1,Jn=/Android \d/.test(wi),vs=!!Pl&&"webkitFontSmoothing"in Pl.documentElement.style,sy=vs?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ly(e,t=null){let i=e.domSelectionRange(),n=e.state.doc;if(!i.focusNode)return null;let r=e.docView.nearestDesc(i.focusNode),a=r&&r.size==0,o=e.docView.posFromDOM(i.focusNode,i.focusOffset,1);if(o<0)return null;let l=n.resolve(o),c,f;if(ju(i)){for(c=o;r&&!r.node;)r=r.parent;let m=r.node;if(r&&m.isAtom&&de.isSelectable(m)&&r.parent&&!(m.isInline&&oy(i.focusNode,i.focusOffset,r.dom))){let d=r.posBefore;f=new de(o==d?l:n.resolve(d))}}else{if(i instanceof e.dom.ownerDocument.defaultView.Selection&&i.rangeCount>1){let m=o,d=o;for(let h=0;h<i.rangeCount;h++){let v=i.getRangeAt(h);m=Math.min(m,e.docView.posFromDOM(v.startContainer,v.startOffset,1)),d=Math.max(d,e.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(m<0)return null;[c,o]=d==e.state.selection.anchor?[d,m]:[m,d],l=n.resolve(o)}else c=e.docView.posFromDOM(i.anchorNode,i.anchorOffset,1);if(c<0)return null}let p=n.resolve(c);if(!f){let m=t=="pointer"||e.state.selection.head<l.pos&&!a?1:-1;f=Ju(e,p,l,m)}return f}function Xu(e){return e.editable?e.hasFocus():py(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function ys(e,t=!1){let i=e.state.selection;if(fy(e,i),!Xu(e))return;let n=e.input.mouseDown;if(!t&&ni&&n){let r=e.domSelectionRange(),a=e.domObserver.currentSelection;if(r.anchorNode&&a.anchorNode&&Hu(r.anchorNode,r.anchorOffset,a.anchorNode,a.anchorOffset)&&n.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)uy(e);else{let{anchor:r,head:a}=i,o,l;Vl&&!(i instanceof he)&&(i.$from.parent.inlineContent||(o=Fl(e,i.from)),!i.empty&&!i.$from.parent.inlineContent&&(l=Fl(e,i.to))),e.docView.setSelection(r,a,e,t),Vl&&(o&&Ul(o),l&&Ul(l)),i.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&cy(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}const Vl=Wi||ni&&Gu<63;function Fl(e,t){let{node:i,offset:n}=e.docView.domFromPos(t,0),r=n<i.childNodes.length?i.childNodes[n]:null,a=n?i.childNodes[n-1]:null;if(Wi&&r&&r.contentEditable=="false")return so(r);if((!r||r.contentEditable=="false")&&(!a||a.contentEditable=="false")){if(r)return so(r);if(a)return so(a)}}function so(e){return e.contentEditable="true",Wi&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Ul(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function cy(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let i=e.domSelectionRange(),n=i.anchorNode,r=i.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(i.anchorNode!=n||i.anchorOffset!=r)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!Xu(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function uy(e){let t=e.domSelection();if(!t)return;let i=e.cursorWrapper.dom,n=i.nodeName=="IMG";n?t.collapse(i.parentNode,$i(i)+1):t.collapse(i,0),!n&&!e.state.selection.visible&&Xn&&Wu<=11&&(i.disabled=!0,i.disabled=!1)}function fy(e,t){if(t instanceof de){let i=e.docView.descAt(t.from);i!=e.lastSelectedViewDesc&&(Hl(e),i&&i.selectNode(),e.lastSelectedViewDesc=i)}else Hl(e)}function Hl(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Ju(e,t,i,n){return e.someProp("createSelectionBetween",r=>r(e,t,i))||he.between(t,i,n)}function py(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function Vo(e,t){let{$anchor:i,$head:n}=e.selection,r=t>0?i.max(n):i.min(n),a=r.parent.inlineContent?r.depth?e.doc.resolve(t>0?r.after():r.before()):null:r;return a&&ve.findFrom(a,t)}function pi(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function jl(e,t,i){let n=e.state.selection;if(n instanceof he)if(i.indexOf("s")>-1){let{$head:r}=n,a=r.textOffset?null:t<0?r.nodeBefore:r.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let o=e.state.doc.resolve(r.pos+a.nodeSize*(t<0?-1:1));return pi(e,new he(n.$anchor,o))}else if(n.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let r=Vo(e.state,t);return r&&r instanceof de?pi(e,r):!1}else if(!(Nt&&i.indexOf("m")>-1)){let r=n.$head,a=r.textOffset?null:t<0?r.nodeBefore:r.nodeAfter,o;if(!a||a.isText)return!1;let l=t<0?r.pos-a.nodeSize:r.pos;return a.isAtom||(o=e.docView.descAt(l))&&!o.contentDOM?de.isSelectable(a)?pi(e,new de(t<0?e.state.doc.resolve(r.pos-a.nodeSize):r)):vs?pi(e,new he(e.state.doc.resolve(t<0?l:l+a.nodeSize))):!1:!1}}else return!1;else{if(n instanceof de&&n.node.isInline)return pi(e,new he(t>0?n.$to:n.$from));{let r=Vo(e.state,t);return r?pi(e,r):!1}}}function ia(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Mn(e,t){let i=e.pmViewDesc;return i&&i.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function Yi(e,t){return t<0?dy(e):my(e)}function dy(e){let t=e.domSelectionRange(),i=t.focusNode,n=t.focusOffset;if(!i)return;let r,a,o=!1;for(Ha&&i.nodeType==1&&n<ia(i)&&Mn(i.childNodes[n],-1)&&(o=!0);;)if(n>0){if(i.nodeType!=1)break;{let l=i.childNodes[n-1];if(Mn(l,-1))r=i,a=--n;else if(l.nodeType==3)i=l,n=i.nodeValue.length;else break}}else{if(Zu(i))break;{let l=i.previousSibling;for(;l&&Mn(l,-1);)r=i.parentNode,a=$i(l),l=l.previousSibling;if(l)i=l,n=ia(i);else{if(i=i.parentNode,i==e.dom)break;n=0}}}o?Fo(e,i,n):r&&Fo(e,r,a)}function my(e){let t=e.domSelectionRange(),i=t.focusNode,n=t.focusOffset;if(!i)return;let r=ia(i),a,o;for(;;)if(n<r){if(i.nodeType!=1)break;let l=i.childNodes[n];if(Mn(l,1))a=i,o=++n;else break}else{if(Zu(i))break;{let l=i.nextSibling;for(;l&&Mn(l,1);)a=l.parentNode,o=$i(l)+1,l=l.nextSibling;if(l)i=l,n=0,r=ia(i);else{if(i=i.parentNode,i==e.dom)break;n=r=0}}}a&&Fo(e,a,o)}function Zu(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function hy(e,t){for(;e&&t==e.childNodes.length&&!bs(e);)t=$i(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let i=e.childNodes[t];if(i.nodeType==3)return i;if(i.nodeType==1&&i.contentEditable=="false")break;e=i,t=0}}function by(e,t){for(;e&&!t&&!bs(e);)t=$i(e),e=e.parentNode;for(;e&&t;){let i=e.childNodes[t-1];if(i.nodeType==3)return i;if(i.nodeType==1&&i.contentEditable=="false")break;e=i,t=e.childNodes.length}}function Fo(e,t,i){if(t.nodeType!=3){let a,o;(o=hy(t,i))?(t=o,i=0):(a=by(t,i))&&(t=a,i=a.nodeValue.length)}let n=e.domSelection();if(!n)return;if(ju(n)){let a=document.createRange();a.setEnd(t,i),a.setStart(t,i),n.removeAllRanges(),n.addRange(a)}else n.extend&&n.extend(t,i);e.domObserver.setCurSelection();let{state:r}=e;setTimeout(()=>{e.state==r&&ys(e)},50)}function ql(e,t){let i=e.state.doc.resolve(t);if(!(ni||Ku)&&i.parent.inlineContent){let r=e.coordsAtPos(t);if(t>i.start()){let a=e.coordsAtPos(t-1),o=(a.top+a.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(a.left-r.left)>1)return a.left<r.left?"ltr":"rtl"}if(t<i.end()){let a=e.coordsAtPos(t+1),o=(a.top+a.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(a.left-r.left)>1)return a.left>r.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function $l(e,t,i){let n=e.state.selection;if(n instanceof he&&!n.empty||i.indexOf("s")>-1||Nt&&i.indexOf("m")>-1)return!1;let{$from:r,$to:a}=n;if(!r.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let o=Vo(e.state,t);if(o&&o instanceof de)return pi(e,o)}if(!r.parent.inlineContent){let o=t<0?r:a,l=n instanceof wt?ve.near(o,t):ve.findFrom(o,t);return l?pi(e,l):!1}return!1}function Wl(e,t){if(!(e.state.selection instanceof he))return!0;let{$head:i,$anchor:n,empty:r}=e.state.selection;if(!i.sameParent(n))return!0;if(!r)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let a=!i.textOffset&&(t<0?i.nodeBefore:i.nodeAfter);if(a&&!a.isText){let o=e.state.tr;return t<0?o.delete(i.pos-a.nodeSize,i.pos):o.delete(i.pos,i.pos+a.nodeSize),e.dispatch(o),!0}return!1}function Gl(e,t,i){e.domObserver.stop(),t.contentEditable=i,e.domObserver.start()}function gy(e){if(!Wi||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:i}=e.domSelectionRange();if(t&&t.nodeType==1&&i==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let n=t.firstChild;Gl(e,n,"true"),setTimeout(()=>Gl(e,n,"false"),20)}return!1}function vy(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function yy(e,t){let i=t.keyCode,n=vy(t);if(i==8||Nt&&i==72&&n=="c")return Wl(e,-1)||Yi(e,-1);if(i==46&&!t.shiftKey||Nt&&i==68&&n=="c")return Wl(e,1)||Yi(e,1);if(i==13||i==27)return!0;if(i==37||Nt&&i==66&&n=="c"){let r=i==37?ql(e,e.state.selection.from)=="ltr"?-1:1:-1;return jl(e,r,n)||Yi(e,r)}else if(i==39||Nt&&i==70&&n=="c"){let r=i==39?ql(e,e.state.selection.from)=="ltr"?1:-1:1;return jl(e,r,n)||Yi(e,r)}else{if(i==38||Nt&&i==80&&n=="c")return $l(e,-1,n)||Yi(e,-1);if(i==40||Nt&&i==78&&n=="c")return gy(e)||$l(e,1,n)||Yi(e,1);if(n==(Nt?"m":"c")&&(i==66||i==73||i==89||i==90))return!0}return!1}function Qu(e,t){e.someProp("transformCopied",h=>{t=h(t,e)});let i=[],{content:n,openStart:r,openEnd:a}=t;for(;r>1&&a>1&&n.childCount==1&&n.firstChild.childCount==1;){r--,a--;let h=n.firstChild;i.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),n=h.content}let o=e.someProp("clipboardSerializer")||Kn.fromSchema(e.state.schema),l=af(),c=l.createElement("div");c.appendChild(o.serializeFragment(n,{document:l}));let f=c.firstChild,p,m=0;for(;f&&f.nodeType==1&&(p=rf[f.nodeName.toLowerCase()]);){for(let h=p.length-1;h>=0;h--){let v=l.createElement(p[h]);for(;c.firstChild;)v.appendChild(c.firstChild);c.appendChild(v),m++}f=c.firstChild}f&&f.nodeType==1&&f.setAttribute("data-pm-slice",`${r} ${a}${m?` -${m}`:""} ${JSON.stringify(i)}`);let d=e.someProp("clipboardTextSerializer",h=>h(t,e))||t.content.textBetween(0,t.content.size,`
494
+ [1] === incrementDisambig() ===`),this.initGivens)return this.initGivens=!1,!1;var e=!1,t=!0;if(this.modes[this.modeindex]==="disNames"){t=!1,typeof this.givensMax!="number"&&(t=!0);var i=!1;typeof this.namesMax!="number"&&(i=!0),typeof this.givensMax=="number"&&(this.base.givens.length&&this.base.givens[this.gnameset][this.gname]<this.givensMax?this.base.givens[this.gnameset][this.gname]+=1:t=!0),typeof this.namesMax=="number"&&t&&(this.state.opt["disambiguate-add-names"]?(i=!1,this.gname<this.namesMax?(this.base.names[this.gnameset]+=1,this.gname+=1):i=!0):i=!0),typeof this.namesetsMax=="number"&&i&&this.gnameset<this.namesetsMax&&(this.gnameset+=1,this.base.names[this.gnameset]=1,this.gname=0),this.debug&&(this.state.sys.print(" ------------------"),this.state.sys.print(" incremented values"),this.state.sys.print(" ------------------"),this.state.sys.print(" | gnameset: "+this.gnameset),this.state.sys.print(" | gname: "+this.gname),this.state.sys.print(" | names value: "+this.base.names[this.gnameset]),this.base.givens.length?this.state.sys.print(" | givens value: "+this.base.givens[this.gnameset][this.gname]):this.state.sys.print(" | givens value: nil"),this.state.sys.print(" | namesetsMax: "+this.namesetsMax),this.state.sys.print(" | namesMax: "+this.namesMax),this.state.sys.print(" | givensMax: "+this.givensMax)),(typeof this.namesetsMax!="number"||this.namesetsMax===-1||this.gnameset===this.namesetsMax)&&(!this.state.opt["disambiguate-add-names"]||typeof this.namesMax!="number"||this.gname===this.namesMax)&&(typeof this.givensMax!="number"||typeof this.base.givens[this.gnameset]>"u"||typeof this.base.givens[this.gnameset][this.gname]>"u"||this.base.givens[this.gnameset][this.gname]===this.givensMax)&&(e=!0,this.debug&&this.state.sys.print(" MAXED"))}else this.modes[this.modeindex]==="disExtraText"&&(this.base.disambiguate+=1,this.betterbase.disambiguate+=1);return e};u.Disambiguation.prototype.initVars=function(e){var a,o,t,i,n;if(this.debug&&this.state.sys.print("[B] === initVars() ==="),this.lists=[],this.base=!1,this.betterbase=!1,this.akey=e,this.maxNamesByItemId={},i=[],t=this.ambigcites[e],!t||!t.length)return!1;var r=this.state.refetchItem(""+t[0]);if(this.getCiteData(r),this.base=u.getAmbigConfig.call(this.state),t&&t.length>1){i.push([this.maxNamesByItemId[r.id],r]);for(var a=1,o=t.length;a<o;a+=1)r=this.state.refetchItem(""+t[a]),this.getCiteData(r,this.base),i.push([this.maxNamesByItemId[r.id],r]);i.sort(function(l,c){return l[0]>c[0]?1:l[0]<c[0]?-1:l[1].id>c[1].id?1:l[1].id<c[1].id?-1:0}),n=[];for(var a=0,o=i.length;a<o;a+=1)n.push(i[a][1]);this.lists.push([this.base,n]),this.Item=this.lists[0][1][0]}else this.Item=this.state.refetchItem(""+t[0]);this.modeindex=0;var a,o;return this.state.citation.opt["disambiguate-add-names"],this.namesMax=this.maxNamesByItemId[this.Item.id][0],this.padBase(this.base),this.padBase(this.betterbase),this.base.year_suffix=!1,this.base.disambiguate=!1,this.betterbase.year_suffix=!1,this.betterbase.disambiguate=!1,this.state.citation.opt["givenname-disambiguation-rule"]==="by-cite"&&this.state.opt["disambiguate-add-givenname"]&&(this.givensMax=2),!0};u.Disambiguation.prototype.padBase=function(e){for(var t=0,i=e.names.length;t<i;t+=1){e.givens[t]||(e.givens[t]=[]);for(var n=0,r=e.names[t];n<r;n+=1)e.givens[t][n]||(e.givens[t][n]=0)}};u.Disambiguation.prototype.configModes=function(){var e,t;this.modes=[],e=this.state.opt["disambiguate-add-givenname"],t=this.state.citation.opt["givenname-disambiguation-rule"],(this.state.opt["disambiguate-add-names"]||e&&t==="by-cite")&&this.modes.push("disNames"),this.state.opt.development_extensions.prioritize_disambiguate_condition?(this.state.opt.has_disambiguate&&this.modes.push("disExtraText"),this.state.opt["disambiguate-add-year-suffix"]&&this.modes.push("disYears")):(this.state.opt["disambiguate-add-year-suffix"]&&this.modes.push("disYears"),this.state.opt.has_disambiguate&&this.modes.push("disExtraText"))};u.Disambiguation.prototype.getCiteData=function(e,t){if(!this.maxNamesByItemId[e.id]){u.getAmbiguousCite.call(this.state,e,t),t=u.getAmbigConfig.call(this.state),this.maxNamesByItemId[e.id]=u.getMaxVals.call(this.state),this.state.registry.registry[e.id].disambig.givens=this.state.tmp.disambig_settings.givens.slice();for(var i=0,n=this.state.registry.registry[e.id].disambig.givens.length;i<n;i+=1)this.state.registry.registry[e.id].disambig.givens[i]=this.state.tmp.disambig_settings.givens[i].slice();this.namesetsMax=this.state.registry.registry[e.id].disambig.names.length-1,this.base||(this.base=t,this.betterbase=u.cloneAmbigConfig(t)),t.names.length<this.base.names.length&&(this.base=t);for(var i=0,n=t.names.length;i<n;i+=1)t.names[i]>this.base.names[i]&&(this.base.givens[i]=t.givens[i].slice(),this.base.names[i]=t.names[i],this.betterbase.names=this.base.names.slice(),this.betterbase.givens=this.base.givens.slice(),this.padBase(this.base),this.padBase(this.betterbase));this.betterbase.givens=this.base.givens.slice();for(var r=0,a=this.base.givens.length;r<a;r+=1)this.betterbase.givens[r]=this.base.givens[r].slice()}};u.Disambiguation.prototype.captureStepToBase=function(){this.state.citation.opt["givenname-disambiguation-rule"]==="by-cite"&&this.base.givens&&this.base.givens.length&&typeof this.base.givens[this.gnameset][this.gname]<"u"&&(this.betterbase.givens.length<this.base.givens.length&&(this.betterbase.givens=JSON.parse(JSON.stringify(this.base.givens))),this.betterbase.givens[this.gnameset][this.gname]=this.base.givens[this.gnameset][this.gname]),this.betterbase.names[this.gnameset]=this.base.names[this.gnameset]};u.Engine.prototype.getJurisdictionList=function(e){for(var t=[],i=e.split(":"),n=i.length;n>0;n--){var r=i.slice(0,n).join(":");if(t.push(r),this.opt.jurisdiction_fallbacks[r]){var a=this.opt.jurisdiction_fallbacks[r];t.push(a)}}return t.indexOf("us")===-1&&t.push("us"),t};u.Engine.prototype.loadStyleModule=function(e,t,i){var n=null;this.juris[e]={};var r=u.setupXml(t);r.addMissingNameNodes(r.dataObj),r.addInstitutionNodes(r.dataObj),r.insertPublisherAndPlace(r.dataObj),r.flagDateMacros(r.dataObj);for(var m=r.getNodesByName(r.dataObj,"law-module"),a=0,o=m.length;a<o;a++){var l=r.getAttributeValue(m[a],"types");if(l){this.juris[e].types={},l=l.split(/\s+/);for(var c=0,f=l.length;c<f;c++)this.juris[e].types[l[c]]=!0}i||(n=r.getAttributeValue(m[a],"fallback"),n&&e!=="us"&&(this.opt.jurisdiction_fallbacks[e]=n))}var p=this.opt.lang?this.opt.lang:this.opt["default-locale"][0];u.SET_COURT_CLASSES(this,p,r,r.dataObj),this.juris[e].types||(this.juris[e].types=u.MODULE_TYPES);for(var m=r.getNodesByName(r.dataObj,"macro"),a=0,o=m.length;a<o;a++){var d=r.getAttributeValue(m[a],"name");if(!u.MODULE_MACROS[d]){u.debug('CSL: skipping non-modular macro name "'+d+'" in module context');continue}this.juris[e][d]=[],this.buildTokenLists(m[a],this.juris[e][d]),this.configureTokenList(this.juris[e][d])}return n};u.Engine.prototype.retrieveAllStyleModules=function(e){var t={},i=this.locale[this.opt.lang].opts["jurisdiction-preference"];i=i||[],i=[""].concat(i);for(var n=i.length-1;n>-1;n--)for(var r=i[n],a=0,o=e.length;a<o;a++){var l=e[a];if(!this.opt.jurisdictions_seen[l]){var c=this.sys.retrieveStyleModule(l,r);(!c&&!r||c)&&(this.opt.jurisdictions_seen[l]=!0),c&&(t[l]=c)}}return t};u.ParticleList=function(){var e=[[[0,1],null]],t=[[[0,3],null]],i=[[null,[0,1]]],n=[[null,[0,2]]],r=[[null,[0,3]]],a=[[null,[0,1]],[[0,1],null]],o=[[null,[0,2]],[[0,2],null]],l=[[[0,1],null],[null,[0,1]]],c=[[[0,2],null],[null,[0,2]]],f=[[[0,3],null],[null,[0,3]]],p=[[null,[0,2]],[[0,1],[1,2]]],m=[["'s",i],["'s-",i],["'t",i],["a",i],["aan 't",n],["aan de",n],["aan den",n],["aan der",n],["aan het",n],["aan t",n],["aan",i],["ad-",a],["adh-",a],["af",a],["al",a],["al-",a],["am de",n],["am",i],["an-",a],["ar-",a],["as-",a],["ash-",a],["at-",a],["ath-",a],["auf dem",c],["auf den",c],["auf der",c],["auf ter",n],["auf",l],["aus 'm",c],["aus dem",c],["aus den",c],["aus der",c],["aus m",c],["aus",l],["aus'm",c],["az-",a],["aš-",a],["aḍ-",a],["aḏ-",a],["aṣ-",a],["aṭ-",a],["aṯ-",a],["aẓ-",a],["ben",i],["bij 't",n],["bij de",n],["bij den",n],["bij het",n],["bij t",n],["bij",i],["bin",i],["boven d",n],["boven d'",n],["d",i],["d'",a],["da",a],["dal",i],["dal'",i],["dall'",i],["dalla",i],["das",a],["de die le",r],["de die",n],["de l",n],["de l'",n],["de la",p],["de las",p],["de le",n],["de li",o],["de van der",r],["de",a],["de'",a],["deca",i],["degli",a],["dei",a],["del",a],["dela",e],["dell'",a],["della",a],["delle",a],["dello",a],["den",a],["der",a],["des",a],["di",a],["die le",n],["do",i],["don",i],["dos",a],["du",a],["ed-",a],["edh-",a],["el",a],["el-",a],["en-",a],["er-",a],["es-",a],["esh-",a],["et-",a],["eth-",a],["ez-",a],["eš-",a],["eḍ-",a],["eḏ-",a],["eṣ-",a],["eṭ-",a],["eṯ-",a],["eẓ-",a],["het",i],["i",i],["il",e],["im",i],["in 't",n],["in de",n],["in den",n],["in der",o],["in het",n],["in t",n],["in",i],["l",i],["l'",i],["la",i],["las",i],["le",i],["les",a],["lo",a],["los",i],["lou",i],["of",i],["onder 't",n],["onder de",n],["onder den",n],["onder het",n],["onder t",n],["onder",i],["op 't",n],["op de",o],["op den",n],["op der",n],["op gen",n],["op het",n],["op t",n],["op ten",n],["op",i],["over 't",n],["over de",n],["over den",n],["over het",n],["over t",n],["over",i],["s",i],["s'",i],["sen",e],["t",i],["te",i],["ten",i],["ter",i],["tho",i],["thoe",i],["thor",i],["to",i],["toe",i],["tot",i],["uijt 't",n],["uijt de",n],["uijt den",n],["uijt te de",r],["uijt ten",n],["uijt",i],["uit 't",n],["uit de",n],["uit den",n],["uit het",n],["uit t",n],["uit te de",r],["uit ten",n],["uit",i],["unter",i],["v",i],["v.",i],["v.d.",i],["van 't",n],["van de l",r],["van de l'",r],["van de",n],["van de",n],["van den",n],["van der",n],["van gen",n],["van het",n],["van la",n],["van t",n],["van ter",n],["van van de",r],["van",a],["vander",i],["vd",i],["ver",i],["vom und zum",t],["vom",a],["von 't",n],["von dem",c],["von den",c],["von der",c],["von t",n],["von und zu",f],["von zu",c],["von",l],["voor 't",n],["voor de",n],["voor den",n],["voor in 't",r],["voor in t",r],["voor",i],["vor der",c],["vor",l],["z",e],["ze",e],["zu",l],["zum",a],["zur",a]];return m}();u.parseParticles=function(){function e(n,r,a){var o=n;n=n;var l=[],c,f;r?(n=n.split("").reverse().join(""),c=u.PARTICLE_GIVEN_REGEXP):c=u.PARTICLE_FAMILY_REGEXP;for(var p=n.match(c);p;){var m=r?p[1].split("").reverse().join(""):p[1],d=p?m:!1,d=d?m.replace(/^[-\'\u02bb\u2019\s]*(.).*$/,"$1"):!1;if(f=d?d.toUpperCase()!==d:!1,!f)break;r?(l.push(o.slice(m.length*-1)),o=o.slice(0,m.length*-1)):(l.push(o.slice(0,m.length)),o=o.slice(m.length)),n=p[2],p=n.match(c)}if(r){n=n.split("").reverse().join(""),l.reverse();for(var h=1,v=l.length;h<v;h++)l[h].slice(0,1)==" "&&(l[h-1]+=" ");for(var h=0,v=l.length;h<v;h++)l[h].slice(0,1)==" "&&(l[h]=l[h].slice(1));n=o.slice(0,n.length)}else n=o.slice(n.length*-1);return[f,n,l]}function t(n){var r=n.slice(-1);return n=n.trim(),r===" "&&["'","’"].indexOf(n.slice(-1))>-1&&(n+=" "),n}function i(n){if(!n.suffix&&n.given){var r=n.given.match(/(\s*,!*\s*)/);if(r){var a=n.given.indexOf(r[1]),o=n.given.slice(a+r[1].length),l=n.given.slice(a,a+r[1].length).replace(/\s*/g,"");o.replace(/\./g,"")==="et al"&&!n["dropping-particle"]?(n["dropping-particle"]=o,n["comma-dropping-particle"]=","):(l.length===2&&(n["comma-suffix"]=!0),n.suffix=o),n.given=n.given.slice(0,a)}}}return function(n){var l=e(n.family),r=l[1],a=l[2];n.family=r;var o=t(a.join(""));o&&(n["non-dropping-particle"]=o),i(n);var l=e(n.given,!0),c=l[1],f=l[2];n.given=c;var p=f.join("").trim();p&&(n["dropping-particle"]=p)}}();var Iv=u;const Dv=zv(Iv),Eu=65535,Nu=Math.pow(2,16);function Rv(e,t){return e+t*Nu}function Ml(e){return e&Eu}function Lv(e){return(e-(e&Eu))/Nu}const Au=1,Ou=2,Vr=4,Tu=8;class Do{constructor(t,i,n){this.pos=t,this.delInfo=i,this.recover=n}get deleted(){return(this.delInfo&Tu)>0}get deletedBefore(){return(this.delInfo&(Au|Vr))>0}get deletedAfter(){return(this.delInfo&(Ou|Vr))>0}get deletedAcross(){return(this.delInfo&Vr)>0}}class xt{constructor(t,i=!1){if(this.ranges=t,this.inverted=i,!t.length&&xt.empty)return xt.empty}recover(t){let i=0,n=Ml(t);if(!this.inverted)for(let r=0;r<n;r++)i+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[n*3]+i+Lv(t)}mapResult(t,i=1){return this._map(t,i,!1)}map(t,i=1){return this._map(t,i,!0)}_map(t,i,n){let r=0,a=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>t)break;let f=this.ranges[l+a],p=this.ranges[l+o],m=c+f;if(t<=m){let d=f?t==c?-1:t==m?1:i:i,h=c+r+(d<0?0:p);if(n)return h;let v=t==(i<0?c:m)?null:Rv(l/3,t-c),b=t==c?Ou:t==m?Au:Vr;return(i<0?t!=c:t!=m)&&(b|=Tu),new Do(h,b,v)}r+=p-f}return n?t+r:new Do(t+r,0,null)}touches(t,i){let n=0,r=Ml(i),a=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?n:0);if(c>t)break;let f=this.ranges[l+a],p=c+f;if(t<=p&&l==r*3)return!0;n+=this.ranges[l+o]-f}return!1}forEach(t){let i=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,a=0;r<this.ranges.length;r+=3){let o=this.ranges[r],l=o-(this.inverted?a:0),c=o+(this.inverted?0:a),f=this.ranges[r+i],p=this.ranges[r+n];t(l,l+f,c,c+p),a+=p-f}}invert(){return new xt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?xt.empty:new xt(t<0?[0,-t,0]:[0,0,t])}}xt.empty=new xt([]);class ea{constructor(t,i,n=0,r=t?t.length:0){this.mirror=i,this.from=n,this.to=r,this._maps=t||[],this.ownData=!(t||i)}get maps(){return this._maps}slice(t=0,i=this.maps.length){return new ea(this._maps,this.mirror,t,i)}appendMap(t,i){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),i!=null&&this.setMirror(this._maps.length-1,i)}appendMapping(t){for(let i=0,n=this._maps.length;i<t._maps.length;i++){let r=t.getMirror(i);this.appendMap(t._maps[i],r!=null&&r<i?n+r:void 0)}}getMirror(t){if(this.mirror){for(let i=0;i<this.mirror.length;i++)if(this.mirror[i]==t)return this.mirror[i+(i%2?-1:1)]}}setMirror(t,i){this.mirror||(this.mirror=[]),this.mirror.push(t,i)}appendMappingInverted(t){for(let i=t.maps.length-1,n=this._maps.length+t._maps.length;i>=0;i--){let r=t.getMirror(i);this.appendMap(t._maps[i].invert(),r!=null&&r>i?n-r-1:void 0)}}invert(){let t=new ea;return t.appendMappingInverted(this),t}map(t,i=1){if(this.mirror)return this._map(t,i,!0);for(let n=this.from;n<this.to;n++)t=this._maps[n].map(t,i);return t}mapResult(t,i=1){return this._map(t,i,!1)}_map(t,i,n){let r=0;for(let a=this.from;a<this.to;a++){let o=this._maps[a],l=o.mapResult(t,i);if(l.recover!=null){let c=this.getMirror(a);if(c!=null&&c>a&&c<this.to){a=c,t=this._maps[c].recover(l.recover);continue}}r|=l.delInfo,t=l.pos}return n?t:new Do(t,r,null)}}const io=Object.create(null);class at{getMap(){return xt.empty}merge(t){return null}static fromJSON(t,i){if(!i||!i.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=io[i.stepType];if(!n)throw new RangeError(`No step type ${i.stepType} defined`);return n.fromJSON(t,i)}static jsonID(t,i){if(t in io)throw new RangeError("Duplicate use of step JSON ID "+t);return io[t]=i,i.prototype.jsonID=t,i}}class je{constructor(t,i){this.doc=t,this.failed=i}static ok(t){return new je(t,null)}static fail(t){return new je(null,t)}static fromReplace(t,i,n,r){try{return je.ok(t.replace(i,n,r))}catch(a){if(a instanceof Pn)return je.fail(a.message);throw a}}}function ps(e,t,i){let n=[];for(let r=0;r<e.childCount;r++){let a=e.child(r);a.content.size&&(a=a.copy(ps(a.content,t,a))),a.isInline&&(a=t(a,i,r)),n.push(a)}return Z.fromArray(n)}class hi extends at{constructor(t,i,n){super(),this.from=t,this.to=i,this.mark=n}apply(t){let i=t.slice(this.from,this.to),n=t.resolve(this.from),r=n.node(n.sharedDepth(this.to)),a=new ae(ps(i.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),r),i.openStart,i.openEnd);return je.fromReplace(t,this.from,this.to,a)}invert(){return new Ft(this.from,this.to,this.mark)}map(t){let i=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return i.deleted&&n.deleted||i.pos>=n.pos?null:new hi(i.pos,n.pos,this.mark)}merge(t){return t instanceof hi&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new hi(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,i){if(typeof i.from!="number"||typeof i.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new hi(i.from,i.to,t.markFromJSON(i.mark))}}at.jsonID("addMark",hi);class Ft extends at{constructor(t,i,n){super(),this.from=t,this.to=i,this.mark=n}apply(t){let i=t.slice(this.from,this.to),n=new ae(ps(i.content,r=>r.mark(this.mark.removeFromSet(r.marks)),t),i.openStart,i.openEnd);return je.fromReplace(t,this.from,this.to,n)}invert(){return new hi(this.from,this.to,this.mark)}map(t){let i=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return i.deleted&&n.deleted||i.pos>=n.pos?null:new Ft(i.pos,n.pos,this.mark)}merge(t){return t instanceof Ft&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Ft(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,i){if(typeof i.from!="number"||typeof i.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ft(i.from,i.to,t.markFromJSON(i.mark))}}at.jsonID("removeMark",Ft);class bi extends at{constructor(t,i){super(),this.pos=t,this.mark=i}apply(t){let i=t.nodeAt(this.pos);if(!i)return je.fail("No node at mark step's position");let n=i.type.create(i.attrs,null,this.mark.addToSet(i.marks));return je.fromReplace(t,this.pos,this.pos+1,new ae(Z.from(n),0,i.isLeaf?0:1))}invert(t){let i=t.nodeAt(this.pos);if(i){let n=this.mark.addToSet(i.marks);if(n.length==i.marks.length){for(let r=0;r<i.marks.length;r++)if(!i.marks[r].isInSet(n))return new bi(this.pos,i.marks[r]);return new bi(this.pos,this.mark)}}return new Hi(this.pos,this.mark)}map(t){let i=t.mapResult(this.pos,1);return i.deletedAfter?null:new bi(i.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,i){if(typeof i.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new bi(i.pos,t.markFromJSON(i.mark))}}at.jsonID("addNodeMark",bi);class Hi extends at{constructor(t,i){super(),this.pos=t,this.mark=i}apply(t){let i=t.nodeAt(this.pos);if(!i)return je.fail("No node at mark step's position");let n=i.type.create(i.attrs,null,this.mark.removeFromSet(i.marks));return je.fromReplace(t,this.pos,this.pos+1,new ae(Z.from(n),0,i.isLeaf?0:1))}invert(t){let i=t.nodeAt(this.pos);return!i||!this.mark.isInSet(i.marks)?this:new bi(this.pos,this.mark)}map(t){let i=t.mapResult(this.pos,1);return i.deletedAfter?null:new Hi(i.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,i){if(typeof i.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Hi(i.pos,t.markFromJSON(i.mark))}}at.jsonID("removeNodeMark",Hi);class He extends at{constructor(t,i,n,r=!1){super(),this.from=t,this.to=i,this.slice=n,this.structure=r}apply(t){return this.structure&&Ro(t,this.from,this.to)?je.fail("Structure replace would overwrite content"):je.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new xt([this.from,this.to-this.from,this.slice.size])}invert(t){return new He(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let i=t.mapResult(this.to,-1),n=this.from==this.to&&He.MAP_BIAS<0?i:t.mapResult(this.from,1);return n.deletedAcross&&i.deletedAcross?null:new He(n.pos,Math.max(n.pos,i.pos),this.slice,this.structure)}merge(t){if(!(t instanceof He)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let i=this.slice.size+t.slice.size==0?ae.empty:new ae(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new He(this.from,this.to+(t.to-t.from),i,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let i=this.slice.size+t.slice.size==0?ae.empty:new ae(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new He(t.from,this.to,i,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,i){if(typeof i.from!="number"||typeof i.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new He(i.from,i.to,ae.fromJSON(t,i.slice),!!i.structure)}}He.MAP_BIAS=1;at.jsonID("replace",He);class Ge extends at{constructor(t,i,n,r,a,o,l=!1){super(),this.from=t,this.to=i,this.gapFrom=n,this.gapTo=r,this.slice=a,this.insert=o,this.structure=l}apply(t){if(this.structure&&(Ro(t,this.from,this.gapFrom)||Ro(t,this.gapTo,this.to)))return je.fail("Structure gap-replace would overwrite content");let i=t.slice(this.gapFrom,this.gapTo);if(i.openStart||i.openEnd)return je.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,i.content);return n?je.fromReplace(t,this.from,this.to,n):je.fail("Content does not fit in gap")}getMap(){return new xt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let i=this.gapTo-this.gapFrom;return new Ge(this.from,this.from+this.slice.size+i,this.from+this.insert,this.from+this.insert+i,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let i=t.mapResult(this.from,1),n=t.mapResult(this.to,-1),r=this.from==this.gapFrom?i.pos:t.map(this.gapFrom,-1),a=this.to==this.gapTo?n.pos:t.map(this.gapTo,1);return i.deletedAcross&&n.deletedAcross||r<i.pos||a>n.pos?null:new Ge(i.pos,n.pos,r,a,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,i){if(typeof i.from!="number"||typeof i.to!="number"||typeof i.gapFrom!="number"||typeof i.gapTo!="number"||typeof i.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ge(i.from,i.to,i.gapFrom,i.gapTo,ae.fromJSON(t,i.slice),i.insert,!!i.structure)}}at.jsonID("replaceAround",Ge);function Ro(e,t,i){let n=e.resolve(t),r=i-t,a=n.depth;for(;r>0&&a>0&&n.indexAfter(a)==n.node(a).childCount;)a--,r--;if(r>0){let o=n.node(a).maybeChild(n.indexAfter(a));for(;r>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,r--}}return!1}function Bv(e,t,i,n){let r=[],a=[],o,l;e.doc.nodesBetween(t,i,(c,f,p)=>{if(!c.isInline)return;let m=c.marks;if(!n.isInSet(m)&&p.type.allowsMarkType(n.type)){let d=Math.max(f,t),h=Math.min(f+c.nodeSize,i),v=n.addToSet(m);for(let b=0;b<m.length;b++)m[b].isInSet(v)||(o&&o.to==d&&o.mark.eq(m[b])?o.to=h:r.push(o=new Ft(d,h,m[b])));l&&l.to==d?l.to=h:a.push(l=new hi(d,h,n))}}),r.forEach(c=>e.step(c)),a.forEach(c=>e.step(c))}function Pv(e,t,i,n){let r=[],a=0;e.doc.nodesBetween(t,i,(o,l)=>{if(!o.isInline)return;a++;let c=null;if(n instanceof Pa){let f=o.marks,p;for(;p=n.isInSet(f);)(c||(c=[])).push(p),f=p.removeFromSet(f)}else n?n.isInSet(o.marks)&&(c=[n]):c=o.marks;if(c&&c.length){let f=Math.min(l+o.nodeSize,i);for(let p=0;p<c.length;p++){let m=c[p],d;for(let h=0;h<r.length;h++){let v=r[h];v.step==a-1&&m.eq(r[h].style)&&(d=v)}d?(d.to=f,d.step=a):r.push({style:m,from:Math.max(l,t),to:f,step:a})}}}),r.forEach(o=>e.step(new Ft(o.from,o.to,o.style)))}function ds(e,t,i,n=i.contentMatch,r=!0){let a=e.doc.nodeAt(t),o=[],l=t+1;for(let c=0;c<a.childCount;c++){let f=a.child(c),p=l+f.nodeSize,m=n.matchType(f.type);if(!m)o.push(new He(l,p,ae.empty));else{n=m;for(let d=0;d<f.marks.length;d++)i.allowsMarkType(f.marks[d].type)||e.step(new Ft(l,p,f.marks[d]));if(r&&f.isText&&i.whitespace!="pre"){let d,h=/\r?\n|\r/g,v;for(;d=h.exec(f.text);)v||(v=new ae(Z.from(i.schema.text(" ",i.allowedMarks(f.marks))),0,0)),o.push(new He(l+d.index,l+d.index+d[0].length,v))}}l=p}if(!n.validEnd){let c=n.fillBefore(Z.empty,!0);e.replace(l,l,new ae(c,0,0))}for(let c=o.length-1;c>=0;c--)e.step(o[c])}function Vv(e,t,i){return(t==0||e.canReplace(t,e.childCount))&&(i==e.childCount||e.canReplace(0,i))}function pn(e){let i=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,a=0;;--n){let o=e.$from.node(n),l=e.$from.index(n)+r,c=e.$to.indexAfter(n)-a;if(n<e.depth&&o.canReplace(l,c,i))return n;if(n==0||o.type.spec.isolating||!Vv(o,l,c))break;l&&(r=1),c<o.childCount&&(a=1)}return null}function Fv(e,t,i){let{$from:n,$to:r,depth:a}=t,o=n.before(a+1),l=r.after(a+1),c=o,f=l,p=Z.empty,m=0;for(let v=a,b=!1;v>i;v--)b||n.index(v)>0?(b=!0,p=Z.from(n.node(v).copy(p)),m++):c--;let d=Z.empty,h=0;for(let v=a,b=!1;v>i;v--)b||r.after(v+1)<r.end(v)?(b=!0,d=Z.from(r.node(v).copy(d)),h++):f++;e.step(new Ge(c,f,o,l,new ae(p.append(d),m,h),p.size-m,!0))}function ms(e,t,i=null,n=e){let r=Uv(e,t),a=r&&Hv(n,t);return a?r.map(zl).concat({type:t,attrs:i}).concat(a.map(zl)):null}function zl(e){return{type:e,attrs:null}}function Uv(e,t){let{parent:i,startIndex:n,endIndex:r}=e,a=i.contentMatchAt(n).findWrapping(t);if(!a)return null;let o=a.length?a[0]:t;return i.canReplaceWith(n,r,o)?a:null}function Hv(e,t){let{parent:i,startIndex:n,endIndex:r}=e,a=i.child(n),o=t.contentMatch.findWrapping(a.type);if(!o)return null;let c=(o.length?o[o.length-1]:t).contentMatch;for(let f=n;c&&f<r;f++)c=c.matchType(i.child(f).type);return!c||!c.validEnd?null:o}function jv(e,t,i){let n=Z.empty;for(let o=i.length-1;o>=0;o--){if(n.size){let l=i[o].type.contentMatch.matchFragment(n);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=Z.from(i[o].type.create(i[o].attrs,n))}let r=t.start,a=t.end;e.step(new Ge(r,a,r,a,new ae(n,0,0),i.length,!0))}function qv(e,t,i,n,r){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=e.steps.length;e.doc.nodesBetween(t,i,(o,l)=>{let c=typeof r=="function"?r(o):r;if(o.isTextblock&&!o.hasMarkup(n,c)&&$v(e.doc,e.mapping.slice(a).map(l),n)){let f=null;if(n.schema.linebreakReplacement){let h=n.whitespace=="pre",v=!!n.contentMatch.matchType(n.schema.linebreakReplacement);h&&!v?f=!1:!h&&v&&(f=!0)}f===!1&&zu(e,o,l,a),ds(e,e.mapping.slice(a).map(l,1),n,void 0,f===null);let p=e.mapping.slice(a),m=p.map(l,1),d=p.map(l+o.nodeSize,1);return e.step(new Ge(m,d,m+1,d-1,new ae(Z.from(n.create(c,null,o.marks)),0,0),1,!0)),f===!0&&Mu(e,o,l,a),!1}})}function Mu(e,t,i,n){t.forEach((r,a)=>{if(r.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(r.text);){let c=e.mapping.slice(n).map(i+1+a+o.index);e.replaceWith(c,c+1,t.type.schema.linebreakReplacement.create())}}})}function zu(e,t,i,n){t.forEach((r,a)=>{if(r.type==r.type.schema.linebreakReplacement){let o=e.mapping.slice(n).map(i+1+a);e.replaceWith(o,o+1,t.type.schema.text(`
495
+ `))}})}function $v(e,t,i){let n=e.resolve(t),r=n.index();return n.parent.canReplaceWith(r,r+1,i)}function Wv(e,t,i,n,r){let a=e.doc.nodeAt(t);if(!a)throw new RangeError("No node at given position");i||(i=a.type);let o=i.create(n,null,r||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!i.validContent(a.content))throw new RangeError("Invalid content for node type "+i.name);e.step(new Ge(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new ae(Z.from(o),0,0),1,!0))}function ii(e,t,i=1,n){let r=e.resolve(t),a=r.depth-i,o=n&&n[n.length-1]||r.parent;if(a<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!o.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let f=r.depth-1,p=i-2;f>a;f--,p--){let m=r.node(f),d=r.index(f);if(m.type.spec.isolating)return!1;let h=m.content.cutByIndex(d,m.childCount),v=n&&n[p+1];v&&(h=h.replaceChild(0,v.type.create(v.attrs)));let b=n&&n[p]||m;if(!m.canReplace(d+1,m.childCount)||!b.type.validContent(h))return!1}let l=r.indexAfter(a),c=n&&n[0];return r.node(a).canReplaceWith(l,l,c?c.type:r.node(a+1).type)}function Gv(e,t,i=1,n){let r=e.doc.resolve(t),a=Z.empty,o=Z.empty;for(let l=r.depth,c=r.depth-i,f=i-1;l>c;l--,f--){a=Z.from(r.node(l).copy(a));let p=n&&n[f];o=Z.from(p?p.type.create(p.attrs,o):r.node(l).copy(o))}e.step(new He(t,t,new ae(a.append(o),i,i),!0))}function ki(e,t){let i=e.resolve(t),n=i.index();return Iu(i.nodeBefore,i.nodeAfter)&&i.parent.canReplace(n,n+1)}function Kv(e,t){t.content.size||e.type.compatibleContent(t.type);let i=e.contentMatchAt(e.childCount),{linebreakReplacement:n}=e.type.schema;for(let r=0;r<t.childCount;r++){let a=t.child(r),o=a.type==n?e.type.schema.nodes.text:a.type;if(i=i.matchType(o),!i||!e.type.allowsMarks(a.marks))return!1}return i.validEnd}function Iu(e,t){return!!(e&&t&&!e.isLeaf&&Kv(e,t))}function Va(e,t,i=-1){let n=e.resolve(t);for(let r=n.depth;;r--){let a,o,l=n.index(r);if(r==n.depth?(a=n.nodeBefore,o=n.nodeAfter):i>0?(a=n.node(r+1),l++,o=n.node(r).maybeChild(l)):(a=n.node(r).maybeChild(l-1),o=n.node(r+1)),a&&!a.isTextblock&&Iu(a,o)&&n.node(r).canReplace(l,l+1))return t;if(r==0)break;t=i<0?n.before(r):n.after(r)}}function Xv(e,t,i){let n=null,{linebreakReplacement:r}=e.doc.type.schema,a=e.doc.resolve(t-i),o=a.node().type;if(r&&o.inlineContent){let p=o.whitespace=="pre",m=!!o.contentMatch.matchType(r);p&&!m?n=!1:!p&&m&&(n=!0)}let l=e.steps.length;if(n===!1){let p=e.doc.resolve(t+i);zu(e,p.node(),p.before(),l)}o.inlineContent&&ds(e,t+i-1,o,a.node().contentMatchAt(a.index()),n==null);let c=e.mapping.slice(l),f=c.map(t-i);if(e.step(new He(f,c.map(t+i,-1),ae.empty,!0)),n===!0){let p=e.doc.resolve(f);Mu(e,p.node(),p.before(),e.steps.length)}return e}function Jv(e,t,i){let n=e.resolve(t);if(n.parent.canReplaceWith(n.index(),n.index(),i))return t;if(n.parentOffset==0)for(let r=n.depth-1;r>=0;r--){let a=n.index(r);if(n.node(r).canReplaceWith(a,a,i))return n.before(r+1);if(a>0)return null}if(n.parentOffset==n.parent.content.size)for(let r=n.depth-1;r>=0;r--){let a=n.indexAfter(r);if(n.node(r).canReplaceWith(a,a,i))return n.after(r+1);if(a<n.node(r).childCount)return null}return null}function Zv(e,t,i){let n=e.resolve(t);if(!i.content.size)return t;let r=i.content;for(let a=0;a<i.openStart;a++)r=r.firstChild.content;for(let a=1;a<=(i.openStart==0&&i.size?2:1);a++)for(let o=n.depth;o>=0;o--){let l=o==n.depth?0:n.pos<=(n.start(o+1)+n.end(o+1))/2?-1:1,c=n.index(o)+(l>0?1:0),f=n.node(o),p=!1;if(a==1)p=f.canReplace(c,c,r);else{let m=f.contentMatchAt(c).findWrapping(r.firstChild.type);p=m&&f.canReplaceWith(c,c,m[0])}if(p)return l==0?n.pos:l<0?n.before(o+1):n.after(o+1)}return null}function Fa(e,t,i=t,n=ae.empty){if(t==i&&!n.size)return null;let r=e.resolve(t),a=e.resolve(i);return Du(r,a,n)?new He(t,i,n):new Qv(r,a,n).fit()}function Du(e,t,i){return!i.openStart&&!i.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),i.content)}class Qv{constructor(t,i,n){this.$from=t,this.$to=i,this.unplaced=n,this.frontier=[],this.placed=Z.empty;for(let r=0;r<=t.depth;r++){let a=t.node(r);this.frontier.push({type:a.type,match:a.contentMatchAt(t.indexAfter(r))})}for(let r=t.depth;r>0;r--)this.placed=Z.from(t.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let f=this.findFittable();f?this.placeNodes(f):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),i=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(t<0?this.$to:n.doc.resolve(t));if(!r)return null;let a=this.placed,o=n.depth,l=r.depth;for(;o&&l&&a.childCount==1;)a=a.firstChild.content,o--,l--;let c=new ae(a,o,l);return t>-1?new Ge(n.pos,t,this.$to.pos,this.$to.end(),c,i):c.size||n.pos!=this.$to.pos?new He(n.pos,r.pos,c):null}findFittable(){let t=this.unplaced.openStart;for(let i=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<t;n++){let a=i.firstChild;if(i.childCount>1&&(r=0),a.type.spec.isolating&&r<=n){t=n;break}i=a.content}for(let i=1;i<=2;i++)for(let n=i==1?t:this.unplaced.openStart;n>=0;n--){let r,a=null;n?(a=no(this.unplaced.content,n-1).firstChild,r=a.content):r=this.unplaced.content;let o=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:f}=this.frontier[l],p,m=null;if(i==1&&(o?f.matchType(o.type)||(m=f.fillBefore(Z.from(o),!1)):a&&c.compatibleContent(a.type)))return{sliceDepth:n,frontierDepth:l,parent:a,inject:m};if(i==2&&o&&(p=f.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:l,parent:a,wrap:p};if(a&&f.matchType(a.type))break}}}openMore(){let{content:t,openStart:i,openEnd:n}=this.unplaced,r=no(t,i);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new ae(t,i+1,Math.max(n,r.size+i>=t.size-n?i+1:0)),!0)}dropNode(){let{content:t,openStart:i,openEnd:n}=this.unplaced,r=no(t,i);if(r.childCount<=1&&i>0){let a=t.size-i<=i+r.size;this.unplaced=new ae(En(t,i-1,1),i-1,a?i-1:n)}else this.unplaced=new ae(En(t,i,1),i,n)}placeNodes({sliceDepth:t,frontierDepth:i,parent:n,inject:r,wrap:a}){for(;this.depth>i;)this.closeFrontierNode();if(a)for(let b=0;b<a.length;b++)this.openFrontierNode(a[b]);let o=this.unplaced,l=n?n.content:o.content,c=o.openStart-t,f=0,p=[],{match:m,type:d}=this.frontier[i];if(r){for(let b=0;b<r.childCount;b++)p.push(r.child(b));m=m.matchFragment(r)}let h=l.size+t-(o.content.size-o.openEnd);for(;f<l.childCount;){let b=l.child(f),y=m.matchType(b.type);if(!y)break;f++,(f>1||c==0||b.content.size)&&(m=y,p.push(Ru(b.mark(d.allowedMarks(b.marks)),f==1?c:0,f==l.childCount?h:-1)))}let v=f==l.childCount;v||(h=-1),this.placed=Nn(this.placed,i,Z.from(p)),this.frontier[i].match=m,v&&h<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let b=0,y=l;b<h;b++){let g=y.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),y=g.content}this.unplaced=v?t==0?ae.empty:new ae(En(o.content,t-1,1),t-1,h<0?o.openEnd:t-1):new ae(En(o.content,t,f),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],i;if(!t.type.isTextblock||!ro(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(i=this.findCloseLevel(this.$to))&&i.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(t){e:for(let i=Math.min(this.depth,t.depth);i>=0;i--){let{match:n,type:r}=this.frontier[i],a=i<t.depth&&t.end(i+1)==t.pos+(t.depth-(i+1)),o=ro(t,i,r,n,a);if(o){for(let l=i-1;l>=0;l--){let{match:c,type:f}=this.frontier[l],p=ro(t,l,f,c,!0);if(!p||p.childCount)continue e}return{depth:i,fit:o,move:a?t.doc.resolve(t.after(i+1)):t}}}}close(t){let i=this.findCloseLevel(t);if(!i)return null;for(;this.depth>i.depth;)this.closeFrontierNode();i.fit.childCount&&(this.placed=Nn(this.placed,i.depth,i.fit)),t=i.move;for(let n=i.depth+1;n<=t.depth;n++){let r=t.node(n),a=r.type.contentMatch.fillBefore(r.content,!0,t.index(n));this.openFrontierNode(r.type,r.attrs,a)}return t}openFrontierNode(t,i=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(t),this.placed=Nn(this.placed,this.depth,Z.from(t.create(i,n))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let i=this.frontier.pop().match.fillBefore(Z.empty,!0);i.childCount&&(this.placed=Nn(this.placed,this.frontier.length,i))}}function En(e,t,i){return t==0?e.cutByIndex(i,e.childCount):e.replaceChild(0,e.firstChild.copy(En(e.firstChild.content,t-1,i)))}function Nn(e,t,i){return t==0?e.append(i):e.replaceChild(e.childCount-1,e.lastChild.copy(Nn(e.lastChild.content,t-1,i)))}function no(e,t){for(let i=0;i<t;i++)e=e.firstChild.content;return e}function Ru(e,t,i){if(t<=0)return e;let n=e.content;return t>1&&(n=n.replaceChild(0,Ru(n.firstChild,t-1,n.childCount==1?i-1:0))),t>0&&(n=e.type.contentMatch.fillBefore(n).append(n),i<=0&&(n=n.append(e.type.contentMatch.matchFragment(n).fillBefore(Z.empty,!0)))),e.copy(n)}function ro(e,t,i,n,r){let a=e.node(t),o=r?e.indexAfter(t):e.index(t);if(o==a.childCount&&!i.compatibleContent(a.type))return null;let l=n.fillBefore(a.content,!0,o);return l&&!Yv(i,a.content,o)?l:null}function Yv(e,t,i){for(let n=i;n<t.childCount;n++)if(!e.allowsMarks(t.child(n).marks))return!0;return!1}function ey(e){return e.spec.defining||e.spec.definingForContent}function ty(e,t,i,n){if(!n.size)return e.deleteRange(t,i);let r=e.doc.resolve(t),a=e.doc.resolve(i);if(Du(r,a,n))return e.step(new He(t,i,n));let o=Bu(r,a);o[o.length-1]==0&&o.pop();let l=-(r.depth+1);o.unshift(l);for(let d=r.depth,h=r.pos-1;d>0;d--,h--){let v=r.node(d).type.spec;if(v.defining||v.definingAsContext||v.isolating)break;o.indexOf(d)>-1?l=d:r.before(d)==h&&o.splice(1,0,-d)}let c=o.indexOf(l),f=[],p=n.openStart;for(let d=n.content,h=0;;h++){let v=d.firstChild;if(f.push(v),h==n.openStart)break;d=v.content}for(let d=p-1;d>=0;d--){let h=f[d],v=ey(h.type);if(v&&!h.sameMarkup(r.node(Math.abs(l)-1)))p=d;else if(v||!h.type.isTextblock)break}for(let d=n.openStart;d>=0;d--){let h=(d+p+1)%(n.openStart+1),v=f[h];if(v)for(let b=0;b<o.length;b++){let y=o[(b+c)%o.length],g=!0;y<0&&(g=!1,y=-y);let x=r.node(y-1),k=r.index(y-1);if(x.canReplaceWith(k,k,v.type,v.marks))return e.replace(r.before(y),g?a.after(y):i,new ae(Lu(n.content,0,n.openStart,h),h,n.openEnd))}}let m=e.steps.length;for(let d=o.length-1;d>=0&&(e.replace(t,i,n),!(e.steps.length>m));d--){let h=o[d];h<0||(t=r.before(h),i=a.after(h))}}function Lu(e,t,i,n,r){if(t<i){let a=e.firstChild;e=e.replaceChild(0,a.copy(Lu(a.content,t+1,i,n,a)))}if(t>n){let a=r.contentMatchAt(0),o=a.fillBefore(e).append(e);e=o.append(a.matchFragment(o).fillBefore(Z.empty,!0))}return e}function iy(e,t,i,n){if(!n.isInline&&t==i&&e.doc.resolve(t).parent.content.size){let r=Jv(e.doc,t,n.type);r!=null&&(t=i=r)}e.replaceRange(t,i,new ae(Z.from(n),0,0))}function ny(e,t,i){let n=e.doc.resolve(t),r=e.doc.resolve(i);if(n.parent.isTextblock&&r.parent.isTextblock&&n.start()!=r.start()&&n.parentOffset==0&&r.parentOffset==0){let o=n.sharedDepth(i),l=!1;for(let c=n.depth;c>o;c--)n.node(c).type.spec.isolating&&(l=!0);for(let c=r.depth;c>o;c--)r.node(c).type.spec.isolating&&(l=!0);if(!l){for(let c=n.depth;c>0&&t==n.start(c);c--)t=n.before(c);for(let c=r.depth;c>0&&i==r.start(c);c--)i=r.before(c);n=e.doc.resolve(t),r=e.doc.resolve(i)}}let a=Bu(n,r);for(let o=0;o<a.length;o++){let l=a[o],c=o==a.length-1;if(c&&l==0||n.node(l).type.contentMatch.validEnd)return e.delete(n.start(l),r.end(l));if(l>0&&(c||n.node(l-1).canReplace(n.index(l-1),r.indexAfter(l-1))))return e.delete(n.before(l),r.after(l))}for(let o=1;o<=n.depth&&o<=r.depth;o++)if(t-n.start(o)==n.depth-o&&i>n.end(o)&&r.end(o)-i!=r.depth-o&&n.start(o-1)==r.start(o-1)&&n.node(o-1).canReplace(n.index(o-1),r.index(o-1)))return e.delete(n.before(o),i);e.delete(t,i)}function Bu(e,t){let i=[],n=Math.min(e.depth,t.depth);for(let r=n;r>=0;r--){let a=e.start(r);if(a<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(a==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==a-1)&&i.push(r)}return i}class ln extends at{constructor(t,i,n){super(),this.pos=t,this.attr=i,this.value=n}apply(t){let i=t.nodeAt(this.pos);if(!i)return je.fail("No node at attribute step's position");let n=Object.create(null);for(let a in i.attrs)n[a]=i.attrs[a];n[this.attr]=this.value;let r=i.type.create(n,null,i.marks);return je.fromReplace(t,this.pos,this.pos+1,new ae(Z.from(r),0,i.isLeaf?0:1))}getMap(){return xt.empty}invert(t){return new ln(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let i=t.mapResult(this.pos,1);return i.deletedAfter?null:new ln(i.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,i){if(typeof i.pos!="number"||typeof i.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ln(i.pos,i.attr,i.value)}}at.jsonID("attr",ln);class Un extends at{constructor(t,i){super(),this.attr=t,this.value=i}apply(t){let i=Object.create(null);for(let r in t.attrs)i[r]=t.attrs[r];i[this.attr]=this.value;let n=t.type.create(i,t.content,t.marks);return je.ok(n)}getMap(){return xt.empty}invert(t){return new Un(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,i){if(typeof i.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Un(i.attr,i.value)}}at.jsonID("docAttr",Un);let cn=class extends Error{};cn=function e(t){let i=Error.call(this,t);return i.__proto__=e.prototype,i};cn.prototype=Object.create(Error.prototype);cn.prototype.constructor=cn;cn.prototype.name="TransformError";class Pu{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new ea}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let i=this.maybeStep(t);if(i.failed)throw new cn(i.failed);return this}maybeStep(t){let i=t.apply(this.doc);return i.failed||this.addStep(t,i.doc),i}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,i=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(t=r.map(t,1),i=r.map(i,-1)),r.forEach((a,o,l,c)=>{t=Math.min(t,l),i=Math.max(i,c)})}return t==1e9?null:{from:t,to:i}}addStep(t,i){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=i}replace(t,i=t,n=ae.empty){let r=Fa(this.doc,t,i,n);return r&&this.step(r),this}replaceWith(t,i,n){return this.replace(t,i,new ae(Z.from(n),0,0))}delete(t,i){return this.replace(t,i,ae.empty)}insert(t,i){return this.replaceWith(t,t,i)}replaceRange(t,i,n){return ty(this,t,i,n),this}replaceRangeWith(t,i,n){return iy(this,t,i,n),this}deleteRange(t,i){return ny(this,t,i),this}lift(t,i){return Fv(this,t,i),this}join(t,i=1){return Xv(this,t,i),this}wrap(t,i){return jv(this,t,i),this}setBlockType(t,i=t,n,r=null){return qv(this,t,i,n,r),this}setNodeMarkup(t,i,n=null,r){return Wv(this,t,i,n,r),this}setNodeAttribute(t,i,n){return this.step(new ln(t,i,n)),this}setDocAttribute(t,i){return this.step(new Un(t,i)),this}addNodeMark(t,i){return this.step(new bi(t,i)),this}removeNodeMark(t,i){let n=this.doc.nodeAt(t);if(!n)throw new RangeError("No node at position "+t);if(i instanceof Re)i.isInSet(n.marks)&&this.step(new Hi(t,i));else{let r=n.marks,a,o=[];for(;a=i.isInSet(r);)o.push(new Hi(t,a)),r=a.removeFromSet(r);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(t,i=1,n){return Gv(this,t,i,n),this}addMark(t,i,n){return Bv(this,t,i,n),this}removeMark(t,i,n){return Pv(this,t,i,n),this}clearIncompatible(t,i,n){return ds(this,t,i,n),this}}const ao=Object.create(null);class ve{constructor(t,i,n){this.$anchor=t,this.$head=i,this.ranges=n||[new Vu(t.min(i),t.max(i))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let i=0;i<t.length;i++)if(t[i].$from.pos!=t[i].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,i=ae.empty){let n=i.content.lastChild,r=null;for(let l=0;l<i.openEnd;l++)r=n,n=n.lastChild;let a=t.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:c,$to:f}=o[l],p=t.mapping.slice(a);t.replaceRange(p.map(c.pos),p.map(f.pos),l?ae.empty:i),l==0&&Rl(t,a,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(t,i){let n=t.steps.length,r=this.ranges;for(let a=0;a<r.length;a++){let{$from:o,$to:l}=r[a],c=t.mapping.slice(n),f=c.map(o.pos),p=c.map(l.pos);a?t.deleteRange(f,p):(t.replaceRangeWith(f,p,i),Rl(t,n,i.isInline?-1:1))}}static findFrom(t,i,n=!1){let r=t.parent.inlineContent?new he(t):nn(t.node(0),t.parent,t.pos,t.index(),i,n);if(r)return r;for(let a=t.depth-1;a>=0;a--){let o=i<0?nn(t.node(0),t.node(a),t.before(a+1),t.index(a),i,n):nn(t.node(0),t.node(a),t.after(a+1),t.index(a)+1,i,n);if(o)return o}return null}static near(t,i=1){return this.findFrom(t,i)||this.findFrom(t,-i)||new wt(t.node(0))}static atStart(t){return nn(t,t,0,0,1)||new wt(t)}static atEnd(t){return nn(t,t,t.content.size,t.childCount,-1)||new wt(t)}static fromJSON(t,i){if(!i||!i.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=ao[i.type];if(!n)throw new RangeError(`No selection type ${i.type} defined`);return n.fromJSON(t,i)}static jsonID(t,i){if(t in ao)throw new RangeError("Duplicate use of selection JSON ID "+t);return ao[t]=i,i.prototype.jsonID=t,i}getBookmark(){return he.between(this.$anchor,this.$head).getBookmark()}}ve.prototype.visible=!0;class Vu{constructor(t,i){this.$from=t,this.$to=i}}let Il=!1;function Dl(e){!Il&&!e.parent.inlineContent&&(Il=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class he extends ve{constructor(t,i=t){Dl(t),Dl(i),super(t,i)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,i){let n=t.resolve(i.map(this.head));if(!n.parent.inlineContent)return ve.near(n);let r=t.resolve(i.map(this.anchor));return new he(r.parent.inlineContent?r:n,n)}replace(t,i=ae.empty){if(super.replace(t,i),i==ae.empty){let n=this.$from.marksAcross(this.$to);n&&t.ensureMarks(n)}}eq(t){return t instanceof he&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Ua(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,i){if(typeof i.anchor!="number"||typeof i.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new he(t.resolve(i.anchor),t.resolve(i.head))}static create(t,i,n=i){let r=t.resolve(i);return new this(r,n==i?r:t.resolve(n))}static between(t,i,n){let r=t.pos-i.pos;if((!n||r)&&(n=r>=0?1:-1),!i.parent.inlineContent){let a=ve.findFrom(i,n,!0)||ve.findFrom(i,-n,!0);if(a)i=a.$head;else return ve.near(i,n)}return t.parent.inlineContent||(r==0?t=i:(t=(ve.findFrom(t,-n,!0)||ve.findFrom(t,n,!0)).$anchor,t.pos<i.pos!=r<0&&(t=i))),new he(t,i)}}ve.jsonID("text",he);class Ua{constructor(t,i){this.anchor=t,this.head=i}map(t){return new Ua(t.map(this.anchor),t.map(this.head))}resolve(t){return he.between(t.resolve(this.anchor),t.resolve(this.head))}}class de extends ve{constructor(t){let i=t.nodeAfter,n=t.node(0).resolve(t.pos+i.nodeSize);super(t,n),this.node=i}map(t,i){let{deleted:n,pos:r}=i.mapResult(this.anchor),a=t.resolve(r);return n?ve.near(a):new de(a)}content(){return new ae(Z.from(this.node),0,0)}eq(t){return t instanceof de&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new hs(this.anchor)}static fromJSON(t,i){if(typeof i.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new de(t.resolve(i.anchor))}static create(t,i){return new de(t.resolve(i))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}de.prototype.visible=!1;ve.jsonID("node",de);class hs{constructor(t){this.anchor=t}map(t){let{deleted:i,pos:n}=t.mapResult(this.anchor);return i?new Ua(n,n):new hs(n)}resolve(t){let i=t.resolve(this.anchor),n=i.nodeAfter;return n&&de.isSelectable(n)?new de(i):ve.near(i)}}class wt extends ve{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,i=ae.empty){if(i==ae.empty){t.delete(0,t.doc.content.size);let n=ve.atStart(t.doc);n.eq(t.selection)||t.setSelection(n)}else super.replace(t,i)}toJSON(){return{type:"all"}}static fromJSON(t){return new wt(t)}map(t){return new wt(t)}eq(t){return t instanceof wt}getBookmark(){return ry}}ve.jsonID("all",wt);const ry={map(){return this},resolve(e){return new wt(e)}};function nn(e,t,i,n,r,a=!1){if(t.inlineContent)return he.create(e,i);for(let o=n-(r>0?0:1);r>0?o<t.childCount:o>=0;o+=r){let l=t.child(o);if(l.isAtom){if(!a&&de.isSelectable(l))return de.create(e,i-(r<0?l.nodeSize:0))}else{let c=nn(e,l,i+r,r<0?l.childCount:0,r,a);if(c)return c}i+=l.nodeSize*r}return null}function Rl(e,t,i){let n=e.steps.length-1;if(n<t)return;let r=e.steps[n];if(!(r instanceof He||r instanceof Ge))return;let a=e.mapping.maps[n],o;a.forEach((l,c,f,p)=>{o==null&&(o=p)}),e.setSelection(ve.near(e.doc.resolve(o),i))}function Ll(e,t){return!t||!e?e:e.bind(t)}class Sr{constructor(t,i,n){this.name=t,this.init=Ll(i.init,n),this.apply=Ll(i.apply,n)}}new Sr("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new Sr("selection",{init(e,t){return e.selection||ve.atStart(t.doc)},apply(e){return e.selection}}),new Sr("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,i,n){return n.selection.$cursor?e.storedMarks:null}}),new Sr("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}});function Fu(e,t,i){for(let n in e){let r=e[n];r instanceof Function?r=r.bind(t):n=="handleDOMEvents"&&(r=Fu(r,t,{})),i[n]=r}return i}class ft{constructor(t){this.spec=t,this.props={},t.props&&Fu(t.props,this,this.props),this.key=t.key?t.key.key:Uu("plugin")}getState(t){return t[this.key]}}const oo=Object.create(null);function Uu(e){return e in oo?e+"$"+ ++oo[e]:(oo[e]=0,e+"$")}class ot{constructor(t="key"){this.key=Uu(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const $i=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Hu=function(e,t,i,n){return i&&(Bl(e,t,i,n,-1)||Bl(e,t,i,n,1))},ay=/^(img|br|input|textarea|hr)$/i;function Bl(e,t,i,n,r){for(var a;;){if(e==i&&t==n)return!0;if(t==(r<0?0:ta(e))){let o=e.parentNode;if(!o||o.nodeType!=1||bs(e)||ay.test(e.nodeName)||e.contentEditable=="false")return!1;t=$i(e)+(r<0?0:1),e=o}else if(e.nodeType==1){let o=e.childNodes[t+(r<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((a=o.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)t+=r;else return!1;else e=o,t=r<0?ta(e):0}else return!1}}function ta(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function oy(e,t,i){for(let n=t==0,r=t==ta(e);n||r;){if(e==i)return!0;let a=$i(e);if(e=e.parentNode,!e)return!1;n=n&&a==0,r=r&&a==ta(e)}}function bs(e){let t;for(let i=e;i&&!(t=i.pmViewDesc);i=i.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const ju=function(e){return e.focusNode&&Hu(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function qu(e,t){let i=document.createEvent("Event");return i.initEvent("keydown",!0,!0),i.keyCode=e,i.key=i.code=t,i}const Ut=typeof navigator<"u"?navigator:null,Pl=typeof document<"u"?document:null,wi=Ut&&Ut.userAgent||"",Lo=/Edge\/(\d+)/.exec(wi),$u=/MSIE \d/.exec(wi),Bo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(wi),Xn=!!($u||Bo||Lo),Wu=$u?document.documentMode:Bo?+Bo[1]:Lo?+Lo[1]:0,Ha=!Xn&&/gecko\/(\d+)/i.test(wi);Ha&&+(/Firefox\/(\d+)/.exec(wi)||[0,0])[1];const Po=!Xn&&/Chrome\/(\d+)/.exec(wi),ni=!!Po,Gu=Po?+Po[1]:0,Wi=!Xn&&!!Ut&&/Apple Computer/.test(Ut.vendor),gs=Wi&&(/Mobile\/\w+/.test(wi)||!!Ut&&Ut.maxTouchPoints>2),Nt=gs||(Ut?/Mac/.test(Ut.platform):!1),Ku=Ut?/Win/.test(Ut.platform):!1,Jn=/Android \d/.test(wi),vs=!!Pl&&"webkitFontSmoothing"in Pl.documentElement.style,sy=vs?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ly(e,t=null){let i=e.domSelectionRange(),n=e.state.doc;if(!i.focusNode)return null;let r=e.docView.nearestDesc(i.focusNode),a=r&&r.size==0,o=e.docView.posFromDOM(i.focusNode,i.focusOffset,1);if(o<0)return null;let l=n.resolve(o),c,f;if(ju(i)){for(c=o;r&&!r.node;)r=r.parent;let m=r.node;if(r&&m.isAtom&&de.isSelectable(m)&&r.parent&&!(m.isInline&&oy(i.focusNode,i.focusOffset,r.dom))){let d=r.posBefore;f=new de(o==d?l:n.resolve(d))}}else{if(i instanceof e.dom.ownerDocument.defaultView.Selection&&i.rangeCount>1){let m=o,d=o;for(let h=0;h<i.rangeCount;h++){let v=i.getRangeAt(h);m=Math.min(m,e.docView.posFromDOM(v.startContainer,v.startOffset,1)),d=Math.max(d,e.docView.posFromDOM(v.endContainer,v.endOffset,-1))}if(m<0)return null;[c,o]=d==e.state.selection.anchor?[d,m]:[m,d],l=n.resolve(o)}else c=e.docView.posFromDOM(i.anchorNode,i.anchorOffset,1);if(c<0)return null}let p=n.resolve(c);if(!f){let m=t=="pointer"||e.state.selection.head<l.pos&&!a?1:-1;f=Ju(e,p,l,m)}return f}function Xu(e){return e.editable?e.hasFocus():py(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function ys(e,t=!1){let i=e.state.selection;if(fy(e,i),!Xu(e))return;let n=e.input.mouseDown;if(!t&&ni&&n){let r=e.domSelectionRange(),a=e.domObserver.currentSelection;if(r.anchorNode&&a.anchorNode&&Hu(r.anchorNode,r.anchorOffset,a.anchorNode,a.anchorOffset)&&n.delaySelUpdate()){e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)uy(e);else{let{anchor:r,head:a}=i,o,l;Vl&&!(i instanceof he)&&(i.$from.parent.inlineContent||(o=Fl(e,i.from)),!i.empty&&!i.$from.parent.inlineContent&&(l=Fl(e,i.to))),e.docView.setSelection(r,a,e,t),Vl&&(o&&Ul(o),l&&Ul(l)),i.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&cy(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}const Vl=Wi||ni&&Gu<63;function Fl(e,t){let{node:i,offset:n}=e.docView.domFromPos(t,0),r=n<i.childNodes.length?i.childNodes[n]:null,a=n?i.childNodes[n-1]:null;if(Wi&&r&&r.contentEditable=="false")return so(r);if((!r||r.contentEditable=="false")&&(!a||a.contentEditable=="false")){if(r)return so(r);if(a)return so(a)}}function so(e){return e.contentEditable="true",Wi&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Ul(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function cy(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let i=e.domSelectionRange(),n=i.anchorNode,r=i.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(i.anchorNode!=n||i.anchorOffset!=r)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!Xu(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function uy(e){let t=e.domSelection();if(!t)return;let i=e.cursorWrapper.dom,n=i.nodeName=="IMG";n?t.collapse(i.parentNode,$i(i)+1):t.collapse(i,0),!n&&!e.state.selection.visible&&Xn&&Wu<=11&&(i.disabled=!0,i.disabled=!1)}function fy(e,t){if(t instanceof de){let i=e.docView.descAt(t.from);i!=e.lastSelectedViewDesc&&(Hl(e),i&&i.selectNode(),e.lastSelectedViewDesc=i)}else Hl(e)}function Hl(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Ju(e,t,i,n){return e.someProp("createSelectionBetween",r=>r(e,t,i))||he.between(t,i,n)}function py(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function Vo(e,t){let{$anchor:i,$head:n}=e.selection,r=t>0?i.max(n):i.min(n),a=r.parent.inlineContent?r.depth?e.doc.resolve(t>0?r.after():r.before()):null:r;return a&&ve.findFrom(a,t)}function pi(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function jl(e,t,i){let n=e.state.selection;if(n instanceof he)if(i.indexOf("s")>-1){let{$head:r}=n,a=r.textOffset?null:t<0?r.nodeBefore:r.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let o=e.state.doc.resolve(r.pos+a.nodeSize*(t<0?-1:1));return pi(e,new he(n.$anchor,o))}else if(n.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let r=Vo(e.state,t);return r&&r instanceof de?pi(e,r):!1}else if(!(Nt&&i.indexOf("m")>-1)){let r=n.$head,a=r.textOffset?null:t<0?r.nodeBefore:r.nodeAfter,o;if(!a||a.isText)return!1;let l=t<0?r.pos-a.nodeSize:r.pos;return a.isAtom||(o=e.docView.descAt(l))&&!o.contentDOM?de.isSelectable(a)?pi(e,new de(t<0?e.state.doc.resolve(r.pos-a.nodeSize):r)):vs?pi(e,new he(e.state.doc.resolve(t<0?l:l+a.nodeSize))):!1:!1}}else return!1;else{if(n instanceof de&&n.node.isInline)return pi(e,new he(t>0?n.$to:n.$from));{let r=Vo(e.state,t);return r?pi(e,r):!1}}}function ia(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function Mn(e,t){let i=e.pmViewDesc;return i&&i.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function Yi(e,t){return t<0?dy(e):my(e)}function dy(e){let t=e.domSelectionRange(),i=t.focusNode,n=t.focusOffset;if(!i)return;let r,a,o=!1;for(Ha&&i.nodeType==1&&n<ia(i)&&Mn(i.childNodes[n],-1)&&(o=!0);;)if(n>0){if(i.nodeType!=1)break;{let l=i.childNodes[n-1];if(Mn(l,-1))r=i,a=--n;else if(l.nodeType==3)i=l,n=i.nodeValue.length;else break}}else{if(Zu(i))break;{let l=i.previousSibling;for(;l&&Mn(l,-1);)r=i.parentNode,a=$i(l),l=l.previousSibling;if(l)i=l,n=ia(i);else{if(i=i.parentNode,i==e.dom)break;n=0}}}o?Fo(e,i,n):r&&Fo(e,r,a)}function my(e){let t=e.domSelectionRange(),i=t.focusNode,n=t.focusOffset;if(!i)return;let r=ia(i),a,o;for(;;)if(n<r){if(i.nodeType!=1)break;let l=i.childNodes[n];if(Mn(l,1))a=i,o=++n;else break}else{if(Zu(i))break;{let l=i.nextSibling;for(;l&&Mn(l,1);)a=l.parentNode,o=$i(l)+1,l=l.nextSibling;if(l)i=l,n=0,r=ia(i);else{if(i=i.parentNode,i==e.dom)break;n=r=0}}}a&&Fo(e,a,o)}function Zu(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function hy(e,t){for(;e&&t==e.childNodes.length&&!bs(e);)t=$i(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let i=e.childNodes[t];if(i.nodeType==3)return i;if(i.nodeType==1&&i.contentEditable=="false")break;e=i,t=0}}function by(e,t){for(;e&&!t&&!bs(e);)t=$i(e),e=e.parentNode;for(;e&&t;){let i=e.childNodes[t-1];if(i.nodeType==3)return i;if(i.nodeType==1&&i.contentEditable=="false")break;e=i,t=e.childNodes.length}}function Fo(e,t,i){if(t.nodeType!=3){let a,o;(o=hy(t,i))?(t=o,i=0):(a=by(t,i))&&(t=a,i=a.nodeValue.length)}let n=e.domSelection();if(!n)return;if(ju(n)){let a=document.createRange();a.setEnd(t,i),a.setStart(t,i),n.removeAllRanges(),n.addRange(a)}else n.extend&&n.extend(t,i);e.domObserver.setCurSelection();let{state:r}=e;setTimeout(()=>{e.state==r&&ys(e)},50)}function ql(e,t){let i=e.state.doc.resolve(t);if(!(ni||Ku)&&i.parent.inlineContent){let r=e.coordsAtPos(t);if(t>i.start()){let a=e.coordsAtPos(t-1),o=(a.top+a.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(a.left-r.left)>1)return a.left<r.left?"ltr":"rtl"}if(t<i.end()){let a=e.coordsAtPos(t+1),o=(a.top+a.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(a.left-r.left)>1)return a.left>r.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function $l(e,t,i){let n=e.state.selection;if(n instanceof he&&!n.empty||i.indexOf("s")>-1||Nt&&i.indexOf("m")>-1)return!1;let{$from:r,$to:a}=n;if(!r.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let o=Vo(e.state,t);if(o&&o instanceof de)return pi(e,o)}if(!r.parent.inlineContent){let o=t<0?r:a,l=n instanceof wt?ve.near(o,t):ve.findFrom(o,t);return l?pi(e,l):!1}return!1}function Wl(e,t){if(!(e.state.selection instanceof he))return!0;let{$head:i,$anchor:n,empty:r}=e.state.selection;if(!i.sameParent(n))return!0;if(!r)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let a=!i.textOffset&&(t<0?i.nodeBefore:i.nodeAfter);if(a&&!a.isText){let o=e.state.tr;return t<0?o.delete(i.pos-a.nodeSize,i.pos):o.delete(i.pos,i.pos+a.nodeSize),e.dispatch(o),!0}return!1}function Gl(e,t,i){e.domObserver.stop(),t.contentEditable=i,e.domObserver.start()}function gy(e){if(!Wi||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:i}=e.domSelectionRange();if(t&&t.nodeType==1&&i==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let n=t.firstChild;Gl(e,n,"true"),setTimeout(()=>Gl(e,n,"false"),20)}return!1}function vy(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function yy(e,t){let i=t.keyCode,n=vy(t);if(i==8||Nt&&i==72&&n=="c")return Wl(e,-1)||Yi(e,-1);if(i==46&&!t.shiftKey||Nt&&i==68&&n=="c")return Wl(e,1)||Yi(e,1);if(i==13||i==27)return!0;if(i==37||Nt&&i==66&&n=="c"){let r=i==37?ql(e,e.state.selection.from)=="ltr"?-1:1:-1;return jl(e,r,n)||Yi(e,r)}else if(i==39||Nt&&i==70&&n=="c"){let r=i==39?ql(e,e.state.selection.from)=="ltr"?1:-1:1;return jl(e,r,n)||Yi(e,r)}else{if(i==38||Nt&&i==80&&n=="c")return $l(e,-1,n)||Yi(e,-1);if(i==40||Nt&&i==78&&n=="c")return gy(e)||$l(e,1,n)||Yi(e,1);if(n==(Nt?"m":"c")&&(i==66||i==73||i==89||i==90))return!0}return!1}function Qu(e,t){e.someProp("transformCopied",h=>{t=h(t,e)});let i=[],{content:n,openStart:r,openEnd:a}=t;for(;r>1&&a>1&&n.childCount==1&&n.firstChild.childCount==1;){r--,a--;let h=n.firstChild;i.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),n=h.content}let o=e.someProp("clipboardSerializer")||Kn.fromSchema(e.state.schema),l=af(),c=l.createElement("div");c.appendChild(o.serializeFragment(n,{document:l}));let f=c.firstChild,p,m=0;for(;f&&f.nodeType==1&&(p=rf[f.nodeName.toLowerCase()]);){for(let h=p.length-1;h>=0;h--){let v=l.createElement(p[h]);for(;c.firstChild;)v.appendChild(c.firstChild);c.appendChild(v),m++}f=c.firstChild}f&&f.nodeType==1&&f.setAttribute("data-pm-slice",`${r} ${a}${m?` -${m}`:""} ${JSON.stringify(i)}`);let d=e.someProp("clipboardTextSerializer",h=>h(t,e))||t.content.textBetween(0,t.content.size,`
496
496
 
497
497
  `);return{dom:c,text:d,slice:t}}function Yu(e,t,i,n,r){let a=r.parent.type.spec.code,o,l;if(!i&&!t)return null;let c=!!t&&(n||a||!i);if(c){if(e.someProp("transformPastedText",d=>{t=d(t,a||n,e)}),a)return l=new ae(Z.from(e.state.schema.text(t.replace(/\r\n?/g,`
498
498
  `))),0,0),e.someProp("transformPasted",d=>{l=d(l,e,!0)}),l;let m=e.someProp("clipboardTextParser",d=>d(t,r,n,e));if(m)l=m;else{let d=r.marks(),{schema:h}=e.state,v=Kn.fromSchema(h);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(b=>{let y=o.appendChild(document.createElement("p"));b&&y.appendChild(v.serializeNode(h.text(b,d)))})}}else e.someProp("transformPastedHTML",m=>{i=m(i,e)}),o=_y(i),vs&&Sy(o);let f=o&&o.querySelector("[data-pm-slice]"),p=f&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(f.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let m=+p[3];m>0;m--){let d=o.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;o=d}if(l||(l=(e.someProp("clipboardParser")||e.someProp("domParser")||Br.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(c||p),context:r,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!xy.test(d.parentNode.nodeName)?{ignore:!0}:null}})),p)l=Cy(Kl(l,+p[1],+p[2]),p[4]);else if(l=ae.maxOpen(ky(l.content,r),!0),l.openStart||l.openEnd){let m=0,d=0;for(let h=l.content.firstChild;m<l.openStart&&!h.type.spec.isolating;m++,h=h.firstChild);for(let h=l.content.lastChild;d<l.openEnd&&!h.type.spec.isolating;d++,h=h.lastChild);l=Kl(l,m,d)}return e.someProp("transformPasted",m=>{l=m(l,e,c)}),l}const xy=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function ky(e,t){if(e.childCount<2)return e;for(let i=t.depth;i>=0;i--){let r=t.node(i).contentMatchAt(t.index(i)),a,o=[];if(e.forEach(l=>{if(!o)return;let c=r.findWrapping(l.type),f;if(!c)return o=null;if(f=o.length&&a.length&&tf(c,a,l,o[o.length-1],0))o[o.length-1]=f;else{o.length&&(o[o.length-1]=nf(o[o.length-1],a.length));let p=ef(l,c);o.push(p),r=r.matchType(p.type),a=c}}),o)return Z.from(o)}return e}function ef(e,t,i=0){for(let n=t.length-1;n>=i;n--)e=t[n].create(null,Z.from(e));return e}function tf(e,t,i,n,r){if(r<e.length&&r<t.length&&e[r]==t[r]){let a=tf(e,t,i,n.lastChild,r+1);if(a)return n.copy(n.content.replaceChild(n.childCount-1,a));if(n.contentMatchAt(n.childCount).matchType(r==e.length-1?i.type:e[r+1]))return n.copy(n.content.append(Z.from(ef(i,e,r+1))))}}function nf(e,t){if(t==0)return e;let i=e.content.replaceChild(e.childCount-1,nf(e.lastChild,t-1)),n=e.contentMatchAt(e.childCount).fillBefore(Z.empty,!0);return e.copy(i.append(n))}function Uo(e,t,i,n,r,a){let o=t<0?e.firstChild:e.lastChild,l=o.content;return e.childCount>1&&(a=0),r<n-1&&(l=Uo(l,t,i,n,r+1,a)),r>=i&&(l=t<0?o.contentMatchAt(0).fillBefore(l,a<=r).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(Z.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(l))}function Kl(e,t,i){return t<e.openStart&&(e=new ae(Uo(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),i<e.openEnd&&(e=new ae(Uo(e.content,1,i,e.openEnd,0,0),e.openStart,i)),e}const rf={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Xl=null;function af(){return Xl||(Xl=document.implementation.createHTMLDocument("title"))}let lo=null;function wy(e){let t=window.trustedTypes;return t?(lo||(lo=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:i=>i})),lo.createHTML(e)):e}function _y(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let i=af().createElement("div"),n=/<([a-z][^>\s]+)/i.exec(e),r;if((r=n&&rf[n[1].toLowerCase()])&&(e=r.map(a=>"<"+a+">").join("")+e+r.map(a=>"</"+a+">").reverse().join("")),i.innerHTML=wy(e),r)for(let a=0;a<r.length;a++)i=i.querySelector(r[a])||i;return i}function Sy(e){let t=e.querySelectorAll(ni?"span:not([class]):not([style])":"span.Apple-converted-space");for(let i=0;i<t.length;i++){let n=t[i];n.childNodes.length==1&&n.textContent==" "&&n.parentNode&&n.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),n)}}function Cy(e,t){if(!e.size)return e;let i=e.content.firstChild.type.schema,n;try{n=JSON.parse(t)}catch{return e}let{content:r,openStart:a,openEnd:o}=e;for(let l=n.length-2;l>=0;l-=2){let c=i.nodes[n[l]];if(!c||c.hasRequiredAttrs())break;r=Z.from(c.create(n[l+1],r)),a++,o++}return new ae(r,a,o)}const Rt={},_t={};function ti(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}_t.keydown=(e,t)=>{let i=t;if(e.input.shiftKey=i.keyCode==16||i.shiftKey,!cf(e)&&(e.input.lastKeyCode=i.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Jn&&ni&&i.keyCode==13)))if(i.keyCode!=229&&e.domObserver.forceFlush(),gs&&i.keyCode==13&&!i.ctrlKey&&!i.altKey&&!i.metaKey){let n=Date.now();e.input.lastIOSEnter=n,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==n&&(e.someProp("handleKeyDown",r=>r(e,qu(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",n=>n(e,i))||yy(e,i)?i.preventDefault():ti(e,"key")};_t.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};_t.keypress=(e,t)=>{let i=t;if(cf(e)||!i.charCode||i.ctrlKey&&!i.altKey||Nt&&i.metaKey)return;if(e.someProp("handleKeyPress",r=>r(e,i))){i.preventDefault();return}let n=e.state.selection;if(!(n instanceof he)||!n.$from.sameParent(n.$to)){let r=String.fromCharCode(i.charCode),a=()=>e.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!e.someProp("handleTextInput",o=>o(e,n.$from.pos,n.$to.pos,r,a))&&e.dispatch(a()),i.preventDefault()}};function Zn(e){return{left:e.clientX,top:e.clientY}}function Ey(e,t){let i=t.x-e.clientX,n=t.y-e.clientY;return i*i+n*n<100}function xs(e,t,i,n,r){if(n==-1)return!1;let a=e.state.doc.resolve(n);for(let o=a.depth+1;o>0;o--)if(e.someProp(t,l=>o>a.depth?l(e,i,a.nodeAfter,a.before(o),r,!0):l(e,i,a.node(o),a.before(o),r,!1)))return!0;return!1}function Qn(e,t,i){if(e.focused||e.focus(),e.state.selection.eq(t))return;let n=e.state.tr.setSelection(t);n.setMeta("pointer",!0),e.dispatch(n)}function Ny(e,t){if(t==-1)return!1;let i=e.state.doc.resolve(t),n=i.nodeAfter;return n&&n.isAtom&&de.isSelectable(n)?(Qn(e,new de(i)),!0):!1}function Ay(e,t){if(t==-1)return!1;let i=e.state.selection,n,r;i instanceof de&&(n=i.node);let a=e.state.doc.resolve(t);for(let o=a.depth+1;o>0;o--){let l=o>a.depth?a.nodeAfter:a.node(o);if(de.isSelectable(l)){n&&i.$from.depth>0&&o>=i.$from.depth&&a.before(i.$from.depth+1)==i.$from.pos?r=a.before(i.$from.depth):r=a.before(o);break}}return r!=null?(Qn(e,de.create(e.state.doc,r)),!0):!1}function Oy(e,t,i,n,r){return xs(e,"handleClickOn",t,i,n)||e.someProp("handleClick",a=>a(e,t,n))||(r?Ay(e,i):Ny(e,i))}function Ty(e,t,i,n){return xs(e,"handleDoubleClickOn",t,i,n)||e.someProp("handleDoubleClick",r=>r(e,t,n))}function My(e,t,i,n){return xs(e,"handleTripleClickOn",t,i,n)||e.someProp("handleTripleClick",r=>r(e,t,n))||zy(e,i,n)}function zy(e,t,i){if(i.button!=0)return!1;let n=of(e,t,!0),r=e.state.doc;return n?(Qn(e,n),n instanceof he&&r.eq(e.state.doc)&&(e.input.mouseDown=new Dy(e,n)),!0):!1}function of(e,t,i){let n=e.state.doc;if(t==-1)return n.inlineContent?he.create(n,0,n.content.size):null;let r=n.resolve(t);for(let a=r.depth+1;a>0;a--){let o=a>r.depth?r.nodeAfter:r.node(a),l=r.before(a);if(o.inlineContent)return he.create(n,l+1,l+1+o.content.size);if(i&&de.isSelectable(o))return de.create(n,l)}return null}function ks(e){return na(e)}const sf=Nt?"metaKey":"ctrlKey";Rt.mousedown=(e,t)=>{let i=t;e.input.shiftKey=i.shiftKey;let n=ks(e),r=Date.now(),a="singleClick";r-e.input.lastClick.time<500&&Ey(i,e.input.lastClick)&&!i[sf]&&e.input.lastClick.button==i.button&&(e.input.lastClick.type=="singleClick"?a="doubleClick":e.input.lastClick.type=="doubleClick"&&(a="tripleClick")),e.input.lastClick={time:r,x:i.clientX,y:i.clientY,type:a,button:i.button},e.input.mouseDown&&e.input.mouseDown.done();let o=e.posAtCoords(Zn(i));o&&(a=="singleClick"?e.input.mouseDown=new Iy(e,o,i,!!n):(a=="doubleClick"?Ty:My)(e,o.pos,o.inside,i)?i.preventDefault():ti(e,"pointer"))};class lf{constructor(t){this.view=t,this.mightDrag=null,t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(t){this.done()}move(t){t.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class Iy extends lf{constructor(t,i,n,r){super(t),this.pos=i,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=t.state.doc,this.selectNode=!!n[sf],this.allowDefault=n.shiftKey;let a,o;if(i.inside>-1)a=t.state.doc.nodeAt(i.inside),o=i.inside;else{let p=t.state.doc.resolve(i.pos);a=p.parent,o=p.depth?p.before():0}const l=r?null:n.target,c=l?t.docView.nearestDesc(l,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:f}=t.state;n.button==0&&(a.type.spec.draggable&&a.type.spec.selectable!==!1||f instanceof de&&f.from<=o&&f.to>o)&&(this.mightDrag={node:a,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Ha&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),ti(t,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||ys(this.view)})}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let i=this.pos;this.view.state.doc!=this.startDoc&&(i=this.view.posAtCoords(Zn(t))),this.updateAllowDefault(t),this.allowDefault||!i?ti(this.view,"pointer"):Oy(this.view,i.pos,i.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Wi&&this.mightDrag&&!this.mightDrag.node.isAtom||ni&&!this.view.state.selection.visible&&Math.min(Math.abs(i.pos-this.view.state.selection.from),Math.abs(i.pos-this.view.state.selection.to))<=2)?(Qn(this.view,ve.near(this.view.state.doc.resolve(i.pos))),t.preventDefault()):ti(this.view,"pointer")}move(t){this.updateAllowDefault(t),ti(this.view,"pointer"),super.move(t)}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class Dy extends lf{constructor(t,i){super(t),this.startSelection=i,this.startDoc=t.state.doc}move(t){if(t.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}t.preventDefault(),ti(this.view,"pointer");let i=this.view.posAtCoords(Zn(t)),n=i&&of(this.view,i.inside,!1);if(!n)return;let{doc:r}=this.view.state,a=this.startSelection,[o,l]=n.from<a.from?[a.to,n.from]:[a.from,n.to];Qn(this.view,he.create(r,o,l))}}Rt.touchstart=e=>{e.input.lastTouch=Date.now(),ks(e),ti(e,"pointer")};Rt.touchmove=e=>{e.input.lastTouch=Date.now(),ti(e,"pointer")};Rt.contextmenu=e=>ks(e);function cf(e,t){return e.composing?!0:Wi&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const Ry=Jn?5e3:-1;_t.compositionstart=_t.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,i=t.selection.$to;if(t.selection instanceof he&&(t.storedMarks||!i.textOffset&&i.parentOffset&&i.nodeBefore.marks.some(n=>n.type.spec.inclusive===!1)||ni&&Ku&&Ly(e)))e.markCursor=e.state.storedMarks||i.marks(),na(e,!0),e.markCursor=null;else if(na(e,!t.selection.empty),Ha&&t.selection.empty&&i.parentOffset&&!i.textOffset&&i.nodeBefore.marks.length){let n=e.domSelectionRange();for(let r=n.focusNode,a=n.focusOffset;r&&r.nodeType==1&&a!=0;){let o=a<0?r.lastChild:r.childNodes[a-1];if(!o)break;if(o.nodeType==3){let l=e.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else r=o,a=-1}}e.input.composing=!0}uf(e,Ry)};function Ly(e){let{focusNode:t,focusOffset:i}=e.domSelectionRange();if(!t||t.nodeType!=1||i>=t.childNodes.length)return!1;let n=t.childNodes[i];return n.nodeType==1&&n.contentEditable=="false"}_t.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,uf(e,20))};function uf(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>na(e),t))}function By(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function na(e,t=!1){if(!(Jn&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),By(e),t||e.docView&&e.docView.dirty){let i=ly(e),n=e.state.selection;return i&&!i.eq(n)?e.dispatch(e.state.tr.setSelection(i)):(e.markCursor||t)&&!n.$from.node(n.$from.sharedDepth(n.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function Py(e,t){if(!e.dom.parentNode)return;let i=e.dom.parentNode.appendChild(document.createElement("div"));i.appendChild(t),i.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),r=document.createRange();r.selectNodeContents(t),e.dom.blur(),n.removeAllRanges(),n.addRange(r),setTimeout(()=>{i.parentNode&&i.parentNode.removeChild(i),e.focus()},50)}const Hn=Xn&&Wu<15||gs&&sy<604;Rt.copy=_t.cut=(e,t)=>{let i=t,n=e.state.selection,r=i.type=="cut";if(n.empty)return;let a=Hn?null:i.clipboardData,o=n.content(),{dom:l,text:c}=Qu(e,o);a?(i.preventDefault(),a.clearData(),a.setData("text/html",l.innerHTML),a.setData("text/plain",c)):Py(e,l),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Vy(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function Fy(e,t){if(!e.dom.parentNode)return;let i=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,n=e.dom.parentNode.appendChild(document.createElement(i?"textarea":"div"));i||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let r=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),n.parentNode&&n.parentNode.removeChild(n),i?Ho(e,n.value,null,r,t):Ho(e,n.textContent,n.innerHTML,r,t)},50)}function Ho(e,t,i,n,r){let a=Yu(e,t,i,n,e.state.selection.$from);if(e.someProp("handlePaste",c=>c(e,r,a||ae.empty)))return!0;if(!a)return!1;let o=Vy(a),l=o?e.state.tr.replaceSelectionWith(o,n):e.state.tr.replaceSelection(a);return e.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function ff(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let i=e.getData("text/uri-list");return i?i.replace(/\r?\n/g," "):""}_t.paste=(e,t)=>{let i=t;if(e.composing&&!Jn)return;let n=Hn?null:i.clipboardData,r=e.input.shiftKey&&e.input.lastKeyCode!=45;n&&Ho(e,ff(n),n.getData("text/html"),r,i)?i.preventDefault():Fy(e,i)};class Uy{constructor(t,i,n){this.slice=t,this.move=i,this.node=n}}const Hy=Nt?"altKey":"ctrlKey";function pf(e,t){let i;return e.someProp("dragCopies",n=>{i=i||n(t)}),i!=null?!i:!t[Hy]}Rt.dragstart=(e,t)=>{let i=t,n=e.input.mouseDown;if(n&&n.done(),!i.dataTransfer)return;let r=e.state.selection,a=r.empty?null:e.posAtCoords(Zn(i)),o;if(!(a&&a.pos>=r.from&&a.pos<=(r instanceof de?r.to-1:r.to))){if(n&&n.mightDrag)o=de.create(e.state.doc,n.mightDrag.pos);else if(i.target&&i.target.nodeType==1){let m=e.docView.nearestDesc(i.target,!0);m&&m.node.type.spec.draggable&&m!=e.docView&&(o=de.create(e.state.doc,m.posBefore))}}let l=(o||e.state.selection).content(),{dom:c,text:f,slice:p}=Qu(e,l);(!i.dataTransfer.files.length||!ni||Gu>120)&&i.dataTransfer.clearData(),i.dataTransfer.setData(Hn?"Text":"text/html",c.innerHTML),i.dataTransfer.effectAllowed="copyMove",Hn||i.dataTransfer.setData("text/plain",f),e.dragging=new Uy(p,pf(e,i),o)};Rt.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};_t.dragover=_t.dragenter=(e,t)=>t.preventDefault();_t.drop=(e,t)=>{try{jy(e,t,e.dragging)}finally{e.dragging=null}};function jy(e,t,i){if(!t.dataTransfer)return;let n=e.posAtCoords(Zn(t));if(!n)return;let r=e.state.doc.resolve(n.pos),a=i&&i.slice;a?e.someProp("transformPasted",h=>{a=h(a,e,!1)}):a=Yu(e,ff(t.dataTransfer),Hn?null:t.dataTransfer.getData("text/html"),!1,r);let o=!!(i&&pf(e,t));if(e.someProp("handleDrop",h=>h(e,t,a||ae.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let l=a?Zv(e.state.doc,r.pos,a):r.pos;l==null&&(l=r.pos);let c=e.state.tr;if(o){let{node:h}=i;h?h.replace(c):c.deleteSelection()}let f=c.mapping.map(l),p=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,m=c.doc;if(p?c.replaceRangeWith(f,f,a.content.firstChild):c.replaceRange(f,f,a),c.doc.eq(m))return;let d=c.doc.resolve(f);if(p&&de.isSelectable(a.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(a.content.firstChild))c.setSelection(new de(d));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((v,b,y,g)=>h=g),c.setSelection(Ju(e,d,c.doc.resolve(h)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))}Rt.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&ys(e)},20))};Rt.blur=(e,t)=>{let i=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),i.relatedTarget&&e.dom.contains(i.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};Rt.beforeinput=(e,t)=>{if(ni&&Jn&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:n}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=n||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",a=>a(e,qu(8,"Backspace")))))return;let{$cursor:r}=e.state.selection;r&&r.pos>0&&e.dispatch(e.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let e in _t)Rt[e]=_t[e];function jn(e,t){if(e==t)return!0;for(let i in e)if(e[i]!==t[i])return!1;for(let i in t)if(!(i in e))return!1;return!0}class ra{constructor(t,i){this.toDOM=t,this.spec=i||Vi,this.side=this.spec.side||0}map(t,i,n,r){let{pos:a,deleted:o}=t.mapResult(i.from+r,this.side<0?-1:1);return o?null:new tt(a-n,a-n,this)}valid(){return!0}eq(t){return this==t||t instanceof ra&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&jn(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class vi{constructor(t,i){this.attrs=t,this.spec=i||Vi}map(t,i,n,r){let a=t.map(i.from+r,this.spec.inclusiveStart?-1:1)-n,o=t.map(i.to+r,this.spec.inclusiveEnd?1:-1)-n;return a>=o?null:new tt(a,o,this)}valid(t,i){return i.from<i.to}eq(t){return this==t||t instanceof vi&&jn(this.attrs,t.attrs)&&jn(this.spec,t.spec)}static is(t){return t.type instanceof vi}destroy(){}}class ws{constructor(t,i){this.attrs=t,this.spec=i||Vi}map(t,i,n,r){let a=t.mapResult(i.from+r,1);if(a.deleted)return null;let o=t.mapResult(i.to+r,-1);return o.deleted||o.pos<=a.pos?null:new tt(a.pos-n,o.pos-n,this)}valid(t,i){let{index:n,offset:r}=t.content.findIndex(i.from),a;return r==i.from&&!(a=t.child(n)).isText&&r+a.nodeSize==i.to}eq(t){return this==t||t instanceof ws&&jn(this.attrs,t.attrs)&&jn(this.spec,t.spec)}destroy(){}}class tt{constructor(t,i,n){this.from=t,this.to=i,this.type=n}copy(t,i){return new tt(t,i,this.type)}eq(t,i=0){return this.type.eq(t.type)&&this.from+i==t.from&&this.to+i==t.to}map(t,i,n){return this.type.map(t,this,i,n)}static widget(t,i,n){return new tt(t,t,new ra(i,n))}static inline(t,i,n,r){return new tt(t,i,new vi(n,r))}static node(t,i,n,r){return new tt(t,i,new ws(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof vi}get widget(){return this.type instanceof ra}}const rn=[],Vi={};class Be{constructor(t,i){this.local=t.length?t:rn,this.children=i.length?i:rn}static create(t,i){return i.length?aa(i,t,0,Vi):ut}find(t,i,n){let r=[];return this.findInner(t??0,i??1e9,r,0,n),r}findInner(t,i,n,r,a){for(let o=0;o<this.local.length;o++){let l=this.local[o];l.from<=i&&l.to>=t&&(!a||a(l.spec))&&n.push(l.copy(l.from+r,l.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<i&&this.children[o+1]>t){let l=this.children[o]+1;this.children[o+2].findInner(t-l,i-l,n,r+l,a)}}map(t,i,n){return this==ut||t.maps.length==0?this:this.mapInner(t,i,0,0,n||Vi)}mapInner(t,i,n,r,a){let o;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(t,n,r);c&&c.type.valid(i,c)?(o||(o=[])).push(c):a.onRemove&&a.onRemove(this.local[l].spec)}return this.children.length?qy(this.children,o||[],t,i,n,r,a):o?new Be(o.sort(Fi),rn):ut}add(t,i){return i.length?this==ut?Be.create(t,i):this.addInner(t,i,0):this}addInner(t,i,n){let r,a=0;t.forEach((l,c)=>{let f=c+n,p;if(p=mf(i,l,f)){for(r||(r=this.children.slice());a<r.length&&r[a]<c;)a+=3;r[a]==c?r[a+2]=r[a+2].addInner(l,p,f+1):r.splice(a,0,c,c+l.nodeSize,aa(p,l,f+1,Vi)),a+=3}});let o=df(a?hf(i):i,-n);for(let l=0;l<o.length;l++)o[l].type.valid(t,o[l])||o.splice(l--,1);return new Be(o.length?this.local.concat(o).sort(Fi):this.local,r||this.children)}remove(t){return t.length==0||this==ut?this:this.removeInner(t,0)}removeInner(t,i){let n=this.children,r=this.local;for(let a=0;a<n.length;a+=3){let o,l=n[a]+i,c=n[a+1]+i;for(let p=0,m;p<t.length;p++)(m=t[p])&&m.from>l&&m.to<c&&(t[p]=null,(o||(o=[])).push(m));if(!o)continue;n==this.children&&(n=this.children.slice());let f=n[a+2].removeInner(o,l+1);f!=ut?n[a+2]=f:(n.splice(a,3),a-=3)}if(r.length){for(let a=0,o;a<t.length;a++)if(o=t[a])for(let l=0;l<r.length;l++)r[l].eq(o,i)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return n==this.children&&r==this.local?this:r.length||n.length?new Be(r,n):ut}forChild(t,i){if(this==ut)return this;if(i.isLeaf)return Be.empty;let n,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=t){this.children[l]==t&&(n=this.children[l+2]);break}let a=t+1,o=a+i.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<o&&c.to>a&&c.type instanceof vi){let f=Math.max(a,c.from)-a,p=Math.min(o,c.to)-a;f<p&&(r||(r=[])).push(c.copy(f,p))}}if(r){let l=new Be(r.sort(Fi),rn);return n?new zi([l,n]):l}return n||ut}eq(t){if(this==t)return!0;if(!(t instanceof Be)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let i=0;i<this.local.length;i++)if(!this.local[i].eq(t.local[i]))return!1;for(let i=0;i<this.children.length;i+=3)if(this.children[i]!=t.children[i]||this.children[i+1]!=t.children[i+1]||!this.children[i+2].eq(t.children[i+2]))return!1;return!0}locals(t){return _s(this.localsInner(t))}localsInner(t){if(this==ut)return rn;if(t.inlineContent||!this.local.some(vi.is))return this.local;let i=[];for(let n=0;n<this.local.length;n++)this.local[n].type instanceof vi||i.push(this.local[n]);return i}forEachSet(t){t(this)}}Be.empty=new Be([],[]);Be.removeOverlap=_s;const ut=Be.empty;class zi{constructor(t){this.members=t}map(t,i){const n=this.members.map(r=>r.map(t,i,Vi));return zi.from(n)}forChild(t,i){if(i.isLeaf)return Be.empty;let n=[];for(let r=0;r<this.members.length;r++){let a=this.members[r].forChild(t,i);a!=ut&&(a instanceof zi?n=n.concat(a.members):n.push(a))}return zi.from(n)}eq(t){if(!(t instanceof zi)||t.members.length!=this.members.length)return!1;for(let i=0;i<this.members.length;i++)if(!this.members[i].eq(t.members[i]))return!1;return!0}locals(t){let i,n=!0;for(let r=0;r<this.members.length;r++){let a=this.members[r].localsInner(t);if(a.length)if(!i)i=a;else{n&&(i=i.slice(),n=!1);for(let o=0;o<a.length;o++)i.push(a[o])}}return i?_s(n?i:i.sort(Fi)):rn}static from(t){switch(t.length){case 0:return ut;case 1:return t[0];default:return new zi(t.every(i=>i instanceof Be)?t:t.reduce((i,n)=>i.concat(n instanceof Be?n:n.members),[]))}}forEachSet(t){for(let i=0;i<this.members.length;i++)this.members[i].forEachSet(t)}}function qy(e,t,i,n,r,a,o){let l=e.slice();for(let f=0,p=a;f<i.maps.length;f++){let m=0;i.maps[f].forEach((d,h,v,b)=>{let y=b-v-(h-d);for(let g=0;g<l.length;g+=3){let x=l[g+1];if(x<0||d>x+p-m)continue;let k=l[g]+p-m;h>=k?l[g+1]=d<=k?-2:-1:d>=p&&y&&(l[g]+=y,l[g+1]+=y)}m+=y}),p=i.maps[f].map(p,-1)}let c=!1;for(let f=0;f<l.length;f+=3)if(l[f+1]<0){if(l[f+1]==-2){c=!0,l[f+1]=-1;continue}let p=i.map(e[f]+a),m=p-r;if(m<0||m>=n.content.size){c=!0;continue}let d=i.map(e[f+1]+a,-1),h=d-r,{index:v,offset:b}=n.content.findIndex(m),y=n.maybeChild(v);if(y&&b==m&&b+y.nodeSize==h){let g=l[f+2].mapInner(i,y,p+1,e[f]+a+1,o);g!=ut?(l[f]=m,l[f+1]=h,l[f+2]=g):(l[f+1]=-2,c=!0)}else c=!0}if(c){let f=$y(l,e,t,i,r,a,o),p=aa(f,n,0,o);t=p.local;for(let m=0;m<l.length;m+=3)l[m+1]<0&&(l.splice(m,3),m-=3);for(let m=0,d=0;m<p.children.length;m+=3){let h=p.children[m];for(;d<l.length&&l[d]<h;)d+=3;l.splice(d,0,p.children[m],p.children[m+1],p.children[m+2])}}return new Be(t.sort(Fi),l)}function df(e,t){if(!t||!e.length)return e;let i=[];for(let n=0;n<e.length;n++){let r=e[n];i.push(new tt(r.from+t,r.to+t,r.type))}return i}function $y(e,t,i,n,r,a,o){function l(c,f){for(let p=0;p<c.local.length;p++){let m=c.local[p].map(n,r,f);m?i.push(m):o.onRemove&&o.onRemove(c.local[p].spec)}for(let p=0;p<c.children.length;p+=3)l(c.children[p+2],c.children[p]+f+1)}for(let c=0;c<e.length;c+=3)e[c+1]==-1&&l(e[c+2],t[c]+a+1);return i}function mf(e,t,i){if(t.isLeaf)return null;let n=i+t.nodeSize,r=null;for(let a=0,o;a<e.length;a++)(o=e[a])&&o.from>i&&o.to<n&&((r||(r=[])).push(o),e[a]=null);return r}function hf(e){let t=[];for(let i=0;i<e.length;i++)e[i]!=null&&t.push(e[i]);return t}function aa(e,t,i,n){let r=[],a=!1;t.forEach((l,c)=>{let f=mf(e,l,c+i);if(f){a=!0;let p=aa(f,l,i+c+1,n);p!=ut&&r.push(c,c+l.nodeSize,p)}});let o=df(a?hf(e):e,-i).sort(Fi);for(let l=0;l<o.length;l++)o[l].type.valid(t,o[l])||(n.onRemove&&n.onRemove(o[l].spec),o.splice(l--,1));return o.length||r.length?new Be(o,r):ut}function Fi(e,t){return e.from-t.from||e.to-t.to}function _s(e){let t=e;for(let i=0;i<t.length-1;i++){let n=t[i];if(n.from!=n.to)for(let r=i+1;r<t.length;r++){let a=t[r];if(a.from==n.from){a.to!=n.to&&(t==e&&(t=e.slice()),t[r]=a.copy(a.from,n.to),Jl(t,r+1,a.copy(n.to,a.to)));continue}else{a.from<n.to&&(t==e&&(t=e.slice()),t[i]=n.copy(n.from,a.from),Jl(t,r,n.copy(a.from,n.to)));break}}}return t}function Jl(e,t,i){for(;t<e.length&&Fi(i,e[t])>0;)t++;e.splice(t,0,i)}var yi={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},oa={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Wy=typeof navigator<"u"&&/Mac/.test(navigator.platform),Gy=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ye=0;Ye<10;Ye++)yi[48+Ye]=yi[96+Ye]=String(Ye);for(var Ye=1;Ye<=24;Ye++)yi[Ye+111]="F"+Ye;for(var Ye=65;Ye<=90;Ye++)yi[Ye]=String.fromCharCode(Ye+32),oa[Ye]=String.fromCharCode(Ye);for(var co in yi)oa.hasOwnProperty(co)||(oa[co]=yi[co]);function Ky(e){var t=Wy&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Gy&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",i=!t&&e.key||(e.shiftKey?oa:yi)[e.keyCode]||e.key||"Unidentified";return i=="Esc"&&(i="Escape"),i=="Del"&&(i="Delete"),i=="Left"&&(i="ArrowLeft"),i=="Up"&&(i="ArrowUp"),i=="Right"&&(i="ArrowRight"),i=="Down"&&(i="ArrowDown"),i}const Xy=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Jy=typeof navigator<"u"&&/Win/.test(navigator.platform);function Zy(e){let t=e.split(/-(?!$)/),i=t[t.length-1];i=="Space"&&(i=" ");let n,r,a,o;for(let l=0;l<t.length-1;l++){let c=t[l];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))n=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))a=!0;else if(/^mod$/i.test(c))Xy?o=!0:r=!0;else throw new Error("Unrecognized modifier name: "+c)}return n&&(i="Alt-"+i),r&&(i="Ctrl-"+i),o&&(i="Meta-"+i),a&&(i="Shift-"+i),i}function Qy(e){let t=Object.create(null);for(let i in e)t[Zy(i)]=e[i];return t}function uo(e,t,i=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),i&&t.shiftKey&&(e="Shift-"+e),e}function Yy(e){let t=Qy(e);return function(i,n){let r=Ky(n),a,o=t[uo(r,n)];if(o&&o(i.state,i.dispatch,i))return!0;if(r.length==1&&r!=" "){if(n.shiftKey){let l=t[uo(r,n,!1)];if(l&&l(i.state,i.dispatch,i))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(Jy&&n.ctrlKey&&n.altKey)&&(a=yi[n.keyCode])&&a!=r){let l=t[uo(a,n)];if(l&&l(i.state,i.dispatch,i))return!0}}return!1}}const Ss=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function bf(e,t){let{$cursor:i}=e.selection;return!i||(t?!t.endOfTextblock("backward",e):i.parentOffset>0)?null:i}const gf=(e,t,i)=>{let n=bf(e,i);if(!n)return!1;let r=Cs(n);if(!r){let o=n.blockRange(),l=o&&pn(o);return l==null?!1:(t&&t(e.tr.lift(o,l).scrollIntoView()),!0)}let a=r.nodeBefore;if(Ef(e,r,t,-1))return!0;if(n.parent.content.size==0&&(un(a,"end")||de.isSelectable(a)))for(let o=n.depth;;o--){let l=Fa(e.doc,n.before(o),n.after(o),ae.empty);if(l&&l.slice.size<l.to-l.from){if(t){let c=e.tr.step(l);c.setSelection(un(a,"end")?ve.findFrom(c.doc.resolve(c.mapping.map(r.pos,-1)),-1):de.create(c.doc,r.pos-a.nodeSize)),t(c.scrollIntoView())}return!0}if(o==1||n.node(o-1).childCount>1)break}return a.isAtom&&r.depth==n.depth-1?(t&&t(e.tr.delete(r.pos-a.nodeSize,r.pos).scrollIntoView()),!0):!1},ex=(e,t,i)=>{let n=bf(e,i);if(!n)return!1;let r=Cs(n);return r?vf(e,r,t):!1},tx=(e,t,i)=>{let n=xf(e,i);if(!n)return!1;let r=Es(n);return r?vf(e,r,t):!1};function vf(e,t,i){let n=t.nodeBefore,r=n,a=t.pos-1;for(;!r.isTextblock;a--){if(r.type.spec.isolating)return!1;let p=r.lastChild;if(!p)return!1;r=p}let o=t.nodeAfter,l=o,c=t.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let p=l.firstChild;if(!p)return!1;l=p}let f=Fa(e.doc,a,c,ae.empty);if(!f||f.from!=a||f instanceof He&&f.slice.size>=c-a)return!1;if(i){let p=e.tr.step(f);p.setSelection(he.create(p.doc,a)),i(p.scrollIntoView())}return!0}function un(e,t,i=!1){for(let n=e;n;n=t=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(i&&n.childCount!=1)return!1}return!1}const yf=(e,t,i)=>{let{$head:n,empty:r}=e.selection,a=n;if(!r)return!1;if(n.parent.isTextblock){if(i?!i.endOfTextblock("backward",e):n.parentOffset>0)return!1;a=Cs(n)}let o=a&&a.nodeBefore;return!o||!de.isSelectable(o)?!1:(t&&t(e.tr.setSelection(de.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function Cs(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function xf(e,t){let{$cursor:i}=e.selection;return!i||(t?!t.endOfTextblock("forward",e):i.parentOffset<i.parent.content.size)?null:i}const kf=(e,t,i)=>{let n=xf(e,i);if(!n)return!1;let r=Es(n);if(!r)return!1;let a=r.nodeAfter;if(Ef(e,r,t,1))return!0;if(n.parent.content.size==0&&(un(a,"start")||de.isSelectable(a))){let o=Fa(e.doc,n.before(),n.after(),ae.empty);if(o&&o.slice.size<o.to-o.from){if(t){let l=e.tr.step(o);l.setSelection(un(a,"start")?ve.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):de.create(l.doc,l.mapping.map(r.pos))),t(l.scrollIntoView())}return!0}}return a.isAtom&&r.depth==n.depth-1?(t&&t(e.tr.delete(r.pos,r.pos+a.nodeSize).scrollIntoView()),!0):!1},wf=(e,t,i)=>{let{$head:n,empty:r}=e.selection,a=n;if(!r)return!1;if(n.parent.isTextblock){if(i?!i.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)return!1;a=Es(n)}let o=a&&a.nodeAfter;return!o||!de.isSelectable(o)?!1:(t&&t(e.tr.setSelection(de.create(e.doc,a.pos)).scrollIntoView()),!0)};function Es(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let i=e.node(t);if(e.index(t)+1<i.childCount)return e.doc.resolve(e.after(t+1));if(i.type.spec.isolating)break}return null}const ix=(e,t)=>{let i=e.selection,n=i instanceof de,r;if(n){if(i.node.isTextblock||!ki(e.doc,i.from))return!1;r=i.from}else if(r=Va(e.doc,i.from,-1),r==null)return!1;if(t){let a=e.tr.join(r);n&&a.setSelection(de.create(a.doc,r-e.doc.resolve(r).nodeBefore.nodeSize)),t(a.scrollIntoView())}return!0},nx=(e,t)=>{let i=e.selection,n;if(i instanceof de){if(i.node.isTextblock||!ki(e.doc,i.to))return!1;n=i.to}else if(n=Va(e.doc,i.to,1),n==null)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0},rx=(e,t)=>{let{$from:i,$to:n}=e.selection,r=i.blockRange(n),a=r&&pn(r);return a==null?!1:(t&&t(e.tr.lift(r,a).scrollIntoView()),!0)},_f=(e,t)=>{let{$head:i,$anchor:n}=e.selection;return!i.parent.type.spec.code||!i.sameParent(n)?!1:(t&&t(e.tr.insertText(`
@@ -15042,18 +15042,18 @@
15042
15042
  </terms>
15043
15043
  </locale>
15044
15044
  `,l1=s1,Nr={"chicago-notes-bibliography":{id:"chicago-notes-bibliography",name:"Chicago (notes & bibliography)",category:"note",xml:e1},"chicago-author-date":{id:"chicago-author-date",name:"Chicago (author-date)",category:"in-text",xml:i1},apa:{id:"apa",name:"APA",category:"in-text",xml:r1},"modern-language-association":{id:"modern-language-association",name:"MLA",category:"in-text",xml:o1}},c1="chicago-notes-bibliography",u1=l1,nc=0;function Lf(){return nc+=1,`cite-${Date.now().toString(36)}-${nc.toString(36)}`}var f1=/^<\/?(i|b|em|strong|sup|sub|span|nobr)( style="font-variant: ?small-caps;?")?\/?>$|^<div class="csl-entry">$|^<\/div>$/;function rc(e){return e.replace(/<[^>]*>/g,t=>f1.test(t)?t:t.replace(/</g,"&lt;").replace(/>/g,"&gt;"))}var p1=class{constructor(e={}){Xt(this,"sources",new Map);Xt(this,"style");Xt(this,"clusters",new Map);Xt(this,"order",[]);Xt(this,"rendered",new Map);Xt(this,"bibliography",[]);Xt(this,"listeners",new Set);Xt(this,"lastSignature","");this.style=e.style&&Nr[e.style]?e.style:c1,this.updateSources(e.sources??[],!1)}getStyle(){return this.style}isNoteStyle(){var e;return((e=Nr[this.style])==null?void 0:e.category)==="note"}getSource(e){return this.sources.get(e)}getSourceIds(){return[...this.sources.keys()]}getCitedSourceIds(){const e=new Set;for(const t of this.clusters.values())t.sourceId&&e.add(t.sourceId);return[...e]}setStyle(e){!Nr[e]||e===this.style||(this.style=e,this.recompute(),this.emitChange())}updateSources(e,t=!0){this.sources=new Map(e.map(i=>[i.id,i])),this.recompute(),t&&this.emitChange()}onChange(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}syncCitations(e){const t=e.map(i=>{const n=i.attrs;return`${i.citationId}|${n.sourceId??""}|${n.locator??""}|${n.label??""}|${n.mode??""}|${n.prefix??""}|${n.suffix??""}`}).join(`
15045
- `);return t===this.lastSignature?!1:(this.lastSignature=t,this.clusters=new Map(e.map(i=>[i.citationId,i.attrs])),this.order=e.map(i=>i.citationId),this.recompute(),this.emitChange(),!0)}renderCluster(e){return this.rendered.get(e)??""}getBibliography(){return this.bibliography}emitChange(){for(const e of this.listeners)e()}recompute(){const e=Nr[this.style],t=new Dv.Engine({retrieveLocale:()=>u1,retrieveItem:a=>this.sources.get(a)},e.xml,"en-US"),i=new Map,n=[];let r=0;for(const a of this.order){const o=this.clusters.get(a);if(!(o!=null&&o.sourceId)||!this.sources.has(o.sourceId)){i.set(a,"");continue}r+=1;try{const[,l]=t.processCitationCluster({citationID:a,citationItems:[{id:o.sourceId,locator:o.locator||void 0,label:o.label||void 0,prefix:o.prefix||void 0,suffix:o.suffix||void 0,"suppress-author":o.mode==="suppress-author"||void 0,"author-only":o.mode==="author-only"||void 0}],properties:{noteIndex:e.category==="note"?r:0}},n,[]);n.push([a,r]);for(const[,c,f]of l??[])i.set(f,rc(c));i.has(a)||i.set(a,"")}catch{i.set(a,"")}}this.rendered=i;try{const a=t.makeBibliography();this.bibliography=a?a[1].map(o=>rc(o).trim()):[]}catch{this.bibliography=[]}}};function ac(e){const t=e.storage.citation;return(t==null?void 0:t.engine)??null}var d1=vt.create({name:"bibliography",group:"block",selectable:!0,draggable:!0,atom:!0,parseHTML(){return[{tag:'div[data-node-type="bibliography"]'}]},renderHTML({HTMLAttributes:e}){return["div",Fe(e,{"data-node-type":"bibliography",class:"docs-bibliography"})]},addNodeView(){return e=>{const t=e.editor,i=document.createElement("div");i.className="docs-bibliography",i.setAttribute("data-node-type","bibliography");const n=()=>{const o=ac(t),l=(o==null?void 0:o.getBibliography())??[];if(i.innerHTML="",l.length===0){const p=document.createElement("p");p.className="docs-bibliography__empty",p.textContent="Bibliography",i.appendChild(p);return}const c=document.createElement("h2");c.className="docs-bibliography__heading",c.textContent="Bibliography",i.appendChild(c);const f=document.createElement("div");f.className="docs-bibliography__entries";for(const p of l){const m=document.createElement("p");m.className="docs-bibliography__entry",m.innerHTML=p,f.appendChild(m)}i.appendChild(f)};n();const r=ac(t),a=r==null?void 0:r.onChange(n);return{dom:i,update(o){var l;return((l=o==null?void 0:o.type)==null?void 0:l.name)==="bibliography"},destroy(){a==null||a()}}}}});function Bf(e,t){const i=Lf();return e.isNoteStyle()?{type:"footnote",attrs:{content:"",sourceId:t.sourceId,locator:t.locator??"",citationId:i}}:{type:"citation",attrs:{citationId:i,sourceId:t.sourceId,locator:t.locator??""}}}function fn(e){return e.storage.citation?e.storage.citation.engine??null:null}var m1=Ke.create({name:"citation",addStorage(){return{engine:null}},onUpdate(){var r,a;const e=this.editor,t=fn(e);if(!t)return;{const o=new Set,l=[];if(e.state.doc.descendants((c,f)=>{if(c.type.name==="citation"||c.type.name==="footnote"&&c.attrs.sourceId){const p=c.attrs.citationId;p&&(o.has(p)?l.push({pos:f,attrs:{...c.attrs}}):o.add(p))}return!0}),l.length>0){const c=e.state.tr;for(const{pos:f,attrs:p}of l)c.setNodeMarkup(f,void 0,{...p,citationId:Lf()});e.view.dispatch(c);return}}const i=[];if(e.state.doc.descendants((o,l)=>((o.type.name==="citation"||o.type.name==="footnote"&&o.attrs.sourceId)&&i.push({citationId:o.attrs.citationId??`anon-${l}`,attrs:{sourceId:o.attrs.sourceId??null,locator:o.attrs.locator||"",label:o.attrs.label||"page",mode:o.attrs.mode||"normal",prefix:o.attrs.prefix||"",suffix:o.attrs.suffix||""}}),!0)),t.syncCitations(i)){const o=e.storage.editorContext;(a=(r=o==null?void 0:o.citation)==null?void 0:r.onSourcesChange)==null||a.call(r,t.getCitedSourceIds())}}}),h1=vt.create({name:"citation",group:"inline",inline:!0,selectable:!0,draggable:!1,atom:!0,addAttributes(){return{citationId:{default:null,parseHTML:e=>e.getAttribute("data-citation-id"),renderHTML:e=>({"data-citation-id":e.citationId})},sourceId:{default:null,parseHTML:e=>e.getAttribute("data-citation-source-id"),renderHTML:e=>({"data-citation-source-id":e.sourceId})},locator:{default:"",parseHTML:e=>e.getAttribute("data-citation-locator")??"",renderHTML:e=>({"data-citation-locator":e.locator})},label:{default:"page",parseHTML:e=>e.getAttribute("data-citation-label")??"page",renderHTML:e=>({"data-citation-label":e.label})},mode:{default:"normal",parseHTML:e=>e.getAttribute("data-citation-mode")??"normal",renderHTML:e=>({"data-citation-mode":e.mode})},prefix:{default:""},suffix:{default:""}}},parseHTML(){return[{tag:'span[data-node-type="citation"]'}]},renderHTML({HTMLAttributes:e}){return["span",Fe(e,{"data-node-type":"citation",class:"docs-citation"}),""]},addNodeView(){return e=>{const t=e.editor,i=e.node??e,n=document.createElement("span");n.className="docs-citation",n.setAttribute("data-node-type","citation");const r=()=>{const l=fn(t),c=i.attrs.citationId,f=l&&c?l.renderCluster(c):"";f?(n.innerHTML=f,n.classList.remove("docs-citation--missing")):(n.textContent="[?]",n.classList.add("docs-citation--missing")),n.setAttribute("data-citation-id",String(i.attrs.citationId??"")),n.setAttribute("data-citation-source-id",String(i.attrs.sourceId??""))};r();const a=fn(t),o=a==null?void 0:a.onChange(r);return{dom:n,update(l){var c;if(((c=l==null?void 0:l.type)==null?void 0:c.name)!=="citation")return!1;try{Object.assign(i.attrs,l.attrs),r()}catch{}return!0},destroy(){o==null||o()}}}}});function oc(e,t,i){const n=Bf(t,i);return n.type==="footnote"&&!e.schema.nodes.footnote?!1:e.chain().focus().insertContent({type:n.type,attrs:n.attrs}).run()}_e.definePlugin({id:"citation",tiptapExtensions:[m1,h1,d1],toolbar:[{id:"insert-citation",label:"Citation",action:"insertCitation",iconComponent:"Quote"}],slashCommands:[{name:"Citation",command:"insertCitation"},{name:"Bibliography",command:"insertBibliography"}],commands:{insertCitation:(e,...t)=>{var o;const i=fn(e);if(!i)return console.warn("[citation] no citation engine — inject the CitationPort to enable citations"),!1;const n=t[0];if(n!=null&&n.sourceId)return oc(e,i,{sourceId:n.sourceId,locator:n.locator});const r=e.storage.editorContext,a=(o=r==null?void 0:r.citation)==null?void 0:o.onSourceRequest;return a?(a().then(l=>{l&&oc(e,i,{sourceId:l})}),!0):!1},insertBibliography:e=>{let t=!1;return e.state.doc.descendants(i=>(i.type.name==="bibliography"&&(t=!0),!t)),t?!1:e.chain().focus().insertContent({type:"bibliography"}).run()},setCitationStyle:(e,...t)=>{const i=fn(e),n=t[0];return!i||!n?!1:(i.setStyle(n),!0)}},hooks:{onInit(e){const t=e.storage.editorContext,i=t==null?void 0:t.citation;if(!i)return;const n=typeof i.sources=="function"?i.sources():i.sources,r=new p1({sources:n,style:i.style});e.storage.citation.engine=r},onDestroy(e){e.storage.citation.engine=null}}});const b1=xi.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",Fe(this.options.HTMLAttributes,e),0]},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),g1=vt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",Fe(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),v1=/^\s*(\[([( |x])?\])\s$/,y1=vt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return t===""||t==="true"},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",Fe(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:i,editor:n})=>{const r=document.createElement("li"),a=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div"),f=()=>{var p,m;l.ariaLabel=((m=(p=this.options.a11y)===null||p===void 0?void 0:p.checkboxLabel)===null||m===void 0?void 0:m.call(p,e,l.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};return f(),a.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",p=>p.preventDefault()),l.addEventListener("change",p=>{if(!n.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:m}=p.target;n.isEditable&&typeof i=="function"&&n.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:d})=>{const h=i();if(typeof h!="number")return!1;const v=d.doc.nodeAt(h);return d.setNodeMarkup(h,void 0,{...v==null?void 0:v.attrs,checked:m}),!0}).run(),!n.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,m)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([p,m])=>{r.setAttribute(p,m)}),r.dataset.checked=e.attrs.checked,l.checked=e.attrs.checked,a.append(l,o),r.append(a,c),Object.entries(t).forEach(([p,m])=>{r.setAttribute(p,m)}),{dom:r,contentDOM:c,update:p=>p.type!==this.type?!1:(r.dataset.checked=p.attrs.checked,l.checked=p.attrs.checked,f(),!0)}}},addInputRules(){return[Q0({find:v1,type:this.type,getAttributes:e=>({checked:e[e.length-1]==="x"})})]}}),x1=Ke.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(i=>t.updateAttributes(i,{textAlign:e})).every(i=>i):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).every(t=>t),toggleTextAlign:e=>({editor:t,commands:i})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?i.unsetTextAlign():i.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),k1="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",w1="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",qo="numeric",$o="ascii",Wo="alpha",zn="asciinumeric",An="alphanumeric",Go="domain",Pf="emoji",_1="scheme",S1="slashscheme",mo="whitespace";function C1(e,t){return e in t||(t[e]=[]),t[e]}function Di(e,t,i){t[qo]&&(t[zn]=!0,t[An]=!0),t[$o]&&(t[zn]=!0,t[Wo]=!0),t[zn]&&(t[An]=!0),t[Wo]&&(t[An]=!0),t[An]&&(t[Go]=!0),t[Pf]&&(t[Go]=!0);for(const n in t){const r=C1(n,i);r.indexOf(e)<0&&r.push(e)}}function E1(e,t){const i={};for(const n in t)t[n].indexOf(e)>=0&&(i[n]=!0);return i}function gt(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}gt.groups={};gt.prototype={accepts(){return!!this.t},go(e){const t=this,i=t.j[e];if(i)return i;for(let n=0;n<t.jr.length;n++){const r=t.jr[n][0],a=t.jr[n][1];if(a&&r.test(e))return a}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,i,n){for(let r=0;r<e.length;r++)this.tt(e[r],t,i,n)},tr(e,t,i,n){n=n||gt.groups;let r;return t&&t.j?r=t:(r=new gt(t),i&&n&&Di(t,i,n)),this.jr.push([e,r]),r},ts(e,t,i,n){let r=this;const a=e.length;if(!a)return r;for(let o=0;o<a-1;o++)r=r.tt(e[o]);return r.tt(e[a-1],t,i,n)},tt(e,t,i,n){n=n||gt.groups;const r=this;if(t&&t.j)return r.j[e]=t,t;const a=t;let o,l=r.go(e);if(l?(o=new gt,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new gt,a){if(n)if(o.t&&typeof o.t=="string"){const c=Object.assign(E1(o.t,n),i);Di(a,c,n)}else i&&Di(a,i,n);o.t=a}return r.j[e]=o,o}};const ye=(e,t,i,n,r)=>e.ta(t,i,n,r),Pe=(e,t,i,n,r)=>e.tr(t,i,n,r),sc=(e,t,i,n,r)=>e.ts(t,i,n,r),Y=(e,t,i,n,r)=>e.tt(t,i,n,r),Qt="WORD",Ko="UWORD",Vf="ASCIINUMERICAL",Ff="ALPHANUMERICAL",$n="LOCALHOST",Xo="TLD",Jo="UTLD",Ur="SCHEME",an="SLASH_SCHEME",Ls="NUM",Zo="WS",Bs="NL",In="OPENBRACE",Dn="CLOSEBRACE",ca="OPENBRACKET",ua="CLOSEBRACKET",fa="OPENPAREN",pa="CLOSEPAREN",da="OPENANGLEBRACKET",ma="CLOSEANGLEBRACKET",ha="FULLWIDTHLEFTPAREN",ba="FULLWIDTHRIGHTPAREN",ga="LEFTCORNERBRACKET",va="RIGHTCORNERBRACKET",ya="LEFTWHITECORNERBRACKET",xa="RIGHTWHITECORNERBRACKET",ka="FULLWIDTHLESSTHAN",wa="FULLWIDTHGREATERTHAN",_a="AMPERSAND",Sa="APOSTROPHE",Ca="ASTERISK",di="AT",Ea="BACKSLASH",Na="BACKTICK",Aa="CARET",Ri="COLON",Ps="COMMA",Oa="DOLLAR",Bt="DOT",Ta="EQUALS",Vs="EXCLAMATION",Et="HYPHEN",Rn="PERCENT",Ma="PIPE",za="PLUS",Ia="POUND",Ln="QUERY",Fs="QUOTE",Uf="FULLWIDTHMIDDLEDOT",Us="SEMI",Pt="SLASH",Bn="TILDE",Da="UNDERSCORE",Hf="EMOJI",Ra="SYM";var jf=Object.freeze({__proto__:null,ALPHANUMERICAL:Ff,AMPERSAND:_a,APOSTROPHE:Sa,ASCIINUMERICAL:Vf,ASTERISK:Ca,AT:di,BACKSLASH:Ea,BACKTICK:Na,CARET:Aa,CLOSEANGLEBRACKET:ma,CLOSEBRACE:Dn,CLOSEBRACKET:ua,CLOSEPAREN:pa,COLON:Ri,COMMA:Ps,DOLLAR:Oa,DOT:Bt,EMOJI:Hf,EQUALS:Ta,EXCLAMATION:Vs,FULLWIDTHGREATERTHAN:wa,FULLWIDTHLEFTPAREN:ha,FULLWIDTHLESSTHAN:ka,FULLWIDTHMIDDLEDOT:Uf,FULLWIDTHRIGHTPAREN:ba,HYPHEN:Et,LEFTCORNERBRACKET:ga,LEFTWHITECORNERBRACKET:ya,LOCALHOST:$n,NL:Bs,NUM:Ls,OPENANGLEBRACKET:da,OPENBRACE:In,OPENBRACKET:ca,OPENPAREN:fa,PERCENT:Rn,PIPE:Ma,PLUS:za,POUND:Ia,QUERY:Ln,QUOTE:Fs,RIGHTCORNERBRACKET:va,RIGHTWHITECORNERBRACKET:xa,SCHEME:Ur,SEMI:Us,SLASH:Pt,SLASH_SCHEME:an,SYM:Ra,TILDE:Bn,TLD:Xo,UNDERSCORE:Da,UTLD:Jo,UWORD:Ko,WORD:Qt,WS:Zo});const Jt=/[a-z]/,_n=new RegExp("\\p{L}","u"),ho=new RegExp("\\p{Emoji}","u"),Zt=/\d/,bo=/\s/,lc="\r",go=`
15046
- `,N1="️",A1="‍",vo="";let Ar=null,Or=null;function O1(e=[]){const t={};gt.groups=t;const i=new gt;Ar==null&&(Ar=cc(k1)),Or==null&&(Or=cc(w1)),Y(i,"'",Sa),Y(i,"{",In),Y(i,"}",Dn),Y(i,"[",ca),Y(i,"]",ua),Y(i,"(",fa),Y(i,")",pa),Y(i,"<",da),Y(i,">",ma),Y(i,"(",ha),Y(i,")",ba),Y(i,"「",ga),Y(i,"」",va),Y(i,"『",ya),Y(i,"』",xa),Y(i,"<",ka),Y(i,">",wa),Y(i,"&",_a),Y(i,"*",Ca),Y(i,"@",di),Y(i,"`",Na),Y(i,"^",Aa),Y(i,":",Ri),Y(i,",",Ps),Y(i,"$",Oa),Y(i,".",Bt),Y(i,"=",Ta),Y(i,"!",Vs),Y(i,"-",Et),Y(i,"%",Rn),Y(i,"|",Ma),Y(i,"+",za),Y(i,"#",Ia),Y(i,"?",Ln),Y(i,'"',Fs),Y(i,"/",Pt),Y(i,";",Us),Y(i,"~",Bn),Y(i,"_",Da),Y(i,"\\",Ea),Y(i,"・",Uf);const n=Pe(i,Zt,Ls,{[qo]:!0});Pe(n,Zt,n);const r=Pe(n,Jt,Vf,{[zn]:!0}),a=Pe(n,_n,Ff,{[An]:!0}),o=Pe(i,Jt,Qt,{[$o]:!0});Pe(o,Zt,r),Pe(o,Jt,o),Pe(r,Zt,r),Pe(r,Jt,r);const l=Pe(i,_n,Ko,{[Wo]:!0});Pe(l,Jt),Pe(l,Zt,a),Pe(l,_n,l),Pe(a,Zt,a),Pe(a,Jt),Pe(a,_n,a);const c=Y(i,go,Bs,{[mo]:!0}),f=Y(i,lc,Zo,{[mo]:!0}),p=Pe(i,bo,Zo,{[mo]:!0});Y(i,vo,p),Y(f,go,c),Y(f,vo,p),Pe(f,bo,p),Y(p,lc),Y(p,go),Pe(p,bo,p),Y(p,vo,p);const m=Pe(i,ho,Hf,{[Pf]:!0});Y(m,"#"),Pe(m,ho,m),Y(m,N1,m);const d=Y(m,A1);Y(d,"#"),Pe(d,ho,m);const h=[[Jt,o],[Zt,r]],v=[[Jt,null],[_n,l],[Zt,a]];for(let b=0;b<Ar.length;b++)fi(i,Ar[b],Xo,Qt,h);for(let b=0;b<Or.length;b++)fi(i,Or[b],Jo,Ko,v);Di(Xo,{tld:!0,ascii:!0},t),Di(Jo,{utld:!0,alpha:!0},t),fi(i,"file",Ur,Qt,h),fi(i,"mailto",Ur,Qt,h),fi(i,"http",an,Qt,h),fi(i,"https",an,Qt,h),fi(i,"ftp",an,Qt,h),fi(i,"ftps",an,Qt,h),Di(Ur,{scheme:!0,ascii:!0},t),Di(an,{slashscheme:!0,ascii:!0},t),e=e.sort((b,y)=>b[0]>y[0]?1:-1);for(let b=0;b<e.length;b++){const y=e[b][0],x=e[b][1]?{[_1]:!0}:{[S1]:!0};y.indexOf("-")>=0?x[Go]=!0:Jt.test(y)?Zt.test(y)?x[zn]=!0:x[$o]=!0:x[qo]=!0,sc(i,y,y,x)}return sc(i,"localhost",$n,{ascii:!0}),i.jd=new gt(Ra),{start:i,tokens:Object.assign({groups:t},jf)}}function qf(e,t){const i=T1(t.replace(/[A-Z]/g,l=>l.toLowerCase())),n=i.length,r=[];let a=0,o=0;for(;o<n;){let l=e,c=null,f=0,p=null,m=-1,d=-1;for(;o<n&&(c=l.go(i[o]));)l=c,l.accepts()?(m=0,d=0,p=l):m>=0&&(m+=i[o].length,d++),f+=i[o].length,a+=i[o].length,o++;a-=m,o-=d,f-=m,r.push({t:p.t,v:t.slice(a-f,a),s:a-f,e:a})}return r}function T1(e){const t=[],i=e.length;let n=0;for(;n<i;){let r=e.charCodeAt(n),a,o=r<55296||r>56319||n+1===i||(a=e.charCodeAt(n+1))<56320||a>57343?e[n]:e.slice(n,n+2);t.push(o),n+=o.length}return t}function fi(e,t,i,n,r){let a;const o=t.length;for(let l=0;l<o-1;l++){const c=t[l];e.j[c]?a=e.j[c]:(a=new gt(n),a.jr=r.slice(),e.j[c]=a),e=a}return a=new gt(i),a.jr=r.slice(),e.j[t[o-1]]=a,a}function cc(e){const t=[],i=[];let n=0,r="0123456789";for(;n<e.length;){let a=0;for(;r.indexOf(e[n+a])>=0;)a++;if(a>0){t.push(i.join(""));for(let o=parseInt(e.substring(n,n+a),10);o>0;o--)i.pop();n+=a}else i.push(e[n]),n++}return t}const Wn={defaultProtocol:"http",events:null,format:uc,formatHref:uc,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Hs(e,t=null){let i=Object.assign({},Wn);e&&(i=Object.assign(i,e instanceof Hs?e.o:e));const n=i.ignoreTags,r=[];for(let a=0;a<n.length;a++)r.push(n[a].toUpperCase());this.o=i,t&&(this.defaultRender=t),this.ignoreTags=r}Hs.prototype={o:Wn,ignoreTags:[],defaultRender(e){return e},check(e){return this.get("validate",e.toString(),e)},get(e,t,i){const n=t!=null;let r=this.o[e];return r&&(typeof r=="object"?(r=i.t in r?r[i.t]:Wn[e],typeof r=="function"&&n&&(r=r(t,i))):typeof r=="function"&&n&&(r=r(t,i.t,i)),r)},getObj(e,t,i){let n=this.o[e];return typeof n=="function"&&t!=null&&(n=n(t,i.t,i)),n},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}};function uc(e){return e}function $f(e,t){this.t="token",this.v=e,this.tk=t}$f.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),i=e.get("truncate",t,this),n=e.get("format",t,this);return i&&n.length>i?n.substring(0,i)+"…":n},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=Wn.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,i=this.toHref(e.get("defaultProtocol")),n=e.get("formatHref",i,this),r=e.get("tagName",i,t),a=this.toFormattedString(e),o={},l=e.get("className",i,t),c=e.get("target",i,t),f=e.get("rel",i,t),p=e.getObj("attributes",i,t),m=e.getObj("events",i,t);return o.href=n,l&&(o.class=l),c&&(o.target=c),f&&(o.rel=f),p&&Object.assign(o,p),{tagName:r,attributes:o,content:a,eventListeners:m}}};function qa(e,t){class i extends $f{constructor(r,a){super(r,a),this.t=e}}for(const n in t)i.prototype[n]=t[n];return i.t=e,i}const M1=qa("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),fc=qa("text"),z1=qa("nl"),Tr=qa("url",{isLink:!0,toHref(e=Wn.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==$n&&e[1].t===Ri}}),Ct=e=>new gt(e);function I1({groups:e}){const t=e.domain.concat([_a,Ca,di,Ea,Na,Aa,Oa,Ta,Et,Ls,Rn,Ma,za,Ia,Pt,Ra,Bn,Da]),i=[Sa,Ri,Ps,Bt,Vs,Rn,Ln,Fs,Us,da,ma,In,Dn,ua,ca,fa,pa,ha,ba,ga,va,ya,xa,ka,wa],n=[_a,Sa,Ca,Ea,Na,Aa,Oa,Ta,Et,In,Dn,Rn,Ma,za,Ia,Ln,Pt,Ra,Bn,Da],r=Ct(),a=Y(r,Bn);ye(a,n,a),ye(a,e.domain,a);const o=Ct(),l=Ct(),c=Ct();ye(r,e.domain,o),ye(r,e.scheme,l),ye(r,e.slashscheme,c),ye(o,n,a),ye(o,e.domain,o);const f=Y(o,di);Y(a,di,f),Y(l,di,f),Y(c,di,f);const p=Y(a,Bt);ye(p,n,a),ye(p,e.domain,a);const m=Ct();ye(f,e.domain,m),ye(m,e.domain,m);const d=Y(m,Bt);ye(d,e.domain,m);const h=Ct(M1);ye(d,e.tld,h),ye(d,e.utld,h),Y(f,$n,h);const v=Y(m,Et);Y(v,Et,v),ye(v,e.domain,m),ye(h,e.domain,m),Y(h,Bt,d),Y(h,Et,v);const b=Y(o,Et),y=Y(o,Bt);Y(b,Et,b),ye(b,e.domain,o),ye(y,n,a),ye(y,e.domain,o);const g=Ct(Tr);ye(y,e.tld,g),ye(y,e.utld,g),ye(g,e.domain,o),ye(g,n,a),Y(g,Bt,y),Y(g,Et,b),Y(g,di,f);const x=Y(g,Ri),k=Ct(Tr);ye(x,e.numeric,k);const w=Ct(Tr),C=Ct();ye(w,t,w),ye(w,i,C),ye(C,t,w),ye(C,i,C),Y(g,Pt,w),Y(k,Pt,w);const E=Y(l,Ri),B=Y(c,Ri),_=Y(B,Pt),S=Y(_,Pt);ye(l,e.domain,o),Y(l,Bt,y),Y(l,Et,b),ye(c,e.domain,o),Y(c,Bt,y),Y(c,Et,b),ye(E,e.domain,w),Y(E,Pt,w),Y(E,Ln,w),ye(S,e.domain,w),ye(S,t,w),Y(S,Pt,w);const T=[[In,Dn],[ca,ua],[fa,pa],[da,ma],[ha,ba],[ga,va],[ya,xa],[ka,wa]];for(let D=0;D<T.length;D++){const[H,V]=T[D],M=Y(w,H);Y(C,H,M);const $=Ct(Tr);ye(M,t,$);const P=Ct();ye(M,i,P),Y(M,V,w),ye($,t,$),ye($,i,P),ye(P,t,$),ye(P,i,P),Y($,V,w),Y(P,V,w)}return Y(r,$n,g),Y(r,Bs,z1),{start:r,tokens:jf}}function D1(e,t,i){let n=i.length,r=0,a=[],o=[];for(;r<n;){let l=e,c=null,f=null,p=0,m=null,d=-1;for(;r<n&&!(c=l.go(i[r].t));)o.push(i[r++]);for(;r<n&&(f=c||l.go(i[r].t));)c=null,l=f,l.accepts()?(d=0,m=l):d>=0&&d++,r++,p++;if(d<0)r-=p,r<n&&(o.push(i[r]),r++);else{o.length>0&&(a.push(yo(fc,t,o)),o=[]),r-=d,p-=d;const h=m.t,v=i.slice(r-p,r);a.push(yo(h,t,v))}}return o.length>0&&a.push(yo(fc,t,o)),a}function yo(e,t,i){const n=i[0].s,r=i[i.length-1].e,a=t.slice(n,r);return new e(a,i)}const R1=typeof console<"u"&&console&&console.warn||(()=>{}),L1="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",De={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function B1(){return gt.groups={},De.scanner=null,De.parser=null,De.tokenQueue=[],De.pluginQueue=[],De.customSchemes=[],De.initialized=!1,De}function pc(e,t=!1){if(De.initialized&&R1(`linkifyjs: already initialized - will not register custom scheme "${e}" ${L1}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format.
15045
+ `);return t===this.lastSignature?!1:(this.lastSignature=t,this.clusters=new Map(e.map(i=>[i.citationId,i.attrs])),this.order=e.map(i=>i.citationId),this.recompute(),this.emitChange(),!0)}renderCluster(e){return this.rendered.get(e)??""}getBibliography(){return this.bibliography}emitChange(){for(const e of this.listeners)e()}recompute(){const e=Nr[this.style],t=new Dv.Engine({retrieveLocale:()=>u1,retrieveItem:a=>this.sources.get(a)},e.xml,"en-US"),i=new Map,n=[];let r=0;for(const a of this.order){const o=this.clusters.get(a);if(!(o!=null&&o.sourceId)||!this.sources.has(o.sourceId)){i.set(a,"");continue}r+=1;try{const[,l]=t.processCitationCluster({citationID:a,citationItems:[{id:o.sourceId,locator:o.locator||void 0,label:o.label||void 0,prefix:o.prefix||void 0,suffix:o.suffix||void 0,"suppress-author":o.mode==="suppress-author"||void 0,"author-only":o.mode==="author-only"||void 0}],properties:{noteIndex:e.category==="note"?r:0}},n,[]);n.push([a,r]);for(const[,c,f]of l??[])i.set(f,rc(c));i.has(a)||i.set(a,"")}catch{i.set(a,"")}}this.rendered=i;try{const a=t.makeBibliography();this.bibliography=a?a[1].map(o=>rc(o).trim()):[]}catch{this.bibliography=[]}}};function ac(e){const t=e.storage.citation;return(t==null?void 0:t.engine)??null}var d1=vt.create({name:"bibliography",group:"block",selectable:!0,draggable:!0,atom:!0,parseHTML(){return[{tag:'div[data-node-type="bibliography"]'}]},renderHTML({HTMLAttributes:e}){return["div",Fe(e,{"data-node-type":"bibliography",class:"docs-bibliography"})]},addNodeView(){return e=>{const t=e.editor,i=document.createElement("div");i.className="docs-bibliography",i.setAttribute("data-node-type","bibliography");const n=()=>{const o=ac(t),l=(o==null?void 0:o.getBibliography())??[];if(i.innerHTML="",l.length===0){const p=document.createElement("p");p.className="docs-bibliography__empty",p.textContent="Bibliography",i.appendChild(p);return}const c=document.createElement("h2");c.className="docs-bibliography__heading",c.textContent="Bibliography",i.appendChild(c);const f=document.createElement("div");f.className="docs-bibliography__entries";for(const p of l){const m=document.createElement("p");m.className="docs-bibliography__entry",m.innerHTML=p,f.appendChild(m)}i.appendChild(f)};n();const r=ac(t),a=r==null?void 0:r.onChange(n);return{dom:i,update(o){var l;return((l=o==null?void 0:o.type)==null?void 0:l.name)==="bibliography"},destroy(){a==null||a()}}}}});function Bf(e,t){const i=Lf();return e.isNoteStyle()?{type:"footnote",attrs:{content:"",sourceId:t.sourceId,locator:t.locator??"",citationId:i}}:{type:"citation",attrs:{citationId:i,sourceId:t.sourceId,locator:t.locator??""}}}function fn(e){return e.storage.citation?e.storage.citation.engine??null:null}var m1=Ke.create({name:"citation",addStorage(){return{engine:null}},onUpdate(){var r,a;const e=this.editor,t=fn(e);if(!t)return;{const o=new Set,l=[];if(e.state.doc.descendants((c,f)=>{if(c.type.name==="citation"||c.type.name==="footnote"&&c.attrs.sourceId){const p=c.attrs.citationId;p&&(o.has(p)?l.push({pos:f,attrs:{...c.attrs}}):o.add(p))}return!0}),l.length>0){const c=e.state.tr;for(const{pos:f,attrs:p}of l)c.setNodeMarkup(f,void 0,{...p,citationId:Lf()});e.view.dispatch(c);return}}const i=[];if(e.state.doc.descendants((o,l)=>((o.type.name==="citation"||o.type.name==="footnote"&&o.attrs.sourceId)&&i.push({citationId:o.attrs.citationId??`anon-${l}`,attrs:{sourceId:o.attrs.sourceId??null,locator:o.attrs.locator||"",label:o.attrs.label||"page",mode:o.attrs.mode||"normal",prefix:o.attrs.prefix||"",suffix:o.attrs.suffix||""}}),!0)),t.syncCitations(i)){const o=e.storage.editorContext;(a=(r=o==null?void 0:o.citation)==null?void 0:r.onSourcesChange)==null||a.call(r,t.getCitedSourceIds())}}}),h1=vt.create({name:"citation",group:"inline",inline:!0,selectable:!0,draggable:!1,atom:!0,addAttributes(){return{citationId:{default:null,parseHTML:e=>e.getAttribute("data-citation-id"),renderHTML:e=>({"data-citation-id":e.citationId})},sourceId:{default:null,parseHTML:e=>e.getAttribute("data-citation-source-id"),renderHTML:e=>({"data-citation-source-id":e.sourceId})},locator:{default:"",parseHTML:e=>e.getAttribute("data-citation-locator")??"",renderHTML:e=>({"data-citation-locator":e.locator})},label:{default:"page",parseHTML:e=>e.getAttribute("data-citation-label")??"page",renderHTML:e=>({"data-citation-label":e.label})},mode:{default:"normal",parseHTML:e=>e.getAttribute("data-citation-mode")??"normal",renderHTML:e=>({"data-citation-mode":e.mode})},prefix:{default:""},suffix:{default:""}}},parseHTML(){return[{tag:'span[data-node-type="citation"]'}]},renderHTML({HTMLAttributes:e}){return["span",Fe(e,{"data-node-type":"citation",class:"docs-citation"}),""]},addNodeView(){return e=>{const t=e.editor,i=e.node??e,n=document.createElement("span");n.className="docs-citation",n.setAttribute("data-node-type","citation");const r=()=>{const l=fn(t),c=i.attrs.citationId,f=l&&c?l.renderCluster(c):"";f?(n.innerHTML=f,n.classList.remove("docs-citation--missing")):(n.textContent="[?]",n.classList.add("docs-citation--missing")),n.setAttribute("data-citation-id",String(i.attrs.citationId??"")),n.setAttribute("data-citation-source-id",String(i.attrs.sourceId??""))};r();const a=fn(t),o=a==null?void 0:a.onChange(r);return{dom:n,update(l){var c;if(((c=l==null?void 0:l.type)==null?void 0:c.name)!=="citation")return!1;try{Object.assign(i.attrs,l.attrs),r()}catch{}return!0},destroy(){o==null||o()}}}}});function oc(e,t,i){const n=Bf(t,i);return n.type==="footnote"&&!e.schema.nodes.footnote?!1:e.chain().focus().insertContent({type:n.type,attrs:n.attrs}).run()}_e.definePlugin({id:"citation",tiptapExtensions:[m1,h1,d1],toolbar:[{id:"insert-citation",label:"Citation",action:"insertCitation",iconComponent:"Quote"}],slashCommands:[{name:"Citation",command:"insertCitation"},{name:"Bibliography",command:"insertBibliography"}],commands:{insertCitation:(e,...t)=>{var o;const i=fn(e);if(!i)return console.warn("[citation] no citation engine — inject the CitationPort to enable citations"),!1;const n=t[0];if(n!=null&&n.sourceId)return oc(e,i,{sourceId:n.sourceId,locator:n.locator});const r=e.storage.editorContext,a=(o=r==null?void 0:r.citation)==null?void 0:o.onSourceRequest;return a?(a().then(l=>{l&&oc(e,i,{sourceId:l})}),!0):!1},insertBibliography:e=>{let t=!1;return e.state.doc.descendants(i=>(i.type.name==="bibliography"&&(t=!0),!t)),t?!1:e.chain().focus().insertContent({type:"bibliography"}).run()},setCitationStyle:(e,...t)=>{const i=fn(e),n=t[0];return!i||!n?!1:(i.setStyle(n),!0)}},hooks:{onInit(e){const t=e.storage.editorContext,i=t==null?void 0:t.citation;if(!i)return;const n=typeof i.sources=="function"?i.sources():i.sources,r=new p1({sources:n,style:i.style});e.storage.citation.engine=r},onDestroy(e){e.storage.citation.engine=null}}});const b1=xi.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",Fe(this.options.HTMLAttributes,e),0]},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),g1=vt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",Fe(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),v1=/^\s*(\[([( |x])?\])\s$/,y1=vt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return t===""||t==="true"},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",Fe(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:i,editor:n})=>{const r=document.createElement("li"),a=document.createElement("label"),o=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div"),f=()=>{var p,m;l.ariaLabel=((m=(p=this.options.a11y)===null||p===void 0?void 0:p.checkboxLabel)===null||m===void 0?void 0:m.call(p,e,l.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};return f(),a.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",p=>p.preventDefault()),l.addEventListener("change",p=>{if(!n.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:m}=p.target;n.isEditable&&typeof i=="function"&&n.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:d})=>{const h=i();if(typeof h!="number")return!1;const v=d.doc.nodeAt(h);return d.setNodeMarkup(h,void 0,{...v==null?void 0:v.attrs,checked:m}),!0}).run(),!n.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,m)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([p,m])=>{r.setAttribute(p,m)}),r.dataset.checked=e.attrs.checked,l.checked=e.attrs.checked,a.append(l,o),r.append(a,c),Object.entries(t).forEach(([p,m])=>{r.setAttribute(p,m)}),{dom:r,contentDOM:c,update:p=>p.type!==this.type?!1:(r.dataset.checked=p.attrs.checked,l.checked=p.attrs.checked,f(),!0)}}},addInputRules(){return[Q0({find:v1,type:this.type,getAttributes:e=>({checked:e[e.length-1]==="x"})})]}}),x1=Ke.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(i=>t.updateAttributes(i,{textAlign:e})).every(i=>i):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).every(t=>t),toggleTextAlign:e=>({editor:t,commands:i})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?i.unsetTextAlign():i.setTextAlign(e):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),k1="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",w1="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",qo="numeric",$o="ascii",Wo="alpha",zn="asciinumeric",An="alphanumeric",Go="domain",Pf="emoji",_1="scheme",S1="slashscheme",mo="whitespace";function C1(e,t){return e in t||(t[e]=[]),t[e]}function Di(e,t,i){t[qo]&&(t[zn]=!0,t[An]=!0),t[$o]&&(t[zn]=!0,t[Wo]=!0),t[zn]&&(t[An]=!0),t[Wo]&&(t[An]=!0),t[An]&&(t[Go]=!0),t[Pf]&&(t[Go]=!0);for(const n in t){const r=C1(n,i);r.indexOf(e)<0&&r.push(e)}}function E1(e,t){const i={};for(const n in t)t[n].indexOf(e)>=0&&(i[n]=!0);return i}function gt(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}gt.groups={};gt.prototype={accepts(){return!!this.t},go(e){const t=this,i=t.j[e];if(i)return i;for(let n=0;n<t.jr.length;n++){const r=t.jr[n][0],a=t.jr[n][1];if(a&&r.test(e))return a}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,i,n){for(let r=0;r<e.length;r++)this.tt(e[r],t,i,n)},tr(e,t,i,n){n=n||gt.groups;let r;return t&&t.j?r=t:(r=new gt(t),i&&n&&Di(t,i,n)),this.jr.push([e,r]),r},ts(e,t,i,n){let r=this;const a=e.length;if(!a)return r;for(let o=0;o<a-1;o++)r=r.tt(e[o]);return r.tt(e[a-1],t,i,n)},tt(e,t,i,n){n=n||gt.groups;const r=this;if(t&&t.j)return r.j[e]=t,t;const a=t;let o,l=r.go(e);if(l?(o=new gt,Object.assign(o.j,l.j),o.jr.push.apply(o.jr,l.jr),o.jd=l.jd,o.t=l.t):o=new gt,a){if(n)if(o.t&&typeof o.t=="string"){const c=Object.assign(E1(o.t,n),i);Di(a,c,n)}else i&&Di(a,i,n);o.t=a}return r.j[e]=o,o}};const ye=(e,t,i,n,r)=>e.ta(t,i,n,r),Pe=(e,t,i,n,r)=>e.tr(t,i,n,r),sc=(e,t,i,n,r)=>e.ts(t,i,n,r),Y=(e,t,i,n,r)=>e.tt(t,i,n,r),Qt="WORD",Ko="UWORD",Vf="ASCIINUMERICAL",Ff="ALPHANUMERICAL",$n="LOCALHOST",Xo="TLD",Jo="UTLD",Ur="SCHEME",an="SLASH_SCHEME",Ls="NUM",Zo="WS",Bs="NL",In="OPENBRACE",Dn="CLOSEBRACE",ca="OPENBRACKET",ua="CLOSEBRACKET",fa="OPENPAREN",pa="CLOSEPAREN",da="OPENANGLEBRACKET",ma="CLOSEANGLEBRACKET",ha="FULLWIDTHLEFTPAREN",ba="FULLWIDTHRIGHTPAREN",ga="LEFTCORNERBRACKET",va="RIGHTCORNERBRACKET",ya="LEFTWHITECORNERBRACKET",xa="RIGHTWHITECORNERBRACKET",ka="FULLWIDTHLESSTHAN",wa="FULLWIDTHGREATERTHAN",_a="AMPERSAND",Sa="APOSTROPHE",Ca="ASTERISK",di="AT",Ea="BACKSLASH",Na="BACKTICK",Aa="CARET",Ri="COLON",Ps="COMMA",Oa="DOLLAR",Pt="DOT",Ta="EQUALS",Vs="EXCLAMATION",Et="HYPHEN",Rn="PERCENT",Ma="PIPE",za="PLUS",Ia="POUND",Ln="QUERY",Fs="QUOTE",Uf="FULLWIDTHMIDDLEDOT",Us="SEMI",Vt="SLASH",Bn="TILDE",Da="UNDERSCORE",Hf="EMOJI",Ra="SYM";var jf=Object.freeze({__proto__:null,ALPHANUMERICAL:Ff,AMPERSAND:_a,APOSTROPHE:Sa,ASCIINUMERICAL:Vf,ASTERISK:Ca,AT:di,BACKSLASH:Ea,BACKTICK:Na,CARET:Aa,CLOSEANGLEBRACKET:ma,CLOSEBRACE:Dn,CLOSEBRACKET:ua,CLOSEPAREN:pa,COLON:Ri,COMMA:Ps,DOLLAR:Oa,DOT:Pt,EMOJI:Hf,EQUALS:Ta,EXCLAMATION:Vs,FULLWIDTHGREATERTHAN:wa,FULLWIDTHLEFTPAREN:ha,FULLWIDTHLESSTHAN:ka,FULLWIDTHMIDDLEDOT:Uf,FULLWIDTHRIGHTPAREN:ba,HYPHEN:Et,LEFTCORNERBRACKET:ga,LEFTWHITECORNERBRACKET:ya,LOCALHOST:$n,NL:Bs,NUM:Ls,OPENANGLEBRACKET:da,OPENBRACE:In,OPENBRACKET:ca,OPENPAREN:fa,PERCENT:Rn,PIPE:Ma,PLUS:za,POUND:Ia,QUERY:Ln,QUOTE:Fs,RIGHTCORNERBRACKET:va,RIGHTWHITECORNERBRACKET:xa,SCHEME:Ur,SEMI:Us,SLASH:Vt,SLASH_SCHEME:an,SYM:Ra,TILDE:Bn,TLD:Xo,UNDERSCORE:Da,UTLD:Jo,UWORD:Ko,WORD:Qt,WS:Zo});const Jt=/[a-z]/,_n=new RegExp("\\p{L}","u"),ho=new RegExp("\\p{Emoji}","u"),Zt=/\d/,bo=/\s/,lc="\r",go=`
15046
+ `,N1="️",A1="‍",vo="";let Ar=null,Or=null;function O1(e=[]){const t={};gt.groups=t;const i=new gt;Ar==null&&(Ar=cc(k1)),Or==null&&(Or=cc(w1)),Y(i,"'",Sa),Y(i,"{",In),Y(i,"}",Dn),Y(i,"[",ca),Y(i,"]",ua),Y(i,"(",fa),Y(i,")",pa),Y(i,"<",da),Y(i,">",ma),Y(i,"(",ha),Y(i,")",ba),Y(i,"「",ga),Y(i,"」",va),Y(i,"『",ya),Y(i,"』",xa),Y(i,"<",ka),Y(i,">",wa),Y(i,"&",_a),Y(i,"*",Ca),Y(i,"@",di),Y(i,"`",Na),Y(i,"^",Aa),Y(i,":",Ri),Y(i,",",Ps),Y(i,"$",Oa),Y(i,".",Pt),Y(i,"=",Ta),Y(i,"!",Vs),Y(i,"-",Et),Y(i,"%",Rn),Y(i,"|",Ma),Y(i,"+",za),Y(i,"#",Ia),Y(i,"?",Ln),Y(i,'"',Fs),Y(i,"/",Vt),Y(i,";",Us),Y(i,"~",Bn),Y(i,"_",Da),Y(i,"\\",Ea),Y(i,"・",Uf);const n=Pe(i,Zt,Ls,{[qo]:!0});Pe(n,Zt,n);const r=Pe(n,Jt,Vf,{[zn]:!0}),a=Pe(n,_n,Ff,{[An]:!0}),o=Pe(i,Jt,Qt,{[$o]:!0});Pe(o,Zt,r),Pe(o,Jt,o),Pe(r,Zt,r),Pe(r,Jt,r);const l=Pe(i,_n,Ko,{[Wo]:!0});Pe(l,Jt),Pe(l,Zt,a),Pe(l,_n,l),Pe(a,Zt,a),Pe(a,Jt),Pe(a,_n,a);const c=Y(i,go,Bs,{[mo]:!0}),f=Y(i,lc,Zo,{[mo]:!0}),p=Pe(i,bo,Zo,{[mo]:!0});Y(i,vo,p),Y(f,go,c),Y(f,vo,p),Pe(f,bo,p),Y(p,lc),Y(p,go),Pe(p,bo,p),Y(p,vo,p);const m=Pe(i,ho,Hf,{[Pf]:!0});Y(m,"#"),Pe(m,ho,m),Y(m,N1,m);const d=Y(m,A1);Y(d,"#"),Pe(d,ho,m);const h=[[Jt,o],[Zt,r]],v=[[Jt,null],[_n,l],[Zt,a]];for(let b=0;b<Ar.length;b++)fi(i,Ar[b],Xo,Qt,h);for(let b=0;b<Or.length;b++)fi(i,Or[b],Jo,Ko,v);Di(Xo,{tld:!0,ascii:!0},t),Di(Jo,{utld:!0,alpha:!0},t),fi(i,"file",Ur,Qt,h),fi(i,"mailto",Ur,Qt,h),fi(i,"http",an,Qt,h),fi(i,"https",an,Qt,h),fi(i,"ftp",an,Qt,h),fi(i,"ftps",an,Qt,h),Di(Ur,{scheme:!0,ascii:!0},t),Di(an,{slashscheme:!0,ascii:!0},t),e=e.sort((b,y)=>b[0]>y[0]?1:-1);for(let b=0;b<e.length;b++){const y=e[b][0],x=e[b][1]?{[_1]:!0}:{[S1]:!0};y.indexOf("-")>=0?x[Go]=!0:Jt.test(y)?Zt.test(y)?x[zn]=!0:x[$o]=!0:x[qo]=!0,sc(i,y,y,x)}return sc(i,"localhost",$n,{ascii:!0}),i.jd=new gt(Ra),{start:i,tokens:Object.assign({groups:t},jf)}}function qf(e,t){const i=T1(t.replace(/[A-Z]/g,l=>l.toLowerCase())),n=i.length,r=[];let a=0,o=0;for(;o<n;){let l=e,c=null,f=0,p=null,m=-1,d=-1;for(;o<n&&(c=l.go(i[o]));)l=c,l.accepts()?(m=0,d=0,p=l):m>=0&&(m+=i[o].length,d++),f+=i[o].length,a+=i[o].length,o++;a-=m,o-=d,f-=m,r.push({t:p.t,v:t.slice(a-f,a),s:a-f,e:a})}return r}function T1(e){const t=[],i=e.length;let n=0;for(;n<i;){let r=e.charCodeAt(n),a,o=r<55296||r>56319||n+1===i||(a=e.charCodeAt(n+1))<56320||a>57343?e[n]:e.slice(n,n+2);t.push(o),n+=o.length}return t}function fi(e,t,i,n,r){let a;const o=t.length;for(let l=0;l<o-1;l++){const c=t[l];e.j[c]?a=e.j[c]:(a=new gt(n),a.jr=r.slice(),e.j[c]=a),e=a}return a=new gt(i),a.jr=r.slice(),e.j[t[o-1]]=a,a}function cc(e){const t=[],i=[];let n=0,r="0123456789";for(;n<e.length;){let a=0;for(;r.indexOf(e[n+a])>=0;)a++;if(a>0){t.push(i.join(""));for(let o=parseInt(e.substring(n,n+a),10);o>0;o--)i.pop();n+=a}else i.push(e[n]),n++}return t}const Wn={defaultProtocol:"http",events:null,format:uc,formatHref:uc,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Hs(e,t=null){let i=Object.assign({},Wn);e&&(i=Object.assign(i,e instanceof Hs?e.o:e));const n=i.ignoreTags,r=[];for(let a=0;a<n.length;a++)r.push(n[a].toUpperCase());this.o=i,t&&(this.defaultRender=t),this.ignoreTags=r}Hs.prototype={o:Wn,ignoreTags:[],defaultRender(e){return e},check(e){return this.get("validate",e.toString(),e)},get(e,t,i){const n=t!=null;let r=this.o[e];return r&&(typeof r=="object"?(r=i.t in r?r[i.t]:Wn[e],typeof r=="function"&&n&&(r=r(t,i))):typeof r=="function"&&n&&(r=r(t,i.t,i)),r)},getObj(e,t,i){let n=this.o[e];return typeof n=="function"&&t!=null&&(n=n(t,i.t,i)),n},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}};function uc(e){return e}function $f(e,t){this.t="token",this.v=e,this.tk=t}$f.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),i=e.get("truncate",t,this),n=e.get("format",t,this);return i&&n.length>i?n.substring(0,i)+"…":n},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=Wn.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,i=this.toHref(e.get("defaultProtocol")),n=e.get("formatHref",i,this),r=e.get("tagName",i,t),a=this.toFormattedString(e),o={},l=e.get("className",i,t),c=e.get("target",i,t),f=e.get("rel",i,t),p=e.getObj("attributes",i,t),m=e.getObj("events",i,t);return o.href=n,l&&(o.class=l),c&&(o.target=c),f&&(o.rel=f),p&&Object.assign(o,p),{tagName:r,attributes:o,content:a,eventListeners:m}}};function qa(e,t){class i extends $f{constructor(r,a){super(r,a),this.t=e}}for(const n in t)i.prototype[n]=t[n];return i.t=e,i}const M1=qa("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),fc=qa("text"),z1=qa("nl"),Tr=qa("url",{isLink:!0,toHref(e=Wn.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==$n&&e[1].t===Ri}}),Ct=e=>new gt(e);function I1({groups:e}){const t=e.domain.concat([_a,Ca,di,Ea,Na,Aa,Oa,Ta,Et,Ls,Rn,Ma,za,Ia,Vt,Ra,Bn,Da]),i=[Sa,Ri,Ps,Pt,Vs,Rn,Ln,Fs,Us,da,ma,In,Dn,ua,ca,fa,pa,ha,ba,ga,va,ya,xa,ka,wa],n=[_a,Sa,Ca,Ea,Na,Aa,Oa,Ta,Et,In,Dn,Rn,Ma,za,Ia,Ln,Vt,Ra,Bn,Da],r=Ct(),a=Y(r,Bn);ye(a,n,a),ye(a,e.domain,a);const o=Ct(),l=Ct(),c=Ct();ye(r,e.domain,o),ye(r,e.scheme,l),ye(r,e.slashscheme,c),ye(o,n,a),ye(o,e.domain,o);const f=Y(o,di);Y(a,di,f),Y(l,di,f),Y(c,di,f);const p=Y(a,Pt);ye(p,n,a),ye(p,e.domain,a);const m=Ct();ye(f,e.domain,m),ye(m,e.domain,m);const d=Y(m,Pt);ye(d,e.domain,m);const h=Ct(M1);ye(d,e.tld,h),ye(d,e.utld,h),Y(f,$n,h);const v=Y(m,Et);Y(v,Et,v),ye(v,e.domain,m),ye(h,e.domain,m),Y(h,Pt,d),Y(h,Et,v);const b=Y(o,Et),y=Y(o,Pt);Y(b,Et,b),ye(b,e.domain,o),ye(y,n,a),ye(y,e.domain,o);const g=Ct(Tr);ye(y,e.tld,g),ye(y,e.utld,g),ye(g,e.domain,o),ye(g,n,a),Y(g,Pt,y),Y(g,Et,b),Y(g,di,f);const x=Y(g,Ri),k=Ct(Tr);ye(x,e.numeric,k);const w=Ct(Tr),C=Ct();ye(w,t,w),ye(w,i,C),ye(C,t,w),ye(C,i,C),Y(g,Vt,w),Y(k,Vt,w);const E=Y(l,Ri),B=Y(c,Ri),_=Y(B,Vt),S=Y(_,Vt);ye(l,e.domain,o),Y(l,Pt,y),Y(l,Et,b),ye(c,e.domain,o),Y(c,Pt,y),Y(c,Et,b),ye(E,e.domain,w),Y(E,Vt,w),Y(E,Ln,w),ye(S,e.domain,w),ye(S,t,w),Y(S,Vt,w);const T=[[In,Dn],[ca,ua],[fa,pa],[da,ma],[ha,ba],[ga,va],[ya,xa],[ka,wa]];for(let D=0;D<T.length;D++){const[H,V]=T[D],M=Y(w,H);Y(C,H,M);const $=Ct(Tr);ye(M,t,$);const P=Ct();ye(M,i,P),Y(M,V,w),ye($,t,$),ye($,i,P),ye(P,t,$),ye(P,i,P),Y($,V,w),Y(P,V,w)}return Y(r,$n,g),Y(r,Bs,z1),{start:r,tokens:jf}}function D1(e,t,i){let n=i.length,r=0,a=[],o=[];for(;r<n;){let l=e,c=null,f=null,p=0,m=null,d=-1;for(;r<n&&!(c=l.go(i[r].t));)o.push(i[r++]);for(;r<n&&(f=c||l.go(i[r].t));)c=null,l=f,l.accepts()?(d=0,m=l):d>=0&&d++,r++,p++;if(d<0)r-=p,r<n&&(o.push(i[r]),r++);else{o.length>0&&(a.push(yo(fc,t,o)),o=[]),r-=d,p-=d;const h=m.t,v=i.slice(r-p,r);a.push(yo(h,t,v))}}return o.length>0&&a.push(yo(fc,t,o)),a}function yo(e,t,i){const n=i[0].s,r=i[i.length-1].e,a=t.slice(n,r);return new e(a,i)}const R1=typeof console<"u"&&console&&console.warn||(()=>{}),L1="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",De={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function B1(){return gt.groups={},De.scanner=null,De.parser=null,De.tokenQueue=[],De.pluginQueue=[],De.customSchemes=[],De.initialized=!1,De}function pc(e,t=!1){if(De.initialized&&R1(`linkifyjs: already initialized - will not register custom scheme "${e}" ${L1}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format.
15047
15047
  1. Must only contain digits, lowercase ASCII letters or "-"
15048
15048
  2. Cannot start or end with "-"
15049
- 3. "-" cannot repeat`);De.customSchemes.push([e,t])}function P1(){De.scanner=O1(De.customSchemes);for(let e=0;e<De.tokenQueue.length;e++)De.tokenQueue[e][1]({scanner:De.scanner});De.parser=I1(De.scanner.tokens);for(let e=0;e<De.pluginQueue.length;e++)De.pluginQueue[e][1]({scanner:De.scanner,parser:De.parser});return De.initialized=!0,De}function js(e){return De.initialized||P1(),D1(De.parser.start,e,qf(De.scanner.start,e))}js.scan=qf;function Wf(e,t=null,i=null){if(t&&typeof t=="object"){if(i)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);i=t,t=null}const n=new Hs(i),r=js(e),a=[];for(let o=0;o<r.length;o++){const l=r[o];l.isLink&&(!t||l.t===t)&&n.check(l)&&a.push(l.toFormattedObject(n))}return a}const qs="[\0-   ᠎ -\u2029  ]",V1=new RegExp(qs),F1=new RegExp(`${qs}$`),U1=new RegExp(qs,"g");function H1(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function j1(e){return new ft({key:new ot("autolink"),appendTransaction:(t,i,n)=>{const r=t.some(f=>f.docChanged)&&!i.doc.eq(n.doc),a=t.some(f=>f.getMeta("preventAutolink"));if(!r||a)return;const{tr:o}=n,l=x0(i.doc,[...t]);if(N0(l).forEach(({newRange:f})=>{const p=w0(n.doc,f,h=>h.isTextblock);let m,d;if(p.length>1)m=p[0],d=n.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(p.length){const h=n.doc.textBetween(f.from,f.to," "," ");if(!F1.test(h))return;m=p[0],d=n.doc.textBetween(m.pos,f.to,void 0," ")}if(m&&d){const h=d.split(V1).filter(Boolean);if(h.length<=0)return!1;const v=h[h.length-1],b=m.pos+d.lastIndexOf(v);if(!v)return!1;const y=js(v).map(g=>g.toObject(e.defaultProtocol));if(!H1(y))return!1;y.filter(g=>g.isLink).map(g=>({...g,from:b+g.start+1,to:b+g.end+1})).filter(g=>n.schema.marks.code?!n.doc.rangeHasMark(g.from,g.to,n.schema.marks.code):!0).filter(g=>e.validate(g.value)).filter(g=>e.shouldAutoLink(g.value)).forEach(g=>{Ds(g.from,g.to,n.doc).some(x=>x.mark.type===e.type)||o.addMark(g.from,g.to,e.type.create({href:g.href}))})}}),!!o.steps.length)return o}})}function q1(e){return new ft({key:new ot("handleClickLink"),props:{handleClick:(t,i,n)=>{var r,a;if(n.button!==0||!t.editable)return!1;let o=n.target;const l=[];for(;o.nodeName!=="DIV";)l.push(o),o=o.parentNode;if(!l.find(d=>d.nodeName==="A"))return!1;const c=S0(t.state,e.type.name),f=n.target,p=(r=f==null?void 0:f.href)!==null&&r!==void 0?r:c.href,m=(a=f==null?void 0:f.target)!==null&&a!==void 0?a:c.target;return f&&p?(window.open(p,m),!0):!1}}})}function $1(e){return new ft({key:new ot("handlePasteLink"),props:{handlePaste:(t,i,n)=>{const{state:r}=t,{selection:a}=r,{empty:o}=a;if(o)return!1;let l="";n.content.forEach(f=>{l+=f.textContent});const c=Wf(l,{defaultProtocol:e.defaultProtocol}).find(f=>f.isLink&&f.value===l);return!l||!c?!1:e.editor.commands.setMark(e.type,{href:c.href})}}})}function Mi(e,t){const i=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(n=>{const r=typeof n=="string"?n:n.scheme;r&&i.push(r)}),!e||e.replace(U1,"").match(new RegExp(`^(?:(?:${i.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const W1=xi.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e=="string"){pc(e);return}pc(e.scheme,e.optionalSlashes)})},onDestroy(){B1()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!Mi(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:i=>!!Mi(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!Mi(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Fe(this.options.HTMLAttributes,e),0]:["a",Fe(this.options.HTMLAttributes,{...e,href:""}),0]},addCommands(){return{setLink:e=>({chain:t})=>{const{href:i}=e;return this.options.isAllowedUri(i,{defaultValidate:n=>!!Mi(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:i}=e;return this.options.isAllowedUri(i,{defaultValidate:n=>!!Mi(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Rf({find:e=>{const t=[];if(e){const{protocols:i,defaultProtocol:n}=this.options,r=Wf(e).filter(a=>a.isLink&&this.options.isAllowedUri(a.value,{defaultValidate:o=>!!Mi(o,i),protocols:i,defaultProtocol:n}));r.length&&r.forEach(a=>t.push({text:a.value,data:{href:a.href},index:a.start}))}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)===null||t===void 0?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:i}=this.options;return this.options.autolink&&e.push(j1({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:n=>this.options.isAllowedUri(n,{defaultValidate:r=>!!Mi(r,t),protocols:t,defaultProtocol:i}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&e.push(q1({type:this.type})),this.options.linkOnPaste&&e.push($1({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),e}}),G1=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,K1=vt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",Fe(this.options.HTMLAttributes,e)]},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[Z0({find:G1,type:this.type,getAttributes:e=>{const[,,t,i,n]=e;return{src:i,alt:t,title:n}}})]}});let Qo,Yo;if(typeof WeakMap<"u"){let e=new WeakMap;Qo=t=>e.get(t),Yo=(t,i)=>(e.set(t,i),i)}else{const e=[];let i=0;Qo=n=>{for(let r=0;r<e.length;r+=2)if(e[r]==n)return e[r+1]},Yo=(n,r)=>(i==10&&(i=0),e[i++]=n,e[i++]=r)}var Ve=class{constructor(e,t,i,n){this.width=e,this.height=t,this.map=i,this.problems=n}findCell(e){for(let t=0;t<this.map.length;t++){const i=this.map[t];if(i!=e)continue;const n=t%this.width,r=t/this.width|0;let a=n+1,o=r+1;for(let l=1;a<this.width&&this.map[t+l]==i;l++)a++;for(let l=1;o<this.height&&this.map[t+this.width*l]==i;l++)o++;return{left:n,top:r,right:a,bottom:o}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,i){const{left:n,right:r,top:a,bottom:o}=this.findCell(e);return t=="horiz"?(i<0?n==0:r==this.width)?null:this.map[a*this.width+(i<0?n-1:r)]:(i<0?a==0:o==this.height)?null:this.map[n+this.width*(i<0?a-1:o)]}rectBetween(e,t){const{left:i,right:n,top:r,bottom:a}=this.findCell(e),{left:o,right:l,top:c,bottom:f}=this.findCell(t);return{left:Math.min(i,o),top:Math.min(r,c),right:Math.max(n,l),bottom:Math.max(a,f)}}cellsInRect(e){const t=[],i={};for(let n=e.top;n<e.bottom;n++)for(let r=e.left;r<e.right;r++){const a=n*this.width+r,o=this.map[a];i[o]||(i[o]=!0,!(r==e.left&&r&&this.map[a-1]==o||n==e.top&&n&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,i){for(let n=0,r=0;;n++){const a=r+i.child(n).nodeSize;if(n==e){let o=t+e*this.width;const l=(e+1)*this.width;for(;o<l&&this.map[o]<r;)o++;return o==l?a-1:this.map[o]}r=a}}static get(e){return Qo(e)||Yo(e,X1(e))}};function X1(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=J1(e),i=e.childCount,n=[];let r=0,a=null;const o=[];for(let f=0,p=t*i;f<p;f++)n[f]=0;for(let f=0,p=0;f<i;f++){const m=e.child(f);p++;for(let v=0;;v++){for(;r<n.length&&n[r]!=0;)r++;if(v==m.childCount)break;const b=m.child(v),{colspan:y,rowspan:g,colwidth:x}=b.attrs;for(let k=0;k<g;k++){if(k+f>=i){(a||(a=[])).push({type:"overlong_rowspan",pos:p,n:g-k});break}const w=r+k*t;for(let C=0;C<y;C++){n[w+C]==0?n[w+C]=p:(a||(a=[])).push({type:"collision",row:f,pos:p,n:y-C});const E=x&&x[C];if(E){const B=(w+C)%t*2,_=o[B];_==null||_!=E&&o[B+1]==1?(o[B]=E,o[B+1]=1):_==E&&o[B+1]++}}}r+=y,p+=b.nodeSize}const d=(f+1)*t;let h=0;for(;r<d;)n[r++]==0&&h++;h&&(a||(a=[])).push({type:"missing",row:f,n:h}),p++}(t===0||i===0)&&(a||(a=[])).push({type:"zero_sized"});const l=new Ve(t,i,n,a);let c=!1;for(let f=0;!c&&f<o.length;f+=2)o[f]!=null&&o[f+1]<i&&(c=!0);return c&&Z1(l,o,e),l}function J1(e){let t=-1,i=!1;for(let n=0;n<e.childCount;n++){const r=e.child(n);let a=0;if(i)for(let o=0;o<n;o++){const l=e.child(o);for(let c=0;c<l.childCount;c++){const f=l.child(c);o+f.attrs.rowspan>n&&(a+=f.attrs.colspan)}}for(let o=0;o<r.childCount;o++){const l=r.child(o);a+=l.attrs.colspan,l.attrs.rowspan>1&&(i=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function Z1(e,t,i){e.problems||(e.problems=[]);const n={};for(let r=0;r<e.map.length;r++){const a=e.map[r];if(n[a])continue;n[a]=!0;const o=i.nodeAt(a);if(!o)throw new RangeError(`No cell with offset ${a} found`);let l=null;const c=o.attrs;for(let f=0;f<c.colspan;f++){const p=t[(r+f)%e.width*2];p!=null&&(!c.colwidth||c.colwidth[f]!=p)&&((l||(l=Q1(c)))[f]=p)}l&&e.problems.unshift({type:"colwidth mismatch",pos:a,colwidth:l})}}function Q1(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let i=0;i<e.colspan;i++)t.push(0);return t}function nt(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const i in e.nodes){const n=e.nodes[i],r=n.spec.tableRole;r&&(t[r]=n)}}return t}const mi=new ot("selectingCells");function ji(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function Y1(e){for(let t=e.depth;t>0;t--){const i=e.node(t).type.spec.tableRole;if(i==="cell"||i==="header_cell")return e.node(t)}return null}function Lt(e){const t=e.selection.$head;for(let i=t.depth;i>0;i--)if(t.node(i).type.spec.tableRole=="row")return!0;return!1}function $a(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const i=ji(t.$head)||ek(t.$head);if(i)return i;throw new RangeError(`No cell found around position ${t.head}`)}function ek(e){for(let t=e.nodeAfter,i=e.pos;t;t=t.firstChild,i++){const n=t.type.spec.tableRole;if(n=="cell"||n=="header_cell")return e.doc.resolve(i)}for(let t=e.nodeBefore,i=e.pos;t;t=t.lastChild,i--){const n=t.type.spec.tableRole;if(n=="cell"||n=="header_cell")return e.doc.resolve(i-t.nodeSize)}}function es(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function tk(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function $s(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function Gf(e,t,i){const n=e.node(-1),r=Ve.get(n),a=e.start(-1),o=r.nextCell(e.pos-a,t,i);return o==null?null:e.node(0).resolve(a+o)}function qi(e,t,i=1){const n={...e,colspan:e.colspan-i};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(t,i),n.colwidth.some(r=>r>0)||(n.colwidth=null)),n}function Kf(e,t,i=1){const n={...e,colspan:e.colspan+i};if(n.colwidth){n.colwidth=n.colwidth.slice();for(let r=0;r<i;r++)n.colwidth.splice(t,0,0)}return n}function ik(e,t,i){const n=nt(t.type.schema).header_cell;for(let r=0;r<e.height;r++)if(t.nodeAt(e.map[i+r*e.width]).type!=n)return!1;return!0}var Ie=class Yt extends ve{constructor(t,i=t){const n=t.node(-1),r=Ve.get(n),a=t.start(-1),o=r.rectBetween(t.pos-a,i.pos-a),l=t.node(0),c=r.cellsInRect(o).filter(p=>p!=i.pos-a);c.unshift(i.pos-a);const f=c.map(p=>{const m=n.nodeAt(p);if(!m)throw new RangeError(`No cell with offset ${p} found`);const d=a+p+1;return new Vu(l.resolve(d),l.resolve(d+m.content.size))});super(f[0].$from,f[0].$to,f),this.$anchorCell=t,this.$headCell=i}map(t,i){const n=t.resolve(i.map(this.$anchorCell.pos)),r=t.resolve(i.map(this.$headCell.pos));if(es(n)&&es(r)&&$s(n,r)){const a=this.$anchorCell.node(-1)!=n.node(-1);return a&&this.isRowSelection()?Yt.rowSelection(n,r):a&&this.isColSelection()?Yt.colSelection(n,r):new Yt(n,r)}return he.between(n,r)}content(){const t=this.$anchorCell.node(-1),i=Ve.get(t),n=this.$anchorCell.start(-1),r=i.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),a={},o=[];for(let c=r.top;c<r.bottom;c++){const f=[];for(let p=c*i.width+r.left,m=r.left;m<r.right;m++,p++){const d=i.map[p];if(a[d])continue;a[d]=!0;const h=i.findCell(d);let v=t.nodeAt(d);if(!v)throw new RangeError(`No cell with offset ${d} found`);const b=r.left-h.left,y=h.right-r.right;if(b>0||y>0){let g=v.attrs;if(b>0&&(g=qi(g,0,b)),y>0&&(g=qi(g,g.colspan-y,y)),h.left<r.left){if(v=v.type.createAndFill(g),!v)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(g)}`)}else v=v.type.create(g,v.content)}if(h.top<r.top||h.bottom>r.bottom){const g={...v.attrs,rowspan:Math.min(h.bottom,r.bottom)-Math.max(h.top,r.top)};h.top<r.top?v=v.type.createAndFill(g):v=v.type.create(g,v.content)}f.push(v)}o.push(t.child(c).copy(Z.from(f)))}const l=this.isColSelection()&&this.isRowSelection()?t:o;return new ae(Z.from(l),1,1)}replace(t,i=ae.empty){const n=t.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){const{$from:l,$to:c}=r[o],f=t.mapping.slice(n);t.replace(f.map(l.pos),f.map(c.pos),o?ae.empty:i)}const a=ve.findFrom(t.doc.resolve(t.mapping.slice(n).map(this.to)),-1);a&&t.setSelection(a)}replaceWith(t,i){this.replace(t,new ae(Z.from(i),0,0))}forEachCell(t){const i=this.$anchorCell.node(-1),n=Ve.get(i),r=this.$anchorCell.start(-1),a=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let o=0;o<a.length;o++)t(i.nodeAt(a[o]),r+a[o])}isColSelection(){const t=this.$anchorCell.index(-1),i=this.$headCell.index(-1);if(Math.min(t,i)>0)return!1;const n=t+this.$anchorCell.nodeAfter.attrs.rowspan,r=i+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,i=t){const n=t.node(-1),r=Ve.get(n),a=t.start(-1),o=r.findCell(t.pos-a),l=r.findCell(i.pos-a),c=t.node(0);return o.top<=l.top?(o.top>0&&(t=c.resolve(a+r.map[o.left])),l.bottom<r.height&&(i=c.resolve(a+r.map[r.width*(r.height-1)+l.right-1]))):(l.top>0&&(i=c.resolve(a+r.map[l.left])),o.bottom<r.height&&(t=c.resolve(a+r.map[r.width*(r.height-1)+o.right-1]))),new Yt(t,i)}isRowSelection(){const t=this.$anchorCell.node(-1),i=Ve.get(t),n=this.$anchorCell.start(-1),r=i.colCount(this.$anchorCell.pos-n),a=i.colCount(this.$headCell.pos-n);if(Math.min(r,a)>0)return!1;const o=r+this.$anchorCell.nodeAfter.attrs.colspan,l=a+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==i.width}eq(t){return t instanceof Yt&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,i=t){const n=t.node(-1),r=Ve.get(n),a=t.start(-1),o=r.findCell(t.pos-a),l=r.findCell(i.pos-a),c=t.node(0);return o.left<=l.left?(o.left>0&&(t=c.resolve(a+r.map[o.top*r.width])),l.right<r.width&&(i=c.resolve(a+r.map[r.width*(l.top+1)-1]))):(l.left>0&&(i=c.resolve(a+r.map[l.top*r.width])),o.right<r.width&&(t=c.resolve(a+r.map[r.width*(o.top+1)-1]))),new Yt(t,i)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,i){return new Yt(t.resolve(i.anchor),t.resolve(i.head))}static create(t,i,n=i){return new Yt(t.resolve(i),t.resolve(n))}getBookmark(){return new nk(this.$anchorCell.pos,this.$headCell.pos)}};Ie.prototype.visible=!1;ve.jsonID("cell",Ie);var nk=class Xf{constructor(t,i){this.anchor=t,this.head=i}map(t){return new Xf(t.map(this.anchor),t.map(this.head))}resolve(t){const i=t.resolve(this.anchor),n=t.resolve(this.head);return i.parent.type.spec.tableRole=="row"&&n.parent.type.spec.tableRole=="row"&&i.index()<i.parent.childCount&&n.index()<n.parent.childCount&&$s(i,n)?new Ie(i,n):ve.near(n,1)}};function rk(e){if(!(e.selection instanceof Ie))return null;const t=[];return e.selection.forEachCell((i,n)=>{t.push(tt.node(n,n+i.nodeSize,{class:"selectedCell"}))}),Be.create(e.doc,t)}function ak({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let i=e.pos,n=t.pos,r=e.depth;for(;r>=0&&!(e.after(r+1)<e.end(r));r--,i++);for(let a=t.depth;a>=0&&!(t.before(a+1)>t.start(a));a--,n--);return i==n&&/row|table/.test(e.node(r).type.spec.tableRole)}function ok({$from:e,$to:t}){let i,n;for(let r=e.depth;r>0;r--){const a=e.node(r);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){i=a;break}}for(let r=t.depth;r>0;r--){const a=t.node(r);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){n=a;break}}return i!==n&&t.parentOffset===0}function sk(e,t,i){const n=(t||e).selection,r=(t||e).doc;let a,o;if(n instanceof de&&(o=n.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")a=Ie.create(r,n.from);else if(o=="row"){const l=r.resolve(n.from+1);a=Ie.rowSelection(l,l)}else if(!i){const l=Ve.get(n.node),c=n.from+1,f=c+l.map[l.width*l.height-1];a=Ie.create(r,c+1,f)}}else n instanceof he&&ak(n)?a=he.create(r,n.from):n instanceof he&&ok(n)&&(a=he.create(r,n.$from.start(),n.$from.end()));return a&&(t||(t=e.tr)).setSelection(a),t}const lk=new ot("fix-tables");function Jf(e,t,i,n){const r=e.childCount,a=t.childCount;e:for(let o=0,l=0;o<a;o++){const c=t.child(o);for(let f=l,p=Math.min(r,o+3);f<p;f++)if(e.child(f)==c){l=f+1,i+=c.nodeSize;continue e}n(c,i),l<r&&e.child(l).sameMarkup(c)?Jf(e.child(l),c,i+1,n):c.nodesBetween(0,c.content.size,n,i+1),i+=c.nodeSize}}function Zf(e,t){let i;const n=(r,a)=>{r.type.spec.tableRole=="table"&&(i=ck(e,r,a,i))};return t?t.doc!=e.doc&&Jf(t.doc,e.doc,0,n):e.doc.descendants(n),i}function ck(e,t,i,n){const r=Ve.get(t);if(!r.problems)return n;n||(n=e.tr);const a=[];for(let c=0;c<r.height;c++)a.push(0);for(let c=0;c<r.problems.length;c++){const f=r.problems[c];if(f.type=="collision"){const p=t.nodeAt(f.pos);if(!p)continue;const m=p.attrs;for(let d=0;d<m.rowspan;d++)a[f.row+d]+=f.n;n.setNodeMarkup(n.mapping.map(i+1+f.pos),null,qi(m,m.colspan-f.n,f.n))}else if(f.type=="missing")a[f.row]+=f.n;else if(f.type=="overlong_rowspan"){const p=t.nodeAt(f.pos);if(!p)continue;n.setNodeMarkup(n.mapping.map(i+1+f.pos),null,{...p.attrs,rowspan:p.attrs.rowspan-f.n})}else if(f.type=="colwidth mismatch"){const p=t.nodeAt(f.pos);if(!p)continue;n.setNodeMarkup(n.mapping.map(i+1+f.pos),null,{...p.attrs,colwidth:f.colwidth})}else if(f.type=="zero_sized"){const p=n.mapping.map(i);n.delete(p,p+t.nodeSize)}}let o,l;for(let c=0;c<a.length;c++)a[c]&&(o==null&&(o=c),l=c);for(let c=0,f=i+1;c<r.height;c++){const p=t.child(c),m=f+p.nodeSize,d=a[c];if(d>0){let h="cell";p.firstChild&&(h=p.firstChild.type.spec.tableRole);const v=[];for(let y=0;y<d;y++){const g=nt(e.schema)[h].createAndFill();g&&v.push(g)}const b=(c==0||o==c-1)&&l==c?f+1:m-1;n.insert(n.mapping.map(b),v)}f=m}return n.setMeta(lk,{fixTables:!0})}function Ut(e){const t=e.selection,i=$a(e),n=i.node(-1),r=i.start(-1),a=Ve.get(n);return{...t instanceof Ie?a.rectBetween(t.$anchorCell.pos-r,t.$headCell.pos-r):a.findCell(i.pos-r),tableStart:r,map:a,table:n}}function Qf(e,{map:t,tableStart:i,table:n},r){let a=r>0?-1:0;ik(t,n,r+a)&&(a=r==0||r==t.width?null:0);for(let o=0;o<t.height;o++){const l=o*t.width+r;if(r>0&&r<t.width&&t.map[l-1]==t.map[l]){const c=t.map[l],f=n.nodeAt(c);e.setNodeMarkup(e.mapping.map(i+c),null,Kf(f.attrs,r-t.colCount(c))),o+=f.attrs.rowspan-1}else{const c=a==null?nt(n.type.schema).cell:n.nodeAt(t.map[l+a]).type,f=t.positionAt(o,r,n);e.insert(e.mapping.map(i+f),c.createAndFill())}}return e}function uk(e,t){if(!Lt(e))return!1;if(t){const i=Ut(e);t(Qf(e.tr,i,i.left))}return!0}function fk(e,t){if(!Lt(e))return!1;if(t){const i=Ut(e);t(Qf(e.tr,i,i.right))}return!0}function pk(e,{map:t,table:i,tableStart:n},r){const a=e.mapping.maps.length;for(let o=0;o<t.height;){const l=o*t.width+r,c=t.map[l],f=i.nodeAt(c),p=f.attrs;if(r>0&&t.map[l-1]==c||r<t.width-1&&t.map[l+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(n+c),null,qi(p,r-t.colCount(c)));else{const m=e.mapping.slice(a).map(n+c);e.delete(m,m+f.nodeSize)}o+=p.rowspan}}function dk(e,t){if(!Lt(e))return!1;if(t){const i=Ut(e),n=e.tr;if(i.left==0&&i.right==i.map.width)return!1;for(let r=i.right-1;pk(n,i,r),r!=i.left;r--){const a=i.tableStart?n.doc.nodeAt(i.tableStart-1):n.doc;if(!a)throw new RangeError("No table found");i.table=a,i.map=Ve.get(a)}t(n)}return!0}function mk(e,t,i){var n;const r=nt(t.type.schema).header_cell;for(let a=0;a<e.width;a++)if(((n=t.nodeAt(e.map[a+i*e.width]))===null||n===void 0?void 0:n.type)!=r)return!1;return!0}function Yf(e,{map:t,tableStart:i,table:n},r){let a=i;for(let f=0;f<r;f++)a+=n.child(f).nodeSize;const o=[];let l=r>0?-1:0;mk(t,n,r+l)&&(l=r==0||r==t.height?null:0);for(let f=0,p=t.width*r;f<t.width;f++,p++)if(r>0&&r<t.height&&t.map[p]==t.map[p-t.width]){const m=t.map[p],d=n.nodeAt(m).attrs;e.setNodeMarkup(i+m,null,{...d,rowspan:d.rowspan+1}),f+=d.colspan-1}else{var c;const m=l==null?nt(n.type.schema).cell:(c=n.nodeAt(t.map[p+l*t.width]))===null||c===void 0?void 0:c.type,d=m==null?void 0:m.createAndFill();d&&o.push(d)}return e.insert(a,nt(n.type.schema).row.create(null,o)),e}function hk(e,t){if(!Lt(e))return!1;if(t){const i=Ut(e);t(Yf(e.tr,i,i.top))}return!0}function bk(e,t){if(!Lt(e))return!1;if(t){const i=Ut(e);t(Yf(e.tr,i,i.bottom))}return!0}function gk(e,{map:t,table:i,tableStart:n},r){let a=0;for(let f=0;f<r;f++)a+=i.child(f).nodeSize;const o=a+i.child(r).nodeSize,l=e.mapping.maps.length;e.delete(a+n,o+n);const c=new Set;for(let f=0,p=r*t.width;f<t.width;f++,p++){const m=t.map[p];if(!c.has(m)){if(c.add(m),r>0&&m==t.map[p-t.width]){const d=i.nodeAt(m).attrs;e.setNodeMarkup(e.mapping.slice(l).map(m+n),null,{...d,rowspan:d.rowspan-1}),f+=d.colspan-1}else if(r<t.height&&m==t.map[p+t.width]){const d=i.nodeAt(m),h=d.attrs,v=d.type.create({...h,rowspan:d.attrs.rowspan-1},d.content),b=t.positionAt(r+1,f,i);e.insert(e.mapping.slice(l).map(n+b),v),f+=h.colspan-1}}}}function vk(e,t){if(!Lt(e))return!1;if(t){const i=Ut(e),n=e.tr;if(i.top==0&&i.bottom==i.map.height)return!1;for(let r=i.bottom-1;gk(n,i,r),r!=i.top;r--){const a=i.tableStart?n.doc.nodeAt(i.tableStart-1):n.doc;if(!a)throw new RangeError("No table found");i.table=a,i.map=Ve.get(i.table)}t(n)}return!0}function dc(e){const t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function yk({width:e,height:t,map:i},n){let r=n.top*e+n.left,a=r,o=(n.bottom-1)*e+n.left,l=r+(n.right-n.left-1);for(let c=n.top;c<n.bottom;c++){if(n.left>0&&i[a]==i[a-1]||n.right<e&&i[l]==i[l+1])return!0;a+=e,l+=e}for(let c=n.left;c<n.right;c++){if(n.top>0&&i[r]==i[r-e]||n.bottom<t&&i[o]==i[o+e])return!0;r++,o++}return!1}function mc(e,t){const i=e.selection;if(!(i instanceof Ie)||i.$anchorCell.pos==i.$headCell.pos)return!1;const n=Ut(e),{map:r}=n;if(yk(r,n))return!1;if(t){const a=e.tr,o={};let l=Z.empty,c,f;for(let p=n.top;p<n.bottom;p++)for(let m=n.left;m<n.right;m++){const d=r.map[p*r.width+m],h=n.table.nodeAt(d);if(!(o[d]||!h))if(o[d]=!0,c==null)c=d,f=h;else{dc(h)||(l=l.append(h.content));const v=a.mapping.map(d+n.tableStart);a.delete(v,v+h.nodeSize)}}if(c==null||f==null)return!0;if(a.setNodeMarkup(c+n.tableStart,null,{...Kf(f.attrs,f.attrs.colspan,n.right-n.left-f.attrs.colspan),rowspan:n.bottom-n.top}),l.size>0){const p=c+1+f.content.size,m=dc(f)?c+1:p;a.replaceWith(m+n.tableStart,p+n.tableStart,l)}a.setSelection(new Ie(a.doc.resolve(c+n.tableStart))),t(a)}return!0}function hc(e,t){const i=nt(e.schema);return xk(({node:n})=>i[n.type.spec.tableRole])(e,t)}function xk(e){return(t,i)=>{const n=t.selection;let r,a;if(n instanceof Ie){if(n.$anchorCell.pos!=n.$headCell.pos)return!1;r=n.$anchorCell.nodeAfter,a=n.$anchorCell.pos}else{var o;if(r=Y1(n.$from),!r)return!1;a=(o=ji(n.$from))===null||o===void 0?void 0:o.pos}if(r==null||a==null||r.attrs.colspan==1&&r.attrs.rowspan==1)return!1;if(i){let l=r.attrs;const c=[],f=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const p=Ut(t),m=t.tr;for(let h=0;h<p.right-p.left;h++)c.push(f?{...l,colwidth:f&&f[h]?[f[h]]:null}:l);let d;for(let h=p.top;h<p.bottom;h++){let v=p.map.positionAt(h,p.left,p.table);h==p.top&&(v+=r.nodeSize);for(let b=p.left,y=0;b<p.right;b++,y++)b==p.left&&h==p.top||m.insert(d=m.mapping.map(v+p.tableStart,1),e({node:r,row:h,col:b}).createAndFill(c[y]))}m.setNodeMarkup(a,e({node:r,row:p.top,col:p.left}),c[0]),n instanceof Ie&&m.setSelection(new Ie(m.doc.resolve(n.$anchorCell.pos),d?m.doc.resolve(d):void 0)),i(m)}return!0}}function kk(e,t){return function(i,n){if(!Lt(i))return!1;const r=$a(i);if(r.nodeAfter.attrs[e]===t)return!1;if(n){const a=i.tr;i.selection instanceof Ie?i.selection.forEachCell((o,l)=>{o.attrs[e]!==t&&a.setNodeMarkup(l,null,{...o.attrs,[e]:t})}):a.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[e]:t}),n(a)}return!0}}function wk(e){return function(t,i){if(!Lt(t))return!1;if(i){const n=nt(t.schema),r=Ut(t),a=t.tr,o=r.map.cellsInRect(e=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:e=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),l=o.map(c=>r.table.nodeAt(c));for(let c=0;c<o.length;c++)l[c].type==n.header_cell&&a.setNodeMarkup(r.tableStart+o[c],n.cell,l[c].attrs);if(a.steps.length===0)for(let c=0;c<o.length;c++)a.setNodeMarkup(r.tableStart+o[c],n.header_cell,l[c].attrs);i(a)}return!0}}function bc(e,t,i){const n=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let r=0;r<n.length;r++){const a=t.table.nodeAt(n[r]);if(a&&a.type!==i.header_cell)return!1}return!0}function Gn(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?wk(e):function(i,n){if(!Lt(i))return!1;if(n){const r=nt(i.schema),a=Ut(i),o=i.tr,l=bc("row",a,r),c=bc("column",a,r),f=(e==="column"?l:e==="row"&&c)?1:0,p=e=="column"?{left:0,top:f,right:1,bottom:a.map.height}:e=="row"?{left:f,top:0,right:a.map.width,bottom:1}:a,m=e=="column"?c?r.cell:r.header_cell:e=="row"?l?r.cell:r.header_cell:r.cell;a.map.cellsInRect(p).forEach(d=>{const h=d+a.tableStart,v=o.doc.nodeAt(h);v&&o.setNodeMarkup(h,m,v.attrs)}),n(o)}return!0}}Gn("row",{useDeprecatedLogic:!0});Gn("column",{useDeprecatedLogic:!0});const _k=Gn("cell",{useDeprecatedLogic:!0});function Sk(e,t){if(t<0){const i=e.nodeBefore;if(i)return e.pos-i.nodeSize;for(let n=e.index(-1)-1,r=e.before();n>=0;n--){const a=e.node(-1).child(n),o=a.lastChild;if(o)return r-1-o.nodeSize;r-=a.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const i=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<i.childCount;n++){const a=i.child(n);if(a.childCount)return r+1;r+=a.nodeSize}}return null}function gc(e){return function(t,i){if(!Lt(t))return!1;const n=Sk($a(t),e);if(n==null)return!1;if(i){const r=t.doc.resolve(n);i(t.tr.setSelection(he.between(r,tk(r))).scrollIntoView())}return!0}}function Ck(e,t){const i=e.selection.$anchor;for(let n=i.depth;n>0;n--)if(i.node(n).type.spec.tableRole=="table")return t&&t(e.tr.delete(i.before(n),i.after(n)).scrollIntoView()),!0;return!1}function Mr(e,t){const i=e.selection;if(!(i instanceof Ie))return!1;if(t){const n=e.tr,r=nt(e.schema).cell.createAndFill().content;i.forEachCell((a,o)=>{a.content.eq(r)||n.replace(n.mapping.map(o+1),n.mapping.map(o+a.nodeSize-1),new ae(r,0,0))}),n.docChanged&&t(n)}return!0}function Ek(e){if(e.size===0)return null;let{content:t,openStart:i,openEnd:n}=e;for(;t.childCount==1&&(i>0&&n>0||t.child(0).type.spec.tableRole=="table");)i--,n--,t=t.child(0).content;const r=t.child(0),a=r.type.spec.tableRole,o=r.type.schema,l=[];if(a=="row")for(let c=0;c<t.childCount;c++){let f=t.child(c).content;const p=c?0:Math.max(0,i-1),m=c<t.childCount-1?0:Math.max(0,n-1);(p||m)&&(f=ts(nt(o).row,new ae(f,p,m)).content),l.push(f)}else if(a=="cell"||a=="header_cell")l.push(i||n?ts(nt(o).row,new ae(t,i,n)).content:t);else return null;return Nk(o,l)}function Nk(e,t){const i=[];for(let r=0;r<t.length;r++){const a=t[r];for(let o=a.childCount-1;o>=0;o--){const{rowspan:l,colspan:c}=a.child(o).attrs;for(let f=r;f<r+l;f++)i[f]=(i[f]||0)+c}}let n=0;for(let r=0;r<i.length;r++)n=Math.max(n,i[r]);for(let r=0;r<i.length;r++)if(r>=t.length&&t.push(Z.empty),i[r]<n){const a=nt(e).cell.createAndFill(),o=[];for(let l=i[r];l<n;l++)o.push(a);t[r]=t[r].append(Z.from(o))}return{height:t.length,width:n,rows:t}}function ts(e,t){const i=e.createAndFill();return new Pu(i).replace(0,i.content.size,t).doc}function Ak({width:e,height:t,rows:i},n,r){if(e!=n){const a=[],o=[];for(let l=0;l<i.length;l++){const c=i[l],f=[];for(let p=a[l]||0,m=0;p<n;m++){let d=c.child(m%c.childCount);p+d.attrs.colspan>n&&(d=d.type.createChecked(qi(d.attrs,d.attrs.colspan,p+d.attrs.colspan-n),d.content)),f.push(d),p+=d.attrs.colspan;for(let h=1;h<d.attrs.rowspan;h++)a[l+h]=(a[l+h]||0)+d.attrs.colspan}o.push(Z.from(f))}i=o,e=n}if(t!=r){const a=[];for(let o=0,l=0;o<r;o++,l++){const c=[],f=i[l%t];for(let p=0;p<f.childCount;p++){let m=f.child(p);o+m.attrs.rowspan>r&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,r-m.attrs.rowspan)},m.content)),c.push(m)}a.push(Z.from(c))}i=a,t=r}return{width:e,height:t,rows:i}}function Ok(e,t,i,n,r,a,o){const l=e.doc.type.schema,c=nt(l);let f,p;if(r>t.width)for(let m=0,d=0;m<t.height;m++){const h=i.child(m);d+=h.nodeSize;const v=[];let b;h.lastChild==null||h.lastChild.type==c.cell?b=f||(f=c.cell.createAndFill()):b=p||(p=c.header_cell.createAndFill());for(let y=t.width;y<r;y++)v.push(b);e.insert(e.mapping.slice(o).map(d-1+n),v)}if(a>t.height){const m=[];for(let v=0,b=(t.height-1)*t.width;v<Math.max(t.width,r);v++){const y=v>=t.width?!1:i.nodeAt(t.map[b+v]).type==c.header_cell;m.push(y?p||(p=c.header_cell.createAndFill()):f||(f=c.cell.createAndFill()))}const d=c.row.create(null,Z.from(m)),h=[];for(let v=t.height;v<a;v++)h.push(d);e.insert(e.mapping.slice(o).map(n+i.nodeSize-2),h)}return!!(f||p)}function vc(e,t,i,n,r,a,o,l){if(o==0||o==t.height)return!1;let c=!1;for(let f=r;f<a;f++){const p=o*t.width+f,m=t.map[p];if(t.map[p-t.width]==m){c=!0;const d=i.nodeAt(m),{top:h,left:v}=t.findCell(m);e.setNodeMarkup(e.mapping.slice(l).map(m+n),null,{...d.attrs,rowspan:o-h}),e.insert(e.mapping.slice(l).map(t.positionAt(o,v,i)),d.type.createAndFill({...d.attrs,rowspan:h+d.attrs.rowspan-o})),f+=d.attrs.colspan-1}}return c}function yc(e,t,i,n,r,a,o,l){if(o==0||o==t.width)return!1;let c=!1;for(let f=r;f<a;f++){const p=f*t.width+o,m=t.map[p];if(t.map[p-1]==m){c=!0;const d=i.nodeAt(m),h=t.colCount(m),v=e.mapping.slice(l).map(m+n);e.setNodeMarkup(v,null,qi(d.attrs,o-h,d.attrs.colspan-(o-h))),e.insert(v+d.nodeSize,d.type.createAndFill(qi(d.attrs,0,o-h))),f+=d.attrs.rowspan-1}}return c}function xc(e,t,i,n,r){let a=i?e.doc.nodeAt(i-1):e.doc;if(!a)throw new Error("No table found");let o=Ve.get(a);const{top:l,left:c}=n,f=c+r.width,p=l+r.height,m=e.tr;let d=0;function h(){if(a=i?m.doc.nodeAt(i-1):m.doc,!a)throw new Error("No table found");o=Ve.get(a),d=m.mapping.maps.length}Ok(m,o,a,i,f,p,d)&&h(),vc(m,o,a,i,c,f,l,d)&&h(),vc(m,o,a,i,c,f,p,d)&&h(),yc(m,o,a,i,l,p,c,d)&&h(),yc(m,o,a,i,l,p,f,d)&&h();for(let v=l;v<p;v++){const b=o.positionAt(v,c,a),y=o.positionAt(v,f,a);m.replace(m.mapping.slice(d).map(b+i),m.mapping.slice(d).map(y+i),new ae(r.rows[v-l],0,0))}h(),m.setSelection(new Ie(m.doc.resolve(i+o.positionAt(l,c,a)),m.doc.resolve(i+o.positionAt(p-1,f-1,a)))),t(m)}const Tk=Yy({ArrowLeft:zr("horiz",-1),ArrowRight:zr("horiz",1),ArrowUp:zr("vert",-1),ArrowDown:zr("vert",1),"Shift-ArrowLeft":Ir("horiz",-1),"Shift-ArrowRight":Ir("horiz",1),"Shift-ArrowUp":Ir("vert",-1),"Shift-ArrowDown":Ir("vert",1),Backspace:Mr,"Mod-Backspace":Mr,Delete:Mr,"Mod-Delete":Mr});function Hr(e,t,i){return i.eq(e.selection)?!1:(t&&t(e.tr.setSelection(i).scrollIntoView()),!0)}function zr(e,t){return(i,n,r)=>{if(!r)return!1;const a=i.selection;if(a instanceof Ie)return Hr(i,n,ve.near(a.$headCell,t));if(e!="horiz"&&!a.empty)return!1;const o=ep(r,e,t);if(o==null)return!1;if(e=="horiz")return Hr(i,n,ve.near(i.doc.resolve(a.head+t),t));{const l=i.doc.resolve(o),c=Gf(l,e,t);let f;return c?f=ve.near(c,1):t<0?f=ve.near(i.doc.resolve(l.before(-1)),-1):f=ve.near(i.doc.resolve(l.after(-1)),1),Hr(i,n,f)}}}function Ir(e,t){return(i,n,r)=>{if(!r)return!1;const a=i.selection;let o;if(a instanceof Ie)o=a;else{const c=ep(r,e,t);if(c==null)return!1;o=new Ie(i.doc.resolve(c))}const l=Gf(o.$headCell,e,t);return l?Hr(i,n,new Ie(o.$anchorCell,l)):!1}}function Mk(e,t){const i=e.state.doc,n=ji(i.resolve(t));return n?(e.dispatch(e.state.tr.setSelection(new Ie(n))),!0):!1}function zk(e,t,i){if(!Lt(e.state))return!1;let n=Ek(i);const r=e.state.selection;if(r instanceof Ie){n||(n={width:1,height:1,rows:[Z.from(ts(nt(e.state.schema).cell,i))]});const a=r.$anchorCell.node(-1),o=r.$anchorCell.start(-1),l=Ve.get(a).rectBetween(r.$anchorCell.pos-o,r.$headCell.pos-o);return n=Ak(n,l.right-l.left,l.bottom-l.top),xc(e.state,e.dispatch,o,l,n),!0}else if(n){const a=$a(e.state),o=a.start(-1);return xc(e.state,e.dispatch,o,Ve.get(a.node(-1)).findCell(a.pos-o),n),!0}else return!1}function Ik(e,t){var i;if(t.button!=0||t.ctrlKey||t.metaKey)return;const n=kc(e,t.target);let r;if(t.shiftKey&&e.state.selection instanceof Ie)a(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=ji(e.state.selection.$anchor))!=null&&((i=xo(e,t))===null||i===void 0?void 0:i.pos)!=r.pos)a(r,t),t.preventDefault();else if(!n)return;function a(c,f){let p=xo(e,f);const m=mi.getState(e.state)==null;if(!p||!$s(c,p))if(m)p=c;else return;const d=new Ie(c,p);if(m||!e.state.selection.eq(d)){const h=e.state.tr.setSelection(d);m&&h.setMeta(mi,c.pos),e.dispatch(h)}}function o(){e.root.removeEventListener("mouseup",o),e.root.removeEventListener("dragstart",o),e.root.removeEventListener("mousemove",l),mi.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(mi,-1))}function l(c){const f=c,p=mi.getState(e.state);let m;if(p!=null)m=e.state.doc.resolve(p);else if(kc(e,f.target)!=n&&(m=xo(e,t),!m))return o();m&&a(m,f)}e.root.addEventListener("mouseup",o),e.root.addEventListener("dragstart",o),e.root.addEventListener("mousemove",l)}function ep(e,t,i){if(!(e.state.selection instanceof he))return null;const{$head:n}=e.state.selection;for(let r=n.depth-1;r>=0;r--){const a=n.node(r);if((i<0?n.index(r):n.indexAfter(r))!=(i<0?0:a.childCount))return null;if(a.type.spec.tableRole=="cell"||a.type.spec.tableRole=="header_cell"){const o=n.before(r),l=t=="vert"?i>0?"down":"up":i>0?"right":"left";return e.endOfTextblock(l)?o:null}}return null}function kc(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function xo(e,t){const i=e.posAtCoords({left:t.clientX,top:t.clientY});if(!i)return null;let{inside:n,pos:r}=i;return n>=0&&ji(e.state.doc.resolve(n))||ji(e.state.doc.resolve(r))}var Dk=class{constructor(t,i){this.node=t,this.defaultCellMinWidth=i,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${i}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),is(t,this.colgroup,this.table,i),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,is(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function is(e,t,i,n,r,a){let o=0,l=!0,c=t.firstChild;const f=e.firstChild;if(f){for(let m=0,d=0;m<f.childCount;m++){const{colspan:h,colwidth:v}=f.child(m).attrs;for(let b=0;b<h;b++,d++){const y=r==d?a:v&&v[b],g=y?y+"px":"";if(o+=y||n,y||(l=!1),c)c.style.width!=g&&(c.style.width=g),c=c.nextSibling;else{const x=document.createElement("col");x.style.width=g,t.appendChild(x)}}}for(;c;){var p;const m=c.nextSibling;(p=c.parentNode)===null||p===void 0||p.removeChild(c),c=m}l?(i.style.width=o+"px",i.style.minWidth=""):(i.style.width="",i.style.minWidth=o+"px")}}const kt=new ot("tableColumnResizing");function Rk({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:i=100,View:n=Dk,lastColumnResizable:r=!0}={}){const a=new ft({key:kt,state:{init(o,l){var c;const f=(c=a.spec)===null||c===void 0||(c=c.props)===null||c===void 0?void 0:c.nodeViews,p=nt(l.schema).table.name;return n&&f&&(f[p]=(m,d)=>new n(m,i,d)),new Lk(-1,!1)},apply(o,l){return l.apply(o)}},props:{attributes:o=>{const l=kt.getState(o);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,l)=>{Bk(o,l,e,r)},mouseleave:o=>{Pk(o)},mousedown:(o,l)=>{Vk(o,l,t,i)}},decorations:o=>{const l=kt.getState(o);if(l&&l.activeHandle>-1)return qk(o,l.activeHandle)},nodeViews:{}}});return a}var Lk=class jr{constructor(t,i){this.activeHandle=t,this.dragging=i}apply(t){const i=this,n=t.getMeta(kt);if(n&&n.setHandle!=null)return new jr(n.setHandle,!1);if(n&&n.setDragging!==void 0)return new jr(i.activeHandle,n.setDragging);if(i.activeHandle>-1&&t.docChanged){let r=t.mapping.map(i.activeHandle,-1);return es(t.doc.resolve(r))||(r=-1),new jr(r,i.dragging)}return i}};function Bk(e,t,i,n){if(!e.editable)return;const r=kt.getState(e.state);if(r&&!r.dragging){const a=Uk(t.target);let o=-1;if(a){const{left:l,right:c}=a.getBoundingClientRect();t.clientX-l<=i?o=wc(e,t,"left",i):c-t.clientX<=i&&(o=wc(e,t,"right",i))}if(o!=r.activeHandle){if(!n&&o!==-1){const l=e.state.doc.resolve(o),c=l.node(-1),f=Ve.get(c),p=l.start(-1);if(f.colCount(l.pos-p)+l.nodeAfter.attrs.colspan-1==f.width-1)return}tp(e,o)}}}function Pk(e){if(!e.editable)return;const t=kt.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&tp(e,-1)}function Vk(e,t,i,n){var r;if(!e.editable)return!1;const a=(r=e.dom.ownerDocument.defaultView)!==null&&r!==void 0?r:window,o=kt.getState(e.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const l=e.state.doc.nodeAt(o.activeHandle),c=Fk(e,o.activeHandle,l.attrs);e.dispatch(e.state.tr.setMeta(kt,{setDragging:{startX:t.clientX,startWidth:c}}));function f(m){a.removeEventListener("mouseup",f),a.removeEventListener("mousemove",p);const d=kt.getState(e.state);d!=null&&d.dragging&&(Hk(e,d.activeHandle,_c(d.dragging,m,i)),e.dispatch(e.state.tr.setMeta(kt,{setDragging:null})))}function p(m){if(!m.which)return f(m);const d=kt.getState(e.state);if(d&&d.dragging){const h=_c(d.dragging,m,i);Sc(e,d.activeHandle,h,n)}}return Sc(e,o.activeHandle,c,n),a.addEventListener("mouseup",f),a.addEventListener("mousemove",p),t.preventDefault(),!0}function Fk(e,t,{colspan:i,colwidth:n}){const r=n&&n[n.length-1];if(r)return r;const a=e.domAtPos(t);let o=a.node.childNodes[a.offset].offsetWidth,l=i;if(n)for(let c=0;c<i;c++)n[c]&&(o-=n[c],l--);return o/l}function Uk(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function wc(e,t,i,n){const r=i=="right"?-n:n,a=e.posAtCoords({left:t.clientX+r,top:t.clientY});if(!a)return-1;const{pos:o}=a,l=ji(e.state.doc.resolve(o));if(!l)return-1;if(i=="right")return l.pos;const c=Ve.get(l.node(-1)),f=l.start(-1),p=c.map.indexOf(l.pos-f);return p%c.width==0?-1:f+c.map[p-1]}function _c(e,t,i){const n=t.clientX-e.startX;return Math.max(i,e.startWidth+n)}function tp(e,t){e.dispatch(e.state.tr.setMeta(kt,{setHandle:t}))}function Hk(e,t,i){const n=e.state.doc.resolve(t),r=n.node(-1),a=Ve.get(r),o=n.start(-1),l=a.colCount(n.pos-o)+n.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let f=0;f<a.height;f++){const p=f*a.width+l;if(f&&a.map[p]==a.map[p-a.width])continue;const m=a.map[p],d=r.nodeAt(m).attrs,h=d.colspan==1?0:l-a.colCount(m);if(d.colwidth&&d.colwidth[h]==i)continue;const v=d.colwidth?d.colwidth.slice():jk(d.colspan);v[h]=i,c.setNodeMarkup(o+m,null,{...d,colwidth:v})}c.docChanged&&e.dispatch(c)}function Sc(e,t,i,n){const r=e.state.doc.resolve(t),a=r.node(-1),o=r.start(-1),l=Ve.get(a).colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;let c=e.domAtPos(r.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&is(a,c.firstChild,c,n,l,i)}function jk(e){return Array(e).fill(0)}function qk(e,t){const i=[],n=e.doc.resolve(t),r=n.node(-1);if(!r)return Be.empty;const a=Ve.get(r),o=n.start(-1),l=a.colCount(n.pos-o)+n.nodeAfter.attrs.colspan-1;for(let f=0;f<a.height;f++){const p=l+f*a.width;if((l==a.width-1||a.map[p]!=a.map[p+1])&&(f==0||a.map[p]!=a.map[p-a.width])){var c;const m=a.map[p],d=o+m+r.nodeAt(m).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((c=kt.getState(e))===null||c===void 0)&&c.dragging&&i.push(tt.node(o+m,o+m+r.nodeAt(m).nodeSize,{class:"column-resize-dragging"})),i.push(tt.widget(d,h))}}return Be.create(e.doc,i)}function $k({allowTableNodeSelection:e=!1}={}){return new ft({key:mi,state:{init(){return null},apply(t,i){const n=t.getMeta(mi);if(n!=null)return n==-1?null:n;if(i==null||!t.docChanged)return i;const{deleted:r,pos:a}=t.mapping.mapResult(i);return r?null:a}},props:{decorations:rk,handleDOMEvents:{mousedown:Ik},createSelectionBetween(t){return mi.getState(t.state)!=null?t.state.selection:null},handleTripleClick:Mk,handleKeyDown:Tk,handlePaste:zk},appendTransaction(t,i,n){return sk(n,Zf(n,i),e)}})}function ns(e,t){return t?["width",`${Math.max(t,e)}px`]:["min-width",`${e}px`]}function Cc(e,t,i,n,r,a){var o;let l=0,c=!0,f=t.firstChild;const p=e.firstChild;if(p!==null)for(let m=0,d=0;m<p.childCount;m+=1){const{colspan:h,colwidth:v}=p.child(m).attrs;for(let b=0;b<h;b+=1,d+=1){const y=r===d?a:v&&v[b],g=y?`${y}px`:"";if(l+=y||n,y||(c=!1),f){if(f.style.width!==g){const[x,k]=ns(n,y);f.style.setProperty(x,k)}f=f.nextSibling}else{const x=document.createElement("col"),[k,w]=ns(n,y);x.style.setProperty(k,w),t.appendChild(x)}}}for(;f;){const m=f.nextSibling;(o=f.parentNode)===null||o===void 0||o.removeChild(f),f=m}c?(i.style.width=`${l}px`,i.style.minWidth=""):(i.style.width="",i.style.minWidth=`${l}px`)}class Wk{constructor(t,i){this.node=t,this.cellMinWidth=i,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Cc(t,this.colgroup,this.table,i),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,Cc(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){return t.type==="attributes"&&(t.target===this.table||this.colgroup.contains(t.target))}}function Gk(e,t,i,n){let r=0,a=!0;const o=[],l=e.firstChild;if(!l)return{};for(let m=0,d=0;m<l.childCount;m+=1){const{colspan:h,colwidth:v}=l.child(m).attrs;for(let b=0;b<h;b+=1,d+=1){const y=i===d?n:v&&v[b];r+=y||t,y||(a=!1);const[g,x]=ns(t,y);o.push(["col",{style:`${g}: ${x}`}])}}const c=a?`${r}px`:"",f=a?"":`${r}px`;return{colgroup:["colgroup",{},...o],tableWidth:c,tableMinWidth:f}}function Ec(e,t){return e.createAndFill()}function Kk(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;const t={};return Object.keys(e.nodes).forEach(i=>{const n=e.nodes[i];n.spec.tableRole&&(t[n.spec.tableRole]=n)}),e.cached.tableNodeTypes=t,t}function Xk(e,t,i,n,r){const a=Kk(e),o=[],l=[];for(let f=0;f<i;f+=1){const p=Ec(a.cell);if(p&&l.push(p),n){const m=Ec(a.header_cell);m&&o.push(m)}}const c=[];for(let f=0;f<t;f+=1)c.push(a.row.createChecked(null,n&&f===0?o:l));return a.table.createChecked(null,c)}function Jk(e){return e instanceof Ie}const Dr=({editor:e})=>{const{selection:t}=e.state;if(!Jk(t))return!1;let i=0;const n=Df(t.ranges[0].$from,a=>a.type.name==="table");return n==null||n.node.descendants(a=>{if(a.type.name==="table")return!1;["tableCell","tableHeader"].includes(a.type.name)&&(i+=1)}),i===t.ranges.length?(e.commands.deleteTable(),!0):!1},Zk=vt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Wk,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:e,HTMLAttributes:t}){const{colgroup:i,tableWidth:n,tableMinWidth:r}=Gk(e,this.options.cellMinWidth),a=["table",Fe(this.options.HTMLAttributes,t,{style:n?`width: ${n}`:`min-width: ${r}`}),i,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},a]:a},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:i=!0}={})=>({tr:n,dispatch:r,editor:a})=>{const o=Xk(a.schema,e,t,i);if(r){const l=n.selection.from+1;n.replaceSelectionWith(o).scrollIntoView().setSelection(he.near(n.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>uk(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>fk(e,t),deleteColumn:()=>({state:e,dispatch:t})=>dk(e,t),addRowBefore:()=>({state:e,dispatch:t})=>hk(e,t),addRowAfter:()=>({state:e,dispatch:t})=>bk(e,t),deleteRow:()=>({state:e,dispatch:t})=>vk(e,t),deleteTable:()=>({state:e,dispatch:t})=>Ck(e,t),mergeCells:()=>({state:e,dispatch:t})=>mc(e,t),splitCell:()=>({state:e,dispatch:t})=>hc(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>Gn("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>Gn("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>_k(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>mc(e,t)?!0:hc(e,t),setCellAttribute:(e,t)=>({state:i,dispatch:n})=>kk(e,t)(i,n),goToNextCell:()=>({state:e,dispatch:t})=>gc(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>gc(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&Zf(e),!0),setCellSelection:e=>({tr:t,dispatch:i})=>{if(i){const n=Ie.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Dr,"Mod-Backspace":Dr,Delete:Dr,"Mod-Delete":Dr}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Rk({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],$k({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){const t={name:e.name,options:e.options,storage:e.storage};return{tableRole:We(it(e,"tableRole",t))}}}),Qk=vt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:e}){return["tr",Fe(this.options.HTMLAttributes,e),0]}}),Yk=vt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:e}){return["td",Fe(this.options.HTMLAttributes,e),0]}}),ew=vt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:e}){return["th",Fe(this.options.HTMLAttributes,e),0]}}),tw=Ke.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ft({key:new ot("placeholder"),props:{decorations:({doc:e,selection:t})=>{const i=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=t,r=[];if(!i)return null;const a=this.editor.isEmpty;return e.descendants((o,l)=>{const c=n>=l&&n<=l+o.nodeSize,f=!o.isLeaf&&Rs(o);if((c||!this.options.showOnlyCurrent)&&f){const p=[this.options.emptyNodeClass];a&&p.push(this.options.emptyEditorClass);const m=tt.node(l,l+o.nodeSize,{class:p.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:c}):this.options.placeholder});r.push(m)}return this.options.includeChildren}),Be.create(e,r)}}})]}}),iw=e=>{if(!e.children.length)return;const t=e.querySelectorAll("span");t&&t.forEach(i=>{var n,r;const a=i.getAttribute("style"),o=(r=(n=i.parentElement)===null||n===void 0?void 0:n.closest("span"))===null||r===void 0?void 0:r.getAttribute("style");i.setAttribute("style",`${o};${a}`)})};xi.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:e=>e.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&iw(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return["span",Fe(this.options.HTMLAttributes,e),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:e})=>{const{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(i,n)=>{if(i.isTextblock)return!0;i.marks.filter(r=>r.type===this.type).some(r=>Object.values(r.attrs).some(a=>!!a))||e.removeMark(n,n+i.nodeSize,this.type)}),!0}}}});const nw=Ke.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;return(t=e.style.color)===null||t===void 0?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),rw=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,aw=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,ow=xi.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute("data-color")||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:e}){return["mark",Fe(this.options.HTMLAttributes,e),0]},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[J0({find:rw,type:this.type})]},addPasteRules(){return[Rf({find:aw,type:this.type})]}});_e.definePlugin({id:"formatting",tiptapExtensions:[b1],toolbar:[{id:"bold",label:"Bold",action:"toggleBold",iconComponent:"Bold"},{id:"italic",label:"Italic",action:"toggleItalic",iconComponent:"Italic"},{id:"underline",label:"Underline",action:"toggleUnderline",iconComponent:"Underline"},{id:"strike",label:"Strikethrough",action:"toggleStrike",iconComponent:"Strikethrough"}]});function en(e){return t=>t.commands.toggleHeading({level:e})}_e.definePlugin({id:"headings",toolbar:[{id:"heading-1",label:"Heading 1",action:"toggleHeading1",iconComponent:"Heading1"},{id:"heading-2",label:"Heading 2",action:"toggleHeading2",iconComponent:"Heading2"},{id:"heading-3",label:"Heading 3",action:"toggleHeading3",iconComponent:"Heading3"},{id:"heading-4",label:"Heading 4",action:"toggleHeading4",iconComponent:"Heading4"},{id:"heading-5",label:"Heading 5",action:"toggleHeading5",iconComponent:"Heading5"},{id:"heading-6",label:"Heading 6",action:"toggleHeading6",iconComponent:"Heading6"}],slashCommands:[{name:"Heading 1",command:"toggleHeading1"},{name:"Heading 2",command:"toggleHeading2"},{name:"Heading 3",command:"toggleHeading3"}],commands:{toggleHeading1:en(1),toggleHeading2:en(2),toggleHeading3:en(3),toggleHeading4:en(4),toggleHeading5:en(5),toggleHeading6:en(6)}});_e.definePlugin({id:"lists",tiptapExtensions:[g1,y1.configure({nested:!0})],toolbar:[{id:"bullet-list",label:"Bullet List",action:"toggleBulletList",iconComponent:"List"},{id:"ordered-list",label:"Ordered List",action:"toggleOrderedList",iconComponent:"ListOrdered"},{id:"task-list",label:"Task List",action:"toggleTaskList",iconComponent:"CheckSquare"}],slashCommands:[{name:"Bullet List",command:"toggleBulletList"},{name:"Ordered List",command:"toggleOrderedList"},{name:"Task List",command:"toggleTaskList"}]});function Rr(e){return t=>t.commands.setTextAlign(e)}_e.definePlugin({id:"alignment",tiptapExtensions:[x1.configure({types:["heading","paragraph"]})],toolbar:[{id:"align-left",label:"Align Left",action:"alignLeft",iconComponent:"AlignLeft"},{id:"align-center",label:"Align Center",action:"alignCenter",iconComponent:"AlignCenter"},{id:"align-right",label:"Align Right",action:"alignRight",iconComponent:"AlignRight"},{id:"align-justify",label:"Align Justify",action:"alignJustify",iconComponent:"AlignJustify"}],commands:{alignLeft:Rr("left"),alignCenter:Rr("center"),alignRight:Rr("right"),alignJustify:Rr("justify")}});_e.definePlugin({id:"link",tiptapExtensions:[W1.configure({openOnClick:!0})],toolbar:[{id:"set-link",label:"Link",action:"setLink",iconComponent:"Link"}],slashCommands:[{name:"Link",command:"setLink"}],commands:{setLink:(e,...t)=>{if(e.isActive("link"))return e.chain().focus().unsetLink().run();const i=t[0],n=(i==null?void 0:i.href)??(typeof window<"u"&&typeof window.prompt=="function"?window.prompt("Enter link URL:","https://"):null);return n?e.chain().focus().setLink({href:n,target:"_blank"}).run():!1}}});function sw(){return typeof document>"u"?Promise.resolve(null):new Promise(e=>{const t=document.createElement("input");t.type="file",t.accept="image/*";const i=()=>t.remove();t.onchange=()=>{var r;const n=((r=t.files)==null?void 0:r[0])??null;i(),e(n)},t.oncancel=()=>{i(),e(null)},document.body.appendChild(t),t.click()})}_e.definePlugin({id:"image",tiptapExtensions:[K1],toolbar:[{id:"insert-image",label:"Image",action:"insertImage",iconComponent:"Image"}],slashCommands:[{name:"Image",command:"insertImage"}],commands:{insertImage:(e,...t)=>{const i=t[0];if(i!=null&&i.src)return e.commands.setImage({src:i.src,alt:i.alt,title:i.title});const n=e.storage.editorContext,r=n==null?void 0:n.onImageUpload;if(r)return sw().then(async a=>{if(a)try{const o=await r(a);o!=null&&o.src&&e.commands.setImage({src:o.src,alt:o.alt,title:o.title})}catch(o){console.error("[image] upload failed:",o)}}),!0;if(typeof window<"u"&&typeof window.prompt=="function"){const a=window.prompt("Enter image URL:","https://");return a?e.commands.setImage({src:a}):!1}return!1}}});var lw=Zk.extend({renderHTML({node:e,HTMLAttributes:t}){let i=0;const n=e.firstChild;n&&n.forEach(c=>{i+=c.attrs.colspan||1});const r=[];let a=0,o=!1;if(i>0)for(let c=0;c<i;c++){let f=null;if(n){let p=0;n.forEach(m=>{const d=m.attrs.colspan||1;if(c>=p&&c<p+d){const h=m.attrs.colwidth;if(h&&Array.isArray(h)){const v=c-p,b=h[v];typeof b=="number"&&b>0&&(f=b)}}p+=d})}f&&(a+=f,o=!0),r.push(["col",f?{style:`width: ${f}px !important`,width:String(f)}:{}])}const l=Fe(t);if(o&&a>0){const c=l.style||"";l.style=c?`${c}; width: ${a}px !important`:`width: ${a}px !important`}return["table",l,["colgroup",...r],["tbody",0]]}}),cw=Yk.extend({addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),colwidth:{default:null,parseHTML:t=>{const i=t.getAttribute("width")||t.style.width;if(i){const r=parseInt(i,10);return isNaN(r)||r<=0?null:[r]}const n=t.getAttribute("colwidth");return n?n.split(",").map(r=>parseInt(r,10)).filter(r=>!isNaN(r)&&r>0):null},renderHTML:t=>{if(!t.colwidth||!Array.isArray(t.colwidth)||t.colwidth.length===0)return{};const i=t.colwidth.filter(r=>typeof r=="number"&&r>0);if(i.length===0)return{};const n=i[0];return{colwidth:i.join(","),style:`width: ${n}px !important`,width:String(n)}}}}}}),uw=ew.extend({addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),colwidth:{default:null,parseHTML:t=>{const i=t.getAttribute("width")||t.style.width;if(i){const r=parseInt(i,10);return isNaN(r)||r<=0?null:[r]}const n=t.getAttribute("colwidth");return n?n.split(",").map(r=>parseInt(r,10)).filter(r=>!isNaN(r)&&r>0):null},renderHTML:t=>{if(!t.colwidth||!Array.isArray(t.colwidth)||t.colwidth.length===0)return{};const i=t.colwidth.filter(r=>typeof r=="number"&&r>0);if(i.length===0)return{};const n=i[0];return{colwidth:i.join(","),style:`width: ${n}px !important`,width:String(n)}}}}}});_e.definePlugin({id:"table",tiptapExtensions:[lw.configure({resizable:!1}),Qk,cw,uw],toolbar:[{id:"insert-table",label:"Insert Table",action:"insertTable",args:[{rows:3,cols:3,withHeaderRow:!0}],iconComponent:"Table"}],slashCommands:[{name:"Table",command:"insertTable"}]});_e.definePlugin({id:"blockquote",toolbar:[{id:"blockquote",label:"Blockquote",action:"toggleBlockquote",iconComponent:"Quote"}],slashCommands:[{name:"Blockquote",command:"toggleBlockquote"}]});_e.definePlugin({id:"code-block",toolbar:[{id:"code-block",label:"Code Block",action:"toggleCodeBlock",iconComponent:"Code"}],slashCommands:[{name:"Code Block",command:"toggleCodeBlock"}]});function fw(e={}){return _e.definePlugin({id:"placeholder",tiptapExtensions:[tw.configure({placeholder:e.placeholder??"Start writing…"})]})}fw();var pw=vt.create({name:"pageBreak",group:"block",selectable:!1,draggable:!1,parseHTML(){return[{tag:'div[data-page-break="true"]'}]},renderHTML({HTMLAttributes:e}){return["div",Fe(e,{"data-page-break":"true","data-node-type":"pageBreak",class:"docs-editor-page-break"}),["span",{class:"docs-editor-page-break__label"},"Page break"]]},addNodeView(){return()=>{const e=document.createElement("div");e.className="docs-editor-page-break",e.setAttribute("data-page-break","true"),e.setAttribute("data-node-type","pageBreak"),e.setAttribute("contenteditable","false");const t=document.createElement("div");t.className="docs-editor-page-break__inner";const i=document.createElement("div");i.className="docs-editor-page-break__line";const n=document.createElement("span");return n.className="docs-editor-page-break__label-text",n.textContent="Page break",t.appendChild(i),t.appendChild(n),e.appendChild(t),{dom:e,contentDOM:void 0}}}});_e.definePlugin({id:"pageBreak",tiptapExtensions:[pw],toolbar:[{id:"insert-page-break",label:"Page Break",action:"insertPageBreak",iconComponent:"FileText"}],slashCommands:[{name:"Page Break",command:"insertPageBreak"}],commands:{insertPageBreak:e=>e.chain().focus().insertContent({type:"pageBreak"}).run()}});var dw=vt.create({name:"footnote",group:"inline",inline:!0,selectable:!0,draggable:!1,atom:!0,addAttributes(){return{content:{default:"",parseHTML:e=>e.getAttribute("data-footnote-content")??"",renderHTML:e=>({"data-footnote-content":e.content})},citationId:{default:null,parseHTML:e=>e.getAttribute("data-citation-id"),renderHTML:e=>e.citationId?{"data-citation-id":e.citationId}:{}},sourceId:{default:null,parseHTML:e=>e.getAttribute("data-footnote-source-id"),renderHTML:e=>e.sourceId?{"data-footnote-source-id":e.sourceId}:{}},locator:{default:"",parseHTML:e=>e.getAttribute("data-footnote-locator")??"",renderHTML:e=>e.locator?{"data-footnote-locator":e.locator}:{}}}},parseHTML(){return[{tag:'span[data-node-type="footnote"]'}]},renderHTML({HTMLAttributes:e}){return["span",Fe(e,{"data-node-type":"footnote",class:"docs-footnote-ref"}),"1"]},addNodeView(){return e=>{const t=e.node??e,i=t&&typeof t=="object"&&"attrs"in t?t.attrs:{},n=document.createElement("span");return n.className="docs-footnote-ref",n.setAttribute("data-node-type","footnote"),n.setAttribute("data-footnote-content",String(i.content??"")),i.sourceId&&(n.setAttribute("data-footnote-source-id",String(i.sourceId)),n.setAttribute("data-citation-id",String(i.citationId??"")),i.locator&&n.setAttribute("data-footnote-locator",String(i.locator))),n.textContent="1",{dom:n,update(r){try{const a=(r==null?void 0:r.attrs)??{};n.setAttribute("data-footnote-content",String(a.content??"")),a.sourceId?(n.setAttribute("data-footnote-source-id",String(a.sourceId)),n.setAttribute("data-citation-id",String(a.citationId??"")),a.locator&&n.setAttribute("data-footnote-locator",String(a.locator))):(n.removeAttribute("data-footnote-source-id"),n.removeAttribute("data-citation-id"),n.removeAttribute("data-footnote-locator"))}catch{}return!0}}}}});_e.definePlugin({id:"footnote",tiptapExtensions:[dw],toolbar:[{id:"insert-footnote",label:"Catatan Kaki",action:"insertFootnote",iconComponent:"FileText"}],slashCommands:[{name:"Catatan Kaki",command:"insertFootnote"}],commands:{insertFootnote:(e,...t)=>{const i=t[0];return e.chain().focus().insertContent({type:"footnote",attrs:{content:(i==null?void 0:i.content)??""}}).run()}}});function ip(e){const t=[];return e.descendants((i,n)=>{if(i.type.name==="heading"){const r=i.attrs.level;(r===1||r===2||r===3)&&t.push({level:r,text:i.textContent.trim(),pos:n})}return!0}),t}function mw(e){return ip(e.state.doc)}function np(e){let t=[];try{const n=e.view.dom.querySelector("[data-rm-pagination]");n&&(t=Array.from(n.querySelectorAll(".rm-page-break .breaker")).filter(r=>r instanceof HTMLElement))}catch{}if(t.length===0)return()=>null;const i=e.view.dom;return n=>{try{const a=e.view.coordsAtPos(n).top-i.getBoundingClientRect().top+i.scrollTop;let o=1;for(const l of t){if(a<l.offsetTop)return o;o++}return o}catch{return null}}}function hw(e,t,i){const n=e.nodes.tocEntry;return t.length===0?[n.create({level:1,pos:0})]:t.map(r=>{const a=[];r.text&&a.push(e.text(r.text));const o=i(r.pos);return o!==null&&a.push(e.nodes.tocPageNum.create({page:o})),n.create({level:r.level,pos:r.pos},a)})}function bw(e){const t=mw(e);if(t.length===0)return[{type:"tocEntry",attrs:{level:1,pos:0}}];const i=np(e);return t.map(n=>{const r=[];n.text&&r.push({type:"text",text:n.text});const a=i(n.pos);return a!==null&&r.push({type:"tocPageNum",attrs:{page:a}}),{type:"tocEntry",attrs:{level:n.level,pos:n.pos},...r.length>0?{content:r}:{}}})}function rp(e,t){const i=e.schema.nodes.toc;if(!i)return!1;const n=[];if(t.doc.descendants((a,o)=>a.type.name==="toc"?(n.push({pos:o,nodeSize:a.nodeSize}),!1):!0),n.length===0)return!1;const r=hw(e.schema,ip(t.doc),np(e));for(const a of n.reverse())t.replaceWith(a.pos,a.pos+a.nodeSize,i.create(null,r));return!0}function ap(e){const t=e.state.tr;return rp(e,t)?(e.view.dispatch(t),!0):!1}var gw=Ke.create({name:"tocCommands",addCommands(){return{insertToc:()=>({editor:e,chain:t})=>t().focus().insertContent({type:"toc",content:bw(e)}).run(),refreshToc:()=>({editor:e,tr:t})=>rp(e,t)}}}),vw=vt.create({name:"tocPageNum",inline:!0,group:"inline",atom:!0,selectable:!1,addAttributes(){return{page:{default:null,parseHTML:e=>Number(e.textContent)||null,renderHTML:e=>e.page?{"data-page":e.page}:{}}}},parseHTML(){return[{tag:"span[data-toc-page]"}]},renderHTML({node:e,HTMLAttributes:t}){return["span",Fe(t,{"data-toc-page":"",class:"docs-toc__page"}),String(e.attrs.page??"")]}}),yw=vt.create({name:"tocEntry",content:"inline*",defining:!0,addAttributes(){return{level:{default:1,parseHTML:e=>Number(e.getAttribute("data-level")??1),renderHTML:e=>({"data-level":e.level})},pos:{default:0,parseHTML:e=>Number(e.getAttribute("data-pos")??0),renderHTML:e=>({"data-pos":e.pos})}}},parseHTML(){return[{tag:"p[data-toc-entry]"}]},renderHTML({HTMLAttributes:e}){return["p",Fe(e,{"data-toc-entry":"",class:"docs-toc__entry"}),0]}}),xw=vt.create({name:"toc",group:"block",content:"tocEntry+",defining:!0,parseHTML(){return[{tag:"div[data-toc]"}]},renderHTML({HTMLAttributes:e}){return["div",Fe(e,{"data-toc":"",class:"docs-toc"}),0]},addNodeView(){return e=>{const t=e.editor,i=document.createElement("div");i.className="docs-toc",i.setAttribute("data-toc","");const n=document.createElement("div");n.className="docs-toc__chrome",n.contentEditable="false";const r=document.createElement("span");r.className="docs-toc__caption",r.textContent="Table of contents";const a=document.createElement("button");a.type="button",a.className="docs-toc__refresh",a.title="Refresh table of contents",a.textContent="⟳",n.appendChild(r),n.appendChild(a);const o=document.createElement("div");o.className="docs-toc__entries",i.appendChild(n),i.appendChild(o);const l=f=>{f.preventDefault(),ap(t)},c=f=>{var h,v;const p=(v=(h=f.target)==null?void 0:h.closest)==null?void 0:v.call(h,"[data-toc-entry]");if(!p)return;const m=Number(p.getAttribute("data-pos")??0),d=Math.min(Math.max(0,m),t.state.doc.content.size);t.chain().focus().setTextSelection(d).scrollIntoView().run()};return a.addEventListener("click",l),i.addEventListener("click",c),{dom:i,contentDOM:o,update(f){var p;return((p=f==null?void 0:f.type)==null?void 0:p.name)==="toc"},destroy(){a.removeEventListener("click",l),i.removeEventListener("click",c)}}}}});_e.definePlugin({id:"toc",tiptapExtensions:[vw,yw,xw,gw],slashCommands:[{name:"Table of contents",description:"Daftar isi",command:"insertToc"}],commands:{insertToc:e=>e.commands.insertToc(),refreshToc:e=>ap(e)}});_e.definePlugin({id:"font-size",tiptapExtensions:[_e.FontSizeExtension],commands:{setFontSize:(e,...t)=>{const i=t[0]||"16px";return i==="16px"?e.commands.unsetFontSize():e.commands.setFontSize(i),e.commands.focus(),!0}}});_e.definePlugin({id:"text-color",tiptapExtensions:[nw],toolbar:[{id:"text-color",label:"Text Color",action:"setTextColor",iconComponent:"Palette"}],commands:{setTextColor:(e,...t)=>{const i=t[0];return i?i==="default"?e.chain().focus().unsetColor().run():e.chain().focus().setColor(i).run():!1}}});var kw=ow.extend({parseHTML(){return[{tag:"mark"},{tag:"span",style:"background-color"}]},renderHTML({HTMLAttributes:e}){return["mark",Fe(this.options.HTMLAttributes,e),0]}});_e.definePlugin({id:"highlight",tiptapExtensions:[kw.configure({multicolor:!0})],toolbar:[{id:"highlight",label:"Highlight",action:"setHighlight",iconComponent:"Highlighter"}],commands:{setHighlight:(e,...t)=>{const i=t[0];return i?i==="default"?e.chain().focus().unsetHighlight().run():e.chain().focus().toggleHighlight({color:i}).run():e.chain().focus().toggleHighlight().run()}}});var Ze=new ot("docflow-ai"),Nc=1500;function rs(e){var t;return(t=e.storage.editorContext)==null?void 0:t.aiStream}function Ac(e,t,i){return{before:e.doc.textBetween(Math.max(0,t-Nc),t,`
15049
+ 3. "-" cannot repeat`);De.customSchemes.push([e,t])}function P1(){De.scanner=O1(De.customSchemes);for(let e=0;e<De.tokenQueue.length;e++)De.tokenQueue[e][1]({scanner:De.scanner});De.parser=I1(De.scanner.tokens);for(let e=0;e<De.pluginQueue.length;e++)De.pluginQueue[e][1]({scanner:De.scanner,parser:De.parser});return De.initialized=!0,De}function js(e){return De.initialized||P1(),D1(De.parser.start,e,qf(De.scanner.start,e))}js.scan=qf;function Wf(e,t=null,i=null){if(t&&typeof t=="object"){if(i)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);i=t,t=null}const n=new Hs(i),r=js(e),a=[];for(let o=0;o<r.length;o++){const l=r[o];l.isLink&&(!t||l.t===t)&&n.check(l)&&a.push(l.toFormattedObject(n))}return a}const qs="[\0-   ᠎ -\u2029  ]",V1=new RegExp(qs),F1=new RegExp(`${qs}$`),U1=new RegExp(qs,"g");function H1(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function j1(e){return new ft({key:new ot("autolink"),appendTransaction:(t,i,n)=>{const r=t.some(f=>f.docChanged)&&!i.doc.eq(n.doc),a=t.some(f=>f.getMeta("preventAutolink"));if(!r||a)return;const{tr:o}=n,l=x0(i.doc,[...t]);if(N0(l).forEach(({newRange:f})=>{const p=w0(n.doc,f,h=>h.isTextblock);let m,d;if(p.length>1)m=p[0],d=n.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(p.length){const h=n.doc.textBetween(f.from,f.to," "," ");if(!F1.test(h))return;m=p[0],d=n.doc.textBetween(m.pos,f.to,void 0," ")}if(m&&d){const h=d.split(V1).filter(Boolean);if(h.length<=0)return!1;const v=h[h.length-1],b=m.pos+d.lastIndexOf(v);if(!v)return!1;const y=js(v).map(g=>g.toObject(e.defaultProtocol));if(!H1(y))return!1;y.filter(g=>g.isLink).map(g=>({...g,from:b+g.start+1,to:b+g.end+1})).filter(g=>n.schema.marks.code?!n.doc.rangeHasMark(g.from,g.to,n.schema.marks.code):!0).filter(g=>e.validate(g.value)).filter(g=>e.shouldAutoLink(g.value)).forEach(g=>{Ds(g.from,g.to,n.doc).some(x=>x.mark.type===e.type)||o.addMark(g.from,g.to,e.type.create({href:g.href}))})}}),!!o.steps.length)return o}})}function q1(e){return new ft({key:new ot("handleClickLink"),props:{handleClick:(t,i,n)=>{var r,a;if(n.button!==0||!t.editable)return!1;let o=n.target;const l=[];for(;o.nodeName!=="DIV";)l.push(o),o=o.parentNode;if(!l.find(d=>d.nodeName==="A"))return!1;const c=S0(t.state,e.type.name),f=n.target,p=(r=f==null?void 0:f.href)!==null&&r!==void 0?r:c.href,m=(a=f==null?void 0:f.target)!==null&&a!==void 0?a:c.target;return f&&p?(window.open(p,m),!0):!1}}})}function $1(e){return new ft({key:new ot("handlePasteLink"),props:{handlePaste:(t,i,n)=>{const{state:r}=t,{selection:a}=r,{empty:o}=a;if(o)return!1;let l="";n.content.forEach(f=>{l+=f.textContent});const c=Wf(l,{defaultProtocol:e.defaultProtocol}).find(f=>f.isLink&&f.value===l);return!l||!c?!1:e.editor.commands.setMark(e.type,{href:c.href})}}})}function Mi(e,t){const i=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(n=>{const r=typeof n=="string"?n:n.scheme;r&&i.push(r)}),!e||e.replace(U1,"").match(new RegExp(`^(?:(?:${i.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const W1=xi.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e=="string"){pc(e);return}pc(e.scheme,e.optionalSlashes)})},onDestroy(){B1()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!Mi(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:i=>!!Mi(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!Mi(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Fe(this.options.HTMLAttributes,e),0]:["a",Fe(this.options.HTMLAttributes,{...e,href:""}),0]},addCommands(){return{setLink:e=>({chain:t})=>{const{href:i}=e;return this.options.isAllowedUri(i,{defaultValidate:n=>!!Mi(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:i}=e;return this.options.isAllowedUri(i,{defaultValidate:n=>!!Mi(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Rf({find:e=>{const t=[];if(e){const{protocols:i,defaultProtocol:n}=this.options,r=Wf(e).filter(a=>a.isLink&&this.options.isAllowedUri(a.value,{defaultValidate:o=>!!Mi(o,i),protocols:i,defaultProtocol:n}));r.length&&r.forEach(a=>t.push({text:a.value,data:{href:a.href},index:a.start}))}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)===null||t===void 0?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:i}=this.options;return this.options.autolink&&e.push(j1({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:n=>this.options.isAllowedUri(n,{defaultValidate:r=>!!Mi(r,t),protocols:t,defaultProtocol:i}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&e.push(q1({type:this.type})),this.options.linkOnPaste&&e.push($1({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),e}}),G1=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,K1=vt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",Fe(this.options.HTMLAttributes,e)]},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[Z0({find:G1,type:this.type,getAttributes:e=>{const[,,t,i,n]=e;return{src:i,alt:t,title:n}}})]}});let Qo,Yo;if(typeof WeakMap<"u"){let e=new WeakMap;Qo=t=>e.get(t),Yo=(t,i)=>(e.set(t,i),i)}else{const e=[];let i=0;Qo=n=>{for(let r=0;r<e.length;r+=2)if(e[r]==n)return e[r+1]},Yo=(n,r)=>(i==10&&(i=0),e[i++]=n,e[i++]=r)}var Ve=class{constructor(e,t,i,n){this.width=e,this.height=t,this.map=i,this.problems=n}findCell(e){for(let t=0;t<this.map.length;t++){const i=this.map[t];if(i!=e)continue;const n=t%this.width,r=t/this.width|0;let a=n+1,o=r+1;for(let l=1;a<this.width&&this.map[t+l]==i;l++)a++;for(let l=1;o<this.height&&this.map[t+this.width*l]==i;l++)o++;return{left:n,top:r,right:a,bottom:o}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,i){const{left:n,right:r,top:a,bottom:o}=this.findCell(e);return t=="horiz"?(i<0?n==0:r==this.width)?null:this.map[a*this.width+(i<0?n-1:r)]:(i<0?a==0:o==this.height)?null:this.map[n+this.width*(i<0?a-1:o)]}rectBetween(e,t){const{left:i,right:n,top:r,bottom:a}=this.findCell(e),{left:o,right:l,top:c,bottom:f}=this.findCell(t);return{left:Math.min(i,o),top:Math.min(r,c),right:Math.max(n,l),bottom:Math.max(a,f)}}cellsInRect(e){const t=[],i={};for(let n=e.top;n<e.bottom;n++)for(let r=e.left;r<e.right;r++){const a=n*this.width+r,o=this.map[a];i[o]||(i[o]=!0,!(r==e.left&&r&&this.map[a-1]==o||n==e.top&&n&&this.map[a-this.width]==o)&&t.push(o))}return t}positionAt(e,t,i){for(let n=0,r=0;;n++){const a=r+i.child(n).nodeSize;if(n==e){let o=t+e*this.width;const l=(e+1)*this.width;for(;o<l&&this.map[o]<r;)o++;return o==l?a-1:this.map[o]}r=a}}static get(e){return Qo(e)||Yo(e,X1(e))}};function X1(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=J1(e),i=e.childCount,n=[];let r=0,a=null;const o=[];for(let f=0,p=t*i;f<p;f++)n[f]=0;for(let f=0,p=0;f<i;f++){const m=e.child(f);p++;for(let v=0;;v++){for(;r<n.length&&n[r]!=0;)r++;if(v==m.childCount)break;const b=m.child(v),{colspan:y,rowspan:g,colwidth:x}=b.attrs;for(let k=0;k<g;k++){if(k+f>=i){(a||(a=[])).push({type:"overlong_rowspan",pos:p,n:g-k});break}const w=r+k*t;for(let C=0;C<y;C++){n[w+C]==0?n[w+C]=p:(a||(a=[])).push({type:"collision",row:f,pos:p,n:y-C});const E=x&&x[C];if(E){const B=(w+C)%t*2,_=o[B];_==null||_!=E&&o[B+1]==1?(o[B]=E,o[B+1]=1):_==E&&o[B+1]++}}}r+=y,p+=b.nodeSize}const d=(f+1)*t;let h=0;for(;r<d;)n[r++]==0&&h++;h&&(a||(a=[])).push({type:"missing",row:f,n:h}),p++}(t===0||i===0)&&(a||(a=[])).push({type:"zero_sized"});const l=new Ve(t,i,n,a);let c=!1;for(let f=0;!c&&f<o.length;f+=2)o[f]!=null&&o[f+1]<i&&(c=!0);return c&&Z1(l,o,e),l}function J1(e){let t=-1,i=!1;for(let n=0;n<e.childCount;n++){const r=e.child(n);let a=0;if(i)for(let o=0;o<n;o++){const l=e.child(o);for(let c=0;c<l.childCount;c++){const f=l.child(c);o+f.attrs.rowspan>n&&(a+=f.attrs.colspan)}}for(let o=0;o<r.childCount;o++){const l=r.child(o);a+=l.attrs.colspan,l.attrs.rowspan>1&&(i=!0)}t==-1?t=a:t!=a&&(t=Math.max(t,a))}return t}function Z1(e,t,i){e.problems||(e.problems=[]);const n={};for(let r=0;r<e.map.length;r++){const a=e.map[r];if(n[a])continue;n[a]=!0;const o=i.nodeAt(a);if(!o)throw new RangeError(`No cell with offset ${a} found`);let l=null;const c=o.attrs;for(let f=0;f<c.colspan;f++){const p=t[(r+f)%e.width*2];p!=null&&(!c.colwidth||c.colwidth[f]!=p)&&((l||(l=Q1(c)))[f]=p)}l&&e.problems.unshift({type:"colwidth mismatch",pos:a,colwidth:l})}}function Q1(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let i=0;i<e.colspan;i++)t.push(0);return t}function nt(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const i in e.nodes){const n=e.nodes[i],r=n.spec.tableRole;r&&(t[r]=n)}}return t}const mi=new ot("selectingCells");function ji(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function Y1(e){for(let t=e.depth;t>0;t--){const i=e.node(t).type.spec.tableRole;if(i==="cell"||i==="header_cell")return e.node(t)}return null}function Lt(e){const t=e.selection.$head;for(let i=t.depth;i>0;i--)if(t.node(i).type.spec.tableRole=="row")return!0;return!1}function $a(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const i=ji(t.$head)||ek(t.$head);if(i)return i;throw new RangeError(`No cell found around position ${t.head}`)}function ek(e){for(let t=e.nodeAfter,i=e.pos;t;t=t.firstChild,i++){const n=t.type.spec.tableRole;if(n=="cell"||n=="header_cell")return e.doc.resolve(i)}for(let t=e.nodeBefore,i=e.pos;t;t=t.lastChild,i--){const n=t.type.spec.tableRole;if(n=="cell"||n=="header_cell")return e.doc.resolve(i-t.nodeSize)}}function es(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function tk(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function $s(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function Gf(e,t,i){const n=e.node(-1),r=Ve.get(n),a=e.start(-1),o=r.nextCell(e.pos-a,t,i);return o==null?null:e.node(0).resolve(a+o)}function qi(e,t,i=1){const n={...e,colspan:e.colspan-i};return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(t,i),n.colwidth.some(r=>r>0)||(n.colwidth=null)),n}function Kf(e,t,i=1){const n={...e,colspan:e.colspan+i};if(n.colwidth){n.colwidth=n.colwidth.slice();for(let r=0;r<i;r++)n.colwidth.splice(t,0,0)}return n}function ik(e,t,i){const n=nt(t.type.schema).header_cell;for(let r=0;r<e.height;r++)if(t.nodeAt(e.map[i+r*e.width]).type!=n)return!1;return!0}var Ie=class Yt extends ve{constructor(t,i=t){const n=t.node(-1),r=Ve.get(n),a=t.start(-1),o=r.rectBetween(t.pos-a,i.pos-a),l=t.node(0),c=r.cellsInRect(o).filter(p=>p!=i.pos-a);c.unshift(i.pos-a);const f=c.map(p=>{const m=n.nodeAt(p);if(!m)throw new RangeError(`No cell with offset ${p} found`);const d=a+p+1;return new Vu(l.resolve(d),l.resolve(d+m.content.size))});super(f[0].$from,f[0].$to,f),this.$anchorCell=t,this.$headCell=i}map(t,i){const n=t.resolve(i.map(this.$anchorCell.pos)),r=t.resolve(i.map(this.$headCell.pos));if(es(n)&&es(r)&&$s(n,r)){const a=this.$anchorCell.node(-1)!=n.node(-1);return a&&this.isRowSelection()?Yt.rowSelection(n,r):a&&this.isColSelection()?Yt.colSelection(n,r):new Yt(n,r)}return he.between(n,r)}content(){const t=this.$anchorCell.node(-1),i=Ve.get(t),n=this.$anchorCell.start(-1),r=i.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),a={},o=[];for(let c=r.top;c<r.bottom;c++){const f=[];for(let p=c*i.width+r.left,m=r.left;m<r.right;m++,p++){const d=i.map[p];if(a[d])continue;a[d]=!0;const h=i.findCell(d);let v=t.nodeAt(d);if(!v)throw new RangeError(`No cell with offset ${d} found`);const b=r.left-h.left,y=h.right-r.right;if(b>0||y>0){let g=v.attrs;if(b>0&&(g=qi(g,0,b)),y>0&&(g=qi(g,g.colspan-y,y)),h.left<r.left){if(v=v.type.createAndFill(g),!v)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(g)}`)}else v=v.type.create(g,v.content)}if(h.top<r.top||h.bottom>r.bottom){const g={...v.attrs,rowspan:Math.min(h.bottom,r.bottom)-Math.max(h.top,r.top)};h.top<r.top?v=v.type.createAndFill(g):v=v.type.create(g,v.content)}f.push(v)}o.push(t.child(c).copy(Z.from(f)))}const l=this.isColSelection()&&this.isRowSelection()?t:o;return new ae(Z.from(l),1,1)}replace(t,i=ae.empty){const n=t.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){const{$from:l,$to:c}=r[o],f=t.mapping.slice(n);t.replace(f.map(l.pos),f.map(c.pos),o?ae.empty:i)}const a=ve.findFrom(t.doc.resolve(t.mapping.slice(n).map(this.to)),-1);a&&t.setSelection(a)}replaceWith(t,i){this.replace(t,new ae(Z.from(i),0,0))}forEachCell(t){const i=this.$anchorCell.node(-1),n=Ve.get(i),r=this.$anchorCell.start(-1),a=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let o=0;o<a.length;o++)t(i.nodeAt(a[o]),r+a[o])}isColSelection(){const t=this.$anchorCell.index(-1),i=this.$headCell.index(-1);if(Math.min(t,i)>0)return!1;const n=t+this.$anchorCell.nodeAfter.attrs.rowspan,r=i+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,i=t){const n=t.node(-1),r=Ve.get(n),a=t.start(-1),o=r.findCell(t.pos-a),l=r.findCell(i.pos-a),c=t.node(0);return o.top<=l.top?(o.top>0&&(t=c.resolve(a+r.map[o.left])),l.bottom<r.height&&(i=c.resolve(a+r.map[r.width*(r.height-1)+l.right-1]))):(l.top>0&&(i=c.resolve(a+r.map[l.left])),o.bottom<r.height&&(t=c.resolve(a+r.map[r.width*(r.height-1)+o.right-1]))),new Yt(t,i)}isRowSelection(){const t=this.$anchorCell.node(-1),i=Ve.get(t),n=this.$anchorCell.start(-1),r=i.colCount(this.$anchorCell.pos-n),a=i.colCount(this.$headCell.pos-n);if(Math.min(r,a)>0)return!1;const o=r+this.$anchorCell.nodeAfter.attrs.colspan,l=a+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,l)==i.width}eq(t){return t instanceof Yt&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,i=t){const n=t.node(-1),r=Ve.get(n),a=t.start(-1),o=r.findCell(t.pos-a),l=r.findCell(i.pos-a),c=t.node(0);return o.left<=l.left?(o.left>0&&(t=c.resolve(a+r.map[o.top*r.width])),l.right<r.width&&(i=c.resolve(a+r.map[r.width*(l.top+1)-1]))):(l.left>0&&(i=c.resolve(a+r.map[l.top*r.width])),o.right<r.width&&(t=c.resolve(a+r.map[r.width*(o.top+1)-1]))),new Yt(t,i)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,i){return new Yt(t.resolve(i.anchor),t.resolve(i.head))}static create(t,i,n=i){return new Yt(t.resolve(i),t.resolve(n))}getBookmark(){return new nk(this.$anchorCell.pos,this.$headCell.pos)}};Ie.prototype.visible=!1;ve.jsonID("cell",Ie);var nk=class Xf{constructor(t,i){this.anchor=t,this.head=i}map(t){return new Xf(t.map(this.anchor),t.map(this.head))}resolve(t){const i=t.resolve(this.anchor),n=t.resolve(this.head);return i.parent.type.spec.tableRole=="row"&&n.parent.type.spec.tableRole=="row"&&i.index()<i.parent.childCount&&n.index()<n.parent.childCount&&$s(i,n)?new Ie(i,n):ve.near(n,1)}};function rk(e){if(!(e.selection instanceof Ie))return null;const t=[];return e.selection.forEachCell((i,n)=>{t.push(tt.node(n,n+i.nodeSize,{class:"selectedCell"}))}),Be.create(e.doc,t)}function ak({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let i=e.pos,n=t.pos,r=e.depth;for(;r>=0&&!(e.after(r+1)<e.end(r));r--,i++);for(let a=t.depth;a>=0&&!(t.before(a+1)>t.start(a));a--,n--);return i==n&&/row|table/.test(e.node(r).type.spec.tableRole)}function ok({$from:e,$to:t}){let i,n;for(let r=e.depth;r>0;r--){const a=e.node(r);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){i=a;break}}for(let r=t.depth;r>0;r--){const a=t.node(r);if(a.type.spec.tableRole==="cell"||a.type.spec.tableRole==="header_cell"){n=a;break}}return i!==n&&t.parentOffset===0}function sk(e,t,i){const n=(t||e).selection,r=(t||e).doc;let a,o;if(n instanceof de&&(o=n.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")a=Ie.create(r,n.from);else if(o=="row"){const l=r.resolve(n.from+1);a=Ie.rowSelection(l,l)}else if(!i){const l=Ve.get(n.node),c=n.from+1,f=c+l.map[l.width*l.height-1];a=Ie.create(r,c+1,f)}}else n instanceof he&&ak(n)?a=he.create(r,n.from):n instanceof he&&ok(n)&&(a=he.create(r,n.$from.start(),n.$from.end()));return a&&(t||(t=e.tr)).setSelection(a),t}const lk=new ot("fix-tables");function Jf(e,t,i,n){const r=e.childCount,a=t.childCount;e:for(let o=0,l=0;o<a;o++){const c=t.child(o);for(let f=l,p=Math.min(r,o+3);f<p;f++)if(e.child(f)==c){l=f+1,i+=c.nodeSize;continue e}n(c,i),l<r&&e.child(l).sameMarkup(c)?Jf(e.child(l),c,i+1,n):c.nodesBetween(0,c.content.size,n,i+1),i+=c.nodeSize}}function Zf(e,t){let i;const n=(r,a)=>{r.type.spec.tableRole=="table"&&(i=ck(e,r,a,i))};return t?t.doc!=e.doc&&Jf(t.doc,e.doc,0,n):e.doc.descendants(n),i}function ck(e,t,i,n){const r=Ve.get(t);if(!r.problems)return n;n||(n=e.tr);const a=[];for(let c=0;c<r.height;c++)a.push(0);for(let c=0;c<r.problems.length;c++){const f=r.problems[c];if(f.type=="collision"){const p=t.nodeAt(f.pos);if(!p)continue;const m=p.attrs;for(let d=0;d<m.rowspan;d++)a[f.row+d]+=f.n;n.setNodeMarkup(n.mapping.map(i+1+f.pos),null,qi(m,m.colspan-f.n,f.n))}else if(f.type=="missing")a[f.row]+=f.n;else if(f.type=="overlong_rowspan"){const p=t.nodeAt(f.pos);if(!p)continue;n.setNodeMarkup(n.mapping.map(i+1+f.pos),null,{...p.attrs,rowspan:p.attrs.rowspan-f.n})}else if(f.type=="colwidth mismatch"){const p=t.nodeAt(f.pos);if(!p)continue;n.setNodeMarkup(n.mapping.map(i+1+f.pos),null,{...p.attrs,colwidth:f.colwidth})}else if(f.type=="zero_sized"){const p=n.mapping.map(i);n.delete(p,p+t.nodeSize)}}let o,l;for(let c=0;c<a.length;c++)a[c]&&(o==null&&(o=c),l=c);for(let c=0,f=i+1;c<r.height;c++){const p=t.child(c),m=f+p.nodeSize,d=a[c];if(d>0){let h="cell";p.firstChild&&(h=p.firstChild.type.spec.tableRole);const v=[];for(let y=0;y<d;y++){const g=nt(e.schema)[h].createAndFill();g&&v.push(g)}const b=(c==0||o==c-1)&&l==c?f+1:m-1;n.insert(n.mapping.map(b),v)}f=m}return n.setMeta(lk,{fixTables:!0})}function Ht(e){const t=e.selection,i=$a(e),n=i.node(-1),r=i.start(-1),a=Ve.get(n);return{...t instanceof Ie?a.rectBetween(t.$anchorCell.pos-r,t.$headCell.pos-r):a.findCell(i.pos-r),tableStart:r,map:a,table:n}}function Qf(e,{map:t,tableStart:i,table:n},r){let a=r>0?-1:0;ik(t,n,r+a)&&(a=r==0||r==t.width?null:0);for(let o=0;o<t.height;o++){const l=o*t.width+r;if(r>0&&r<t.width&&t.map[l-1]==t.map[l]){const c=t.map[l],f=n.nodeAt(c);e.setNodeMarkup(e.mapping.map(i+c),null,Kf(f.attrs,r-t.colCount(c))),o+=f.attrs.rowspan-1}else{const c=a==null?nt(n.type.schema).cell:n.nodeAt(t.map[l+a]).type,f=t.positionAt(o,r,n);e.insert(e.mapping.map(i+f),c.createAndFill())}}return e}function uk(e,t){if(!Lt(e))return!1;if(t){const i=Ht(e);t(Qf(e.tr,i,i.left))}return!0}function fk(e,t){if(!Lt(e))return!1;if(t){const i=Ht(e);t(Qf(e.tr,i,i.right))}return!0}function pk(e,{map:t,table:i,tableStart:n},r){const a=e.mapping.maps.length;for(let o=0;o<t.height;){const l=o*t.width+r,c=t.map[l],f=i.nodeAt(c),p=f.attrs;if(r>0&&t.map[l-1]==c||r<t.width-1&&t.map[l+1]==c)e.setNodeMarkup(e.mapping.slice(a).map(n+c),null,qi(p,r-t.colCount(c)));else{const m=e.mapping.slice(a).map(n+c);e.delete(m,m+f.nodeSize)}o+=p.rowspan}}function dk(e,t){if(!Lt(e))return!1;if(t){const i=Ht(e),n=e.tr;if(i.left==0&&i.right==i.map.width)return!1;for(let r=i.right-1;pk(n,i,r),r!=i.left;r--){const a=i.tableStart?n.doc.nodeAt(i.tableStart-1):n.doc;if(!a)throw new RangeError("No table found");i.table=a,i.map=Ve.get(a)}t(n)}return!0}function mk(e,t,i){var n;const r=nt(t.type.schema).header_cell;for(let a=0;a<e.width;a++)if(((n=t.nodeAt(e.map[a+i*e.width]))===null||n===void 0?void 0:n.type)!=r)return!1;return!0}function Yf(e,{map:t,tableStart:i,table:n},r){let a=i;for(let f=0;f<r;f++)a+=n.child(f).nodeSize;const o=[];let l=r>0?-1:0;mk(t,n,r+l)&&(l=r==0||r==t.height?null:0);for(let f=0,p=t.width*r;f<t.width;f++,p++)if(r>0&&r<t.height&&t.map[p]==t.map[p-t.width]){const m=t.map[p],d=n.nodeAt(m).attrs;e.setNodeMarkup(i+m,null,{...d,rowspan:d.rowspan+1}),f+=d.colspan-1}else{var c;const m=l==null?nt(n.type.schema).cell:(c=n.nodeAt(t.map[p+l*t.width]))===null||c===void 0?void 0:c.type,d=m==null?void 0:m.createAndFill();d&&o.push(d)}return e.insert(a,nt(n.type.schema).row.create(null,o)),e}function hk(e,t){if(!Lt(e))return!1;if(t){const i=Ht(e);t(Yf(e.tr,i,i.top))}return!0}function bk(e,t){if(!Lt(e))return!1;if(t){const i=Ht(e);t(Yf(e.tr,i,i.bottom))}return!0}function gk(e,{map:t,table:i,tableStart:n},r){let a=0;for(let f=0;f<r;f++)a+=i.child(f).nodeSize;const o=a+i.child(r).nodeSize,l=e.mapping.maps.length;e.delete(a+n,o+n);const c=new Set;for(let f=0,p=r*t.width;f<t.width;f++,p++){const m=t.map[p];if(!c.has(m)){if(c.add(m),r>0&&m==t.map[p-t.width]){const d=i.nodeAt(m).attrs;e.setNodeMarkup(e.mapping.slice(l).map(m+n),null,{...d,rowspan:d.rowspan-1}),f+=d.colspan-1}else if(r<t.height&&m==t.map[p+t.width]){const d=i.nodeAt(m),h=d.attrs,v=d.type.create({...h,rowspan:d.attrs.rowspan-1},d.content),b=t.positionAt(r+1,f,i);e.insert(e.mapping.slice(l).map(n+b),v),f+=h.colspan-1}}}}function vk(e,t){if(!Lt(e))return!1;if(t){const i=Ht(e),n=e.tr;if(i.top==0&&i.bottom==i.map.height)return!1;for(let r=i.bottom-1;gk(n,i,r),r!=i.top;r--){const a=i.tableStart?n.doc.nodeAt(i.tableStart-1):n.doc;if(!a)throw new RangeError("No table found");i.table=a,i.map=Ve.get(i.table)}t(n)}return!0}function dc(e){const t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function yk({width:e,height:t,map:i},n){let r=n.top*e+n.left,a=r,o=(n.bottom-1)*e+n.left,l=r+(n.right-n.left-1);for(let c=n.top;c<n.bottom;c++){if(n.left>0&&i[a]==i[a-1]||n.right<e&&i[l]==i[l+1])return!0;a+=e,l+=e}for(let c=n.left;c<n.right;c++){if(n.top>0&&i[r]==i[r-e]||n.bottom<t&&i[o]==i[o+e])return!0;r++,o++}return!1}function mc(e,t){const i=e.selection;if(!(i instanceof Ie)||i.$anchorCell.pos==i.$headCell.pos)return!1;const n=Ht(e),{map:r}=n;if(yk(r,n))return!1;if(t){const a=e.tr,o={};let l=Z.empty,c,f;for(let p=n.top;p<n.bottom;p++)for(let m=n.left;m<n.right;m++){const d=r.map[p*r.width+m],h=n.table.nodeAt(d);if(!(o[d]||!h))if(o[d]=!0,c==null)c=d,f=h;else{dc(h)||(l=l.append(h.content));const v=a.mapping.map(d+n.tableStart);a.delete(v,v+h.nodeSize)}}if(c==null||f==null)return!0;if(a.setNodeMarkup(c+n.tableStart,null,{...Kf(f.attrs,f.attrs.colspan,n.right-n.left-f.attrs.colspan),rowspan:n.bottom-n.top}),l.size>0){const p=c+1+f.content.size,m=dc(f)?c+1:p;a.replaceWith(m+n.tableStart,p+n.tableStart,l)}a.setSelection(new Ie(a.doc.resolve(c+n.tableStart))),t(a)}return!0}function hc(e,t){const i=nt(e.schema);return xk(({node:n})=>i[n.type.spec.tableRole])(e,t)}function xk(e){return(t,i)=>{const n=t.selection;let r,a;if(n instanceof Ie){if(n.$anchorCell.pos!=n.$headCell.pos)return!1;r=n.$anchorCell.nodeAfter,a=n.$anchorCell.pos}else{var o;if(r=Y1(n.$from),!r)return!1;a=(o=ji(n.$from))===null||o===void 0?void 0:o.pos}if(r==null||a==null||r.attrs.colspan==1&&r.attrs.rowspan==1)return!1;if(i){let l=r.attrs;const c=[],f=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const p=Ht(t),m=t.tr;for(let h=0;h<p.right-p.left;h++)c.push(f?{...l,colwidth:f&&f[h]?[f[h]]:null}:l);let d;for(let h=p.top;h<p.bottom;h++){let v=p.map.positionAt(h,p.left,p.table);h==p.top&&(v+=r.nodeSize);for(let b=p.left,y=0;b<p.right;b++,y++)b==p.left&&h==p.top||m.insert(d=m.mapping.map(v+p.tableStart,1),e({node:r,row:h,col:b}).createAndFill(c[y]))}m.setNodeMarkup(a,e({node:r,row:p.top,col:p.left}),c[0]),n instanceof Ie&&m.setSelection(new Ie(m.doc.resolve(n.$anchorCell.pos),d?m.doc.resolve(d):void 0)),i(m)}return!0}}function kk(e,t){return function(i,n){if(!Lt(i))return!1;const r=$a(i);if(r.nodeAfter.attrs[e]===t)return!1;if(n){const a=i.tr;i.selection instanceof Ie?i.selection.forEachCell((o,l)=>{o.attrs[e]!==t&&a.setNodeMarkup(l,null,{...o.attrs,[e]:t})}):a.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[e]:t}),n(a)}return!0}}function wk(e){return function(t,i){if(!Lt(t))return!1;if(i){const n=nt(t.schema),r=Ht(t),a=t.tr,o=r.map.cellsInRect(e=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:e=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),l=o.map(c=>r.table.nodeAt(c));for(let c=0;c<o.length;c++)l[c].type==n.header_cell&&a.setNodeMarkup(r.tableStart+o[c],n.cell,l[c].attrs);if(a.steps.length===0)for(let c=0;c<o.length;c++)a.setNodeMarkup(r.tableStart+o[c],n.header_cell,l[c].attrs);i(a)}return!0}}function bc(e,t,i){const n=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let r=0;r<n.length;r++){const a=t.table.nodeAt(n[r]);if(a&&a.type!==i.header_cell)return!1}return!0}function Gn(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?wk(e):function(i,n){if(!Lt(i))return!1;if(n){const r=nt(i.schema),a=Ht(i),o=i.tr,l=bc("row",a,r),c=bc("column",a,r),f=(e==="column"?l:e==="row"&&c)?1:0,p=e=="column"?{left:0,top:f,right:1,bottom:a.map.height}:e=="row"?{left:f,top:0,right:a.map.width,bottom:1}:a,m=e=="column"?c?r.cell:r.header_cell:e=="row"?l?r.cell:r.header_cell:r.cell;a.map.cellsInRect(p).forEach(d=>{const h=d+a.tableStart,v=o.doc.nodeAt(h);v&&o.setNodeMarkup(h,m,v.attrs)}),n(o)}return!0}}Gn("row",{useDeprecatedLogic:!0});Gn("column",{useDeprecatedLogic:!0});const _k=Gn("cell",{useDeprecatedLogic:!0});function Sk(e,t){if(t<0){const i=e.nodeBefore;if(i)return e.pos-i.nodeSize;for(let n=e.index(-1)-1,r=e.before();n>=0;n--){const a=e.node(-1).child(n),o=a.lastChild;if(o)return r-1-o.nodeSize;r-=a.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const i=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<i.childCount;n++){const a=i.child(n);if(a.childCount)return r+1;r+=a.nodeSize}}return null}function gc(e){return function(t,i){if(!Lt(t))return!1;const n=Sk($a(t),e);if(n==null)return!1;if(i){const r=t.doc.resolve(n);i(t.tr.setSelection(he.between(r,tk(r))).scrollIntoView())}return!0}}function Ck(e,t){const i=e.selection.$anchor;for(let n=i.depth;n>0;n--)if(i.node(n).type.spec.tableRole=="table")return t&&t(e.tr.delete(i.before(n),i.after(n)).scrollIntoView()),!0;return!1}function Mr(e,t){const i=e.selection;if(!(i instanceof Ie))return!1;if(t){const n=e.tr,r=nt(e.schema).cell.createAndFill().content;i.forEachCell((a,o)=>{a.content.eq(r)||n.replace(n.mapping.map(o+1),n.mapping.map(o+a.nodeSize-1),new ae(r,0,0))}),n.docChanged&&t(n)}return!0}function Ek(e){if(e.size===0)return null;let{content:t,openStart:i,openEnd:n}=e;for(;t.childCount==1&&(i>0&&n>0||t.child(0).type.spec.tableRole=="table");)i--,n--,t=t.child(0).content;const r=t.child(0),a=r.type.spec.tableRole,o=r.type.schema,l=[];if(a=="row")for(let c=0;c<t.childCount;c++){let f=t.child(c).content;const p=c?0:Math.max(0,i-1),m=c<t.childCount-1?0:Math.max(0,n-1);(p||m)&&(f=ts(nt(o).row,new ae(f,p,m)).content),l.push(f)}else if(a=="cell"||a=="header_cell")l.push(i||n?ts(nt(o).row,new ae(t,i,n)).content:t);else return null;return Nk(o,l)}function Nk(e,t){const i=[];for(let r=0;r<t.length;r++){const a=t[r];for(let o=a.childCount-1;o>=0;o--){const{rowspan:l,colspan:c}=a.child(o).attrs;for(let f=r;f<r+l;f++)i[f]=(i[f]||0)+c}}let n=0;for(let r=0;r<i.length;r++)n=Math.max(n,i[r]);for(let r=0;r<i.length;r++)if(r>=t.length&&t.push(Z.empty),i[r]<n){const a=nt(e).cell.createAndFill(),o=[];for(let l=i[r];l<n;l++)o.push(a);t[r]=t[r].append(Z.from(o))}return{height:t.length,width:n,rows:t}}function ts(e,t){const i=e.createAndFill();return new Pu(i).replace(0,i.content.size,t).doc}function Ak({width:e,height:t,rows:i},n,r){if(e!=n){const a=[],o=[];for(let l=0;l<i.length;l++){const c=i[l],f=[];for(let p=a[l]||0,m=0;p<n;m++){let d=c.child(m%c.childCount);p+d.attrs.colspan>n&&(d=d.type.createChecked(qi(d.attrs,d.attrs.colspan,p+d.attrs.colspan-n),d.content)),f.push(d),p+=d.attrs.colspan;for(let h=1;h<d.attrs.rowspan;h++)a[l+h]=(a[l+h]||0)+d.attrs.colspan}o.push(Z.from(f))}i=o,e=n}if(t!=r){const a=[];for(let o=0,l=0;o<r;o++,l++){const c=[],f=i[l%t];for(let p=0;p<f.childCount;p++){let m=f.child(p);o+m.attrs.rowspan>r&&(m=m.type.create({...m.attrs,rowspan:Math.max(1,r-m.attrs.rowspan)},m.content)),c.push(m)}a.push(Z.from(c))}i=a,t=r}return{width:e,height:t,rows:i}}function Ok(e,t,i,n,r,a,o){const l=e.doc.type.schema,c=nt(l);let f,p;if(r>t.width)for(let m=0,d=0;m<t.height;m++){const h=i.child(m);d+=h.nodeSize;const v=[];let b;h.lastChild==null||h.lastChild.type==c.cell?b=f||(f=c.cell.createAndFill()):b=p||(p=c.header_cell.createAndFill());for(let y=t.width;y<r;y++)v.push(b);e.insert(e.mapping.slice(o).map(d-1+n),v)}if(a>t.height){const m=[];for(let v=0,b=(t.height-1)*t.width;v<Math.max(t.width,r);v++){const y=v>=t.width?!1:i.nodeAt(t.map[b+v]).type==c.header_cell;m.push(y?p||(p=c.header_cell.createAndFill()):f||(f=c.cell.createAndFill()))}const d=c.row.create(null,Z.from(m)),h=[];for(let v=t.height;v<a;v++)h.push(d);e.insert(e.mapping.slice(o).map(n+i.nodeSize-2),h)}return!!(f||p)}function vc(e,t,i,n,r,a,o,l){if(o==0||o==t.height)return!1;let c=!1;for(let f=r;f<a;f++){const p=o*t.width+f,m=t.map[p];if(t.map[p-t.width]==m){c=!0;const d=i.nodeAt(m),{top:h,left:v}=t.findCell(m);e.setNodeMarkup(e.mapping.slice(l).map(m+n),null,{...d.attrs,rowspan:o-h}),e.insert(e.mapping.slice(l).map(t.positionAt(o,v,i)),d.type.createAndFill({...d.attrs,rowspan:h+d.attrs.rowspan-o})),f+=d.attrs.colspan-1}}return c}function yc(e,t,i,n,r,a,o,l){if(o==0||o==t.width)return!1;let c=!1;for(let f=r;f<a;f++){const p=f*t.width+o,m=t.map[p];if(t.map[p-1]==m){c=!0;const d=i.nodeAt(m),h=t.colCount(m),v=e.mapping.slice(l).map(m+n);e.setNodeMarkup(v,null,qi(d.attrs,o-h,d.attrs.colspan-(o-h))),e.insert(v+d.nodeSize,d.type.createAndFill(qi(d.attrs,0,o-h))),f+=d.attrs.rowspan-1}}return c}function xc(e,t,i,n,r){let a=i?e.doc.nodeAt(i-1):e.doc;if(!a)throw new Error("No table found");let o=Ve.get(a);const{top:l,left:c}=n,f=c+r.width,p=l+r.height,m=e.tr;let d=0;function h(){if(a=i?m.doc.nodeAt(i-1):m.doc,!a)throw new Error("No table found");o=Ve.get(a),d=m.mapping.maps.length}Ok(m,o,a,i,f,p,d)&&h(),vc(m,o,a,i,c,f,l,d)&&h(),vc(m,o,a,i,c,f,p,d)&&h(),yc(m,o,a,i,l,p,c,d)&&h(),yc(m,o,a,i,l,p,f,d)&&h();for(let v=l;v<p;v++){const b=o.positionAt(v,c,a),y=o.positionAt(v,f,a);m.replace(m.mapping.slice(d).map(b+i),m.mapping.slice(d).map(y+i),new ae(r.rows[v-l],0,0))}h(),m.setSelection(new Ie(m.doc.resolve(i+o.positionAt(l,c,a)),m.doc.resolve(i+o.positionAt(p-1,f-1,a)))),t(m)}const Tk=Yy({ArrowLeft:zr("horiz",-1),ArrowRight:zr("horiz",1),ArrowUp:zr("vert",-1),ArrowDown:zr("vert",1),"Shift-ArrowLeft":Ir("horiz",-1),"Shift-ArrowRight":Ir("horiz",1),"Shift-ArrowUp":Ir("vert",-1),"Shift-ArrowDown":Ir("vert",1),Backspace:Mr,"Mod-Backspace":Mr,Delete:Mr,"Mod-Delete":Mr});function Hr(e,t,i){return i.eq(e.selection)?!1:(t&&t(e.tr.setSelection(i).scrollIntoView()),!0)}function zr(e,t){return(i,n,r)=>{if(!r)return!1;const a=i.selection;if(a instanceof Ie)return Hr(i,n,ve.near(a.$headCell,t));if(e!="horiz"&&!a.empty)return!1;const o=ep(r,e,t);if(o==null)return!1;if(e=="horiz")return Hr(i,n,ve.near(i.doc.resolve(a.head+t),t));{const l=i.doc.resolve(o),c=Gf(l,e,t);let f;return c?f=ve.near(c,1):t<0?f=ve.near(i.doc.resolve(l.before(-1)),-1):f=ve.near(i.doc.resolve(l.after(-1)),1),Hr(i,n,f)}}}function Ir(e,t){return(i,n,r)=>{if(!r)return!1;const a=i.selection;let o;if(a instanceof Ie)o=a;else{const c=ep(r,e,t);if(c==null)return!1;o=new Ie(i.doc.resolve(c))}const l=Gf(o.$headCell,e,t);return l?Hr(i,n,new Ie(o.$anchorCell,l)):!1}}function Mk(e,t){const i=e.state.doc,n=ji(i.resolve(t));return n?(e.dispatch(e.state.tr.setSelection(new Ie(n))),!0):!1}function zk(e,t,i){if(!Lt(e.state))return!1;let n=Ek(i);const r=e.state.selection;if(r instanceof Ie){n||(n={width:1,height:1,rows:[Z.from(ts(nt(e.state.schema).cell,i))]});const a=r.$anchorCell.node(-1),o=r.$anchorCell.start(-1),l=Ve.get(a).rectBetween(r.$anchorCell.pos-o,r.$headCell.pos-o);return n=Ak(n,l.right-l.left,l.bottom-l.top),xc(e.state,e.dispatch,o,l,n),!0}else if(n){const a=$a(e.state),o=a.start(-1);return xc(e.state,e.dispatch,o,Ve.get(a.node(-1)).findCell(a.pos-o),n),!0}else return!1}function Ik(e,t){var i;if(t.button!=0||t.ctrlKey||t.metaKey)return;const n=kc(e,t.target);let r;if(t.shiftKey&&e.state.selection instanceof Ie)a(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&n&&(r=ji(e.state.selection.$anchor))!=null&&((i=xo(e,t))===null||i===void 0?void 0:i.pos)!=r.pos)a(r,t),t.preventDefault();else if(!n)return;function a(c,f){let p=xo(e,f);const m=mi.getState(e.state)==null;if(!p||!$s(c,p))if(m)p=c;else return;const d=new Ie(c,p);if(m||!e.state.selection.eq(d)){const h=e.state.tr.setSelection(d);m&&h.setMeta(mi,c.pos),e.dispatch(h)}}function o(){e.root.removeEventListener("mouseup",o),e.root.removeEventListener("dragstart",o),e.root.removeEventListener("mousemove",l),mi.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(mi,-1))}function l(c){const f=c,p=mi.getState(e.state);let m;if(p!=null)m=e.state.doc.resolve(p);else if(kc(e,f.target)!=n&&(m=xo(e,t),!m))return o();m&&a(m,f)}e.root.addEventListener("mouseup",o),e.root.addEventListener("dragstart",o),e.root.addEventListener("mousemove",l)}function ep(e,t,i){if(!(e.state.selection instanceof he))return null;const{$head:n}=e.state.selection;for(let r=n.depth-1;r>=0;r--){const a=n.node(r);if((i<0?n.index(r):n.indexAfter(r))!=(i<0?0:a.childCount))return null;if(a.type.spec.tableRole=="cell"||a.type.spec.tableRole=="header_cell"){const o=n.before(r),l=t=="vert"?i>0?"down":"up":i>0?"right":"left";return e.endOfTextblock(l)?o:null}}return null}function kc(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function xo(e,t){const i=e.posAtCoords({left:t.clientX,top:t.clientY});if(!i)return null;let{inside:n,pos:r}=i;return n>=0&&ji(e.state.doc.resolve(n))||ji(e.state.doc.resolve(r))}var Dk=class{constructor(t,i){this.node=t,this.defaultCellMinWidth=i,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${i}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),is(t,this.colgroup,this.table,i),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,is(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function is(e,t,i,n,r,a){let o=0,l=!0,c=t.firstChild;const f=e.firstChild;if(f){for(let m=0,d=0;m<f.childCount;m++){const{colspan:h,colwidth:v}=f.child(m).attrs;for(let b=0;b<h;b++,d++){const y=r==d?a:v&&v[b],g=y?y+"px":"";if(o+=y||n,y||(l=!1),c)c.style.width!=g&&(c.style.width=g),c=c.nextSibling;else{const x=document.createElement("col");x.style.width=g,t.appendChild(x)}}}for(;c;){var p;const m=c.nextSibling;(p=c.parentNode)===null||p===void 0||p.removeChild(c),c=m}l?(i.style.width=o+"px",i.style.minWidth=""):(i.style.width="",i.style.minWidth=o+"px")}}const kt=new ot("tableColumnResizing");function Rk({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:i=100,View:n=Dk,lastColumnResizable:r=!0}={}){const a=new ft({key:kt,state:{init(o,l){var c;const f=(c=a.spec)===null||c===void 0||(c=c.props)===null||c===void 0?void 0:c.nodeViews,p=nt(l.schema).table.name;return n&&f&&(f[p]=(m,d)=>new n(m,i,d)),new Lk(-1,!1)},apply(o,l){return l.apply(o)}},props:{attributes:o=>{const l=kt.getState(o);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,l)=>{Bk(o,l,e,r)},mouseleave:o=>{Pk(o)},mousedown:(o,l)=>{Vk(o,l,t,i)}},decorations:o=>{const l=kt.getState(o);if(l&&l.activeHandle>-1)return qk(o,l.activeHandle)},nodeViews:{}}});return a}var Lk=class jr{constructor(t,i){this.activeHandle=t,this.dragging=i}apply(t){const i=this,n=t.getMeta(kt);if(n&&n.setHandle!=null)return new jr(n.setHandle,!1);if(n&&n.setDragging!==void 0)return new jr(i.activeHandle,n.setDragging);if(i.activeHandle>-1&&t.docChanged){let r=t.mapping.map(i.activeHandle,-1);return es(t.doc.resolve(r))||(r=-1),new jr(r,i.dragging)}return i}};function Bk(e,t,i,n){if(!e.editable)return;const r=kt.getState(e.state);if(r&&!r.dragging){const a=Uk(t.target);let o=-1;if(a){const{left:l,right:c}=a.getBoundingClientRect();t.clientX-l<=i?o=wc(e,t,"left",i):c-t.clientX<=i&&(o=wc(e,t,"right",i))}if(o!=r.activeHandle){if(!n&&o!==-1){const l=e.state.doc.resolve(o),c=l.node(-1),f=Ve.get(c),p=l.start(-1);if(f.colCount(l.pos-p)+l.nodeAfter.attrs.colspan-1==f.width-1)return}tp(e,o)}}}function Pk(e){if(!e.editable)return;const t=kt.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&tp(e,-1)}function Vk(e,t,i,n){var r;if(!e.editable)return!1;const a=(r=e.dom.ownerDocument.defaultView)!==null&&r!==void 0?r:window,o=kt.getState(e.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const l=e.state.doc.nodeAt(o.activeHandle),c=Fk(e,o.activeHandle,l.attrs);e.dispatch(e.state.tr.setMeta(kt,{setDragging:{startX:t.clientX,startWidth:c}}));function f(m){a.removeEventListener("mouseup",f),a.removeEventListener("mousemove",p);const d=kt.getState(e.state);d!=null&&d.dragging&&(Hk(e,d.activeHandle,_c(d.dragging,m,i)),e.dispatch(e.state.tr.setMeta(kt,{setDragging:null})))}function p(m){if(!m.which)return f(m);const d=kt.getState(e.state);if(d&&d.dragging){const h=_c(d.dragging,m,i);Sc(e,d.activeHandle,h,n)}}return Sc(e,o.activeHandle,c,n),a.addEventListener("mouseup",f),a.addEventListener("mousemove",p),t.preventDefault(),!0}function Fk(e,t,{colspan:i,colwidth:n}){const r=n&&n[n.length-1];if(r)return r;const a=e.domAtPos(t);let o=a.node.childNodes[a.offset].offsetWidth,l=i;if(n)for(let c=0;c<i;c++)n[c]&&(o-=n[c],l--);return o/l}function Uk(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function wc(e,t,i,n){const r=i=="right"?-n:n,a=e.posAtCoords({left:t.clientX+r,top:t.clientY});if(!a)return-1;const{pos:o}=a,l=ji(e.state.doc.resolve(o));if(!l)return-1;if(i=="right")return l.pos;const c=Ve.get(l.node(-1)),f=l.start(-1),p=c.map.indexOf(l.pos-f);return p%c.width==0?-1:f+c.map[p-1]}function _c(e,t,i){const n=t.clientX-e.startX;return Math.max(i,e.startWidth+n)}function tp(e,t){e.dispatch(e.state.tr.setMeta(kt,{setHandle:t}))}function Hk(e,t,i){const n=e.state.doc.resolve(t),r=n.node(-1),a=Ve.get(r),o=n.start(-1),l=a.colCount(n.pos-o)+n.nodeAfter.attrs.colspan-1,c=e.state.tr;for(let f=0;f<a.height;f++){const p=f*a.width+l;if(f&&a.map[p]==a.map[p-a.width])continue;const m=a.map[p],d=r.nodeAt(m).attrs,h=d.colspan==1?0:l-a.colCount(m);if(d.colwidth&&d.colwidth[h]==i)continue;const v=d.colwidth?d.colwidth.slice():jk(d.colspan);v[h]=i,c.setNodeMarkup(o+m,null,{...d,colwidth:v})}c.docChanged&&e.dispatch(c)}function Sc(e,t,i,n){const r=e.state.doc.resolve(t),a=r.node(-1),o=r.start(-1),l=Ve.get(a).colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;let c=e.domAtPos(r.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&is(a,c.firstChild,c,n,l,i)}function jk(e){return Array(e).fill(0)}function qk(e,t){const i=[],n=e.doc.resolve(t),r=n.node(-1);if(!r)return Be.empty;const a=Ve.get(r),o=n.start(-1),l=a.colCount(n.pos-o)+n.nodeAfter.attrs.colspan-1;for(let f=0;f<a.height;f++){const p=l+f*a.width;if((l==a.width-1||a.map[p]!=a.map[p+1])&&(f==0||a.map[p]!=a.map[p-a.width])){var c;const m=a.map[p],d=o+m+r.nodeAt(m).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((c=kt.getState(e))===null||c===void 0)&&c.dragging&&i.push(tt.node(o+m,o+m+r.nodeAt(m).nodeSize,{class:"column-resize-dragging"})),i.push(tt.widget(d,h))}}return Be.create(e.doc,i)}function $k({allowTableNodeSelection:e=!1}={}){return new ft({key:mi,state:{init(){return null},apply(t,i){const n=t.getMeta(mi);if(n!=null)return n==-1?null:n;if(i==null||!t.docChanged)return i;const{deleted:r,pos:a}=t.mapping.mapResult(i);return r?null:a}},props:{decorations:rk,handleDOMEvents:{mousedown:Ik},createSelectionBetween(t){return mi.getState(t.state)!=null?t.state.selection:null},handleTripleClick:Mk,handleKeyDown:Tk,handlePaste:zk},appendTransaction(t,i,n){return sk(n,Zf(n,i),e)}})}function ns(e,t){return t?["width",`${Math.max(t,e)}px`]:["min-width",`${e}px`]}function Cc(e,t,i,n,r,a){var o;let l=0,c=!0,f=t.firstChild;const p=e.firstChild;if(p!==null)for(let m=0,d=0;m<p.childCount;m+=1){const{colspan:h,colwidth:v}=p.child(m).attrs;for(let b=0;b<h;b+=1,d+=1){const y=r===d?a:v&&v[b],g=y?`${y}px`:"";if(l+=y||n,y||(c=!1),f){if(f.style.width!==g){const[x,k]=ns(n,y);f.style.setProperty(x,k)}f=f.nextSibling}else{const x=document.createElement("col"),[k,w]=ns(n,y);x.style.setProperty(k,w),t.appendChild(x)}}}for(;f;){const m=f.nextSibling;(o=f.parentNode)===null||o===void 0||o.removeChild(f),f=m}c?(i.style.width=`${l}px`,i.style.minWidth=""):(i.style.width="",i.style.minWidth=`${l}px`)}class Wk{constructor(t,i){this.node=t,this.cellMinWidth=i,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Cc(t,this.colgroup,this.table,i),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!==this.node.type?!1:(this.node=t,Cc(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){return t.type==="attributes"&&(t.target===this.table||this.colgroup.contains(t.target))}}function Gk(e,t,i,n){let r=0,a=!0;const o=[],l=e.firstChild;if(!l)return{};for(let m=0,d=0;m<l.childCount;m+=1){const{colspan:h,colwidth:v}=l.child(m).attrs;for(let b=0;b<h;b+=1,d+=1){const y=i===d?n:v&&v[b];r+=y||t,y||(a=!1);const[g,x]=ns(t,y);o.push(["col",{style:`${g}: ${x}`}])}}const c=a?`${r}px`:"",f=a?"":`${r}px`;return{colgroup:["colgroup",{},...o],tableWidth:c,tableMinWidth:f}}function Ec(e,t){return e.createAndFill()}function Kk(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;const t={};return Object.keys(e.nodes).forEach(i=>{const n=e.nodes[i];n.spec.tableRole&&(t[n.spec.tableRole]=n)}),e.cached.tableNodeTypes=t,t}function Xk(e,t,i,n,r){const a=Kk(e),o=[],l=[];for(let f=0;f<i;f+=1){const p=Ec(a.cell);if(p&&l.push(p),n){const m=Ec(a.header_cell);m&&o.push(m)}}const c=[];for(let f=0;f<t;f+=1)c.push(a.row.createChecked(null,n&&f===0?o:l));return a.table.createChecked(null,c)}function Jk(e){return e instanceof Ie}const Dr=({editor:e})=>{const{selection:t}=e.state;if(!Jk(t))return!1;let i=0;const n=Df(t.ranges[0].$from,a=>a.type.name==="table");return n==null||n.node.descendants(a=>{if(a.type.name==="table")return!1;["tableCell","tableHeader"].includes(a.type.name)&&(i+=1)}),i===t.ranges.length?(e.commands.deleteTable(),!0):!1},Zk=vt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:Wk,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:e,HTMLAttributes:t}){const{colgroup:i,tableWidth:n,tableMinWidth:r}=Gk(e,this.options.cellMinWidth),a=["table",Fe(this.options.HTMLAttributes,t,{style:n?`width: ${n}`:`min-width: ${r}`}),i,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},a]:a},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:i=!0}={})=>({tr:n,dispatch:r,editor:a})=>{const o=Xk(a.schema,e,t,i);if(r){const l=n.selection.from+1;n.replaceSelectionWith(o).scrollIntoView().setSelection(he.near(n.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>uk(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>fk(e,t),deleteColumn:()=>({state:e,dispatch:t})=>dk(e,t),addRowBefore:()=>({state:e,dispatch:t})=>hk(e,t),addRowAfter:()=>({state:e,dispatch:t})=>bk(e,t),deleteRow:()=>({state:e,dispatch:t})=>vk(e,t),deleteTable:()=>({state:e,dispatch:t})=>Ck(e,t),mergeCells:()=>({state:e,dispatch:t})=>mc(e,t),splitCell:()=>({state:e,dispatch:t})=>hc(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>Gn("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>Gn("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>_k(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>mc(e,t)?!0:hc(e,t),setCellAttribute:(e,t)=>({state:i,dispatch:n})=>kk(e,t)(i,n),goToNextCell:()=>({state:e,dispatch:t})=>gc(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>gc(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&Zf(e),!0),setCellSelection:e=>({tr:t,dispatch:i})=>{if(i){const n=Ie.create(t.doc,e.anchorCell,e.headCell);t.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Dr,"Mod-Backspace":Dr,Delete:Dr,"Mod-Delete":Dr}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Rk({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],$k({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){const t={name:e.name,options:e.options,storage:e.storage};return{tableRole:We(it(e,"tableRole",t))}}}),Qk=vt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:e}){return["tr",Fe(this.options.HTMLAttributes,e),0]}}),Yk=vt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:e}){return["td",Fe(this.options.HTMLAttributes,e),0]}}),ew=vt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:e}){return["th",Fe(this.options.HTMLAttributes,e),0]}}),tw=Ke.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ft({key:new ot("placeholder"),props:{decorations:({doc:e,selection:t})=>{const i=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=t,r=[];if(!i)return null;const a=this.editor.isEmpty;return e.descendants((o,l)=>{const c=n>=l&&n<=l+o.nodeSize,f=!o.isLeaf&&Rs(o);if((c||!this.options.showOnlyCurrent)&&f){const p=[this.options.emptyNodeClass];a&&p.push(this.options.emptyEditorClass);const m=tt.node(l,l+o.nodeSize,{class:p.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:l,hasAnchor:c}):this.options.placeholder});r.push(m)}return this.options.includeChildren}),Be.create(e,r)}}})]}}),iw=e=>{if(!e.children.length)return;const t=e.querySelectorAll("span");t&&t.forEach(i=>{var n,r;const a=i.getAttribute("style"),o=(r=(n=i.parentElement)===null||n===void 0?void 0:n.closest("span"))===null||r===void 0?void 0:r.getAttribute("style");i.setAttribute("style",`${o};${a}`)})};xi.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:e=>e.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&iw(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return["span",Fe(this.options.HTMLAttributes,e),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:e})=>{const{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(i,n)=>{if(i.isTextblock)return!0;i.marks.filter(r=>r.type===this.type).some(r=>Object.values(r.attrs).some(a=>!!a))||e.removeMark(n,n+i.nodeSize,this.type)}),!0}}}});const nw=Ke.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;return(t=e.style.color)===null||t===void 0?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),rw=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,aw=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,ow=xi.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute("data-color")||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:e}){return["mark",Fe(this.options.HTMLAttributes,e),0]},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[J0({find:rw,type:this.type})]},addPasteRules(){return[Rf({find:aw,type:this.type})]}});_e.definePlugin({id:"formatting",tiptapExtensions:[b1],toolbar:[{id:"bold",label:"Bold",action:"toggleBold",iconComponent:"Bold"},{id:"italic",label:"Italic",action:"toggleItalic",iconComponent:"Italic"},{id:"underline",label:"Underline",action:"toggleUnderline",iconComponent:"Underline"},{id:"strike",label:"Strikethrough",action:"toggleStrike",iconComponent:"Strikethrough"}]});function en(e){return t=>t.commands.toggleHeading({level:e})}_e.definePlugin({id:"headings",toolbar:[{id:"heading-1",label:"Heading 1",action:"toggleHeading1",iconComponent:"Heading1"},{id:"heading-2",label:"Heading 2",action:"toggleHeading2",iconComponent:"Heading2"},{id:"heading-3",label:"Heading 3",action:"toggleHeading3",iconComponent:"Heading3"},{id:"heading-4",label:"Heading 4",action:"toggleHeading4",iconComponent:"Heading4"},{id:"heading-5",label:"Heading 5",action:"toggleHeading5",iconComponent:"Heading5"},{id:"heading-6",label:"Heading 6",action:"toggleHeading6",iconComponent:"Heading6"}],slashCommands:[{name:"Heading 1",command:"toggleHeading1"},{name:"Heading 2",command:"toggleHeading2"},{name:"Heading 3",command:"toggleHeading3"}],commands:{toggleHeading1:en(1),toggleHeading2:en(2),toggleHeading3:en(3),toggleHeading4:en(4),toggleHeading5:en(5),toggleHeading6:en(6)}});_e.definePlugin({id:"lists",tiptapExtensions:[g1,y1.configure({nested:!0})],toolbar:[{id:"bullet-list",label:"Bullet List",action:"toggleBulletList",iconComponent:"List"},{id:"ordered-list",label:"Ordered List",action:"toggleOrderedList",iconComponent:"ListOrdered"},{id:"task-list",label:"Task List",action:"toggleTaskList",iconComponent:"CheckSquare"}],slashCommands:[{name:"Bullet List",command:"toggleBulletList"},{name:"Ordered List",command:"toggleOrderedList"},{name:"Task List",command:"toggleTaskList"}]});function Rr(e){return t=>t.commands.setTextAlign(e)}_e.definePlugin({id:"alignment",tiptapExtensions:[x1.configure({types:["heading","paragraph"]})],toolbar:[{id:"align-left",label:"Align Left",action:"alignLeft",iconComponent:"AlignLeft"},{id:"align-center",label:"Align Center",action:"alignCenter",iconComponent:"AlignCenter"},{id:"align-right",label:"Align Right",action:"alignRight",iconComponent:"AlignRight"},{id:"align-justify",label:"Align Justify",action:"alignJustify",iconComponent:"AlignJustify"}],commands:{alignLeft:Rr("left"),alignCenter:Rr("center"),alignRight:Rr("right"),alignJustify:Rr("justify")}});_e.definePlugin({id:"link",tiptapExtensions:[W1.configure({openOnClick:!0})],toolbar:[{id:"set-link",label:"Link",action:"setLink",iconComponent:"Link"}],slashCommands:[{name:"Link",command:"setLink"}],commands:{setLink:(e,...t)=>{if(e.isActive("link"))return e.chain().focus().unsetLink().run();const i=t[0],n=(i==null?void 0:i.href)??(typeof window<"u"&&typeof window.prompt=="function"?window.prompt("Enter link URL:","https://"):null);return n?e.chain().focus().setLink({href:n,target:"_blank"}).run():!1}}});function sw(){return typeof document>"u"?Promise.resolve(null):new Promise(e=>{const t=document.createElement("input");t.type="file",t.accept="image/*";const i=()=>t.remove();t.onchange=()=>{var r;const n=((r=t.files)==null?void 0:r[0])??null;i(),e(n)},t.oncancel=()=>{i(),e(null)},document.body.appendChild(t),t.click()})}_e.definePlugin({id:"image",tiptapExtensions:[K1],toolbar:[{id:"insert-image",label:"Image",action:"insertImage",iconComponent:"Image"}],slashCommands:[{name:"Image",command:"insertImage"}],commands:{insertImage:(e,...t)=>{const i=t[0];if(i!=null&&i.src)return e.commands.setImage({src:i.src,alt:i.alt,title:i.title});const n=e.storage.editorContext,r=n==null?void 0:n.onImageUpload;if(r)return sw().then(async a=>{if(a)try{const o=await r(a);o!=null&&o.src&&e.commands.setImage({src:o.src,alt:o.alt,title:o.title})}catch(o){console.error("[image] upload failed:",o)}}),!0;if(typeof window<"u"&&typeof window.prompt=="function"){const a=window.prompt("Enter image URL:","https://");return a?e.commands.setImage({src:a}):!1}return!1}}});var lw=Zk.extend({renderHTML({node:e,HTMLAttributes:t}){let i=0;const n=e.firstChild;n&&n.forEach(c=>{i+=c.attrs.colspan||1});const r=[];let a=0,o=!1;if(i>0)for(let c=0;c<i;c++){let f=null;if(n){let p=0;n.forEach(m=>{const d=m.attrs.colspan||1;if(c>=p&&c<p+d){const h=m.attrs.colwidth;if(h&&Array.isArray(h)){const v=c-p,b=h[v];typeof b=="number"&&b>0&&(f=b)}}p+=d})}f&&(a+=f,o=!0),r.push(["col",f?{style:`width: ${f}px !important`,width:String(f)}:{}])}const l=Fe(t);if(o&&a>0){const c=l.style||"";l.style=c?`${c}; width: ${a}px !important`:`width: ${a}px !important`}return["table",l,["colgroup",...r],["tbody",0]]}}),cw=Yk.extend({addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),colwidth:{default:null,parseHTML:t=>{const i=t.getAttribute("width")||t.style.width;if(i){const r=parseInt(i,10);return isNaN(r)||r<=0?null:[r]}const n=t.getAttribute("colwidth");return n?n.split(",").map(r=>parseInt(r,10)).filter(r=>!isNaN(r)&&r>0):null},renderHTML:t=>{if(!t.colwidth||!Array.isArray(t.colwidth)||t.colwidth.length===0)return{};const i=t.colwidth.filter(r=>typeof r=="number"&&r>0);if(i.length===0)return{};const n=i[0];return{colwidth:i.join(","),style:`width: ${n}px !important`,width:String(n)}}}}}}),uw=ew.extend({addAttributes(){var e;return{...(e=this.parent)==null?void 0:e.call(this),colwidth:{default:null,parseHTML:t=>{const i=t.getAttribute("width")||t.style.width;if(i){const r=parseInt(i,10);return isNaN(r)||r<=0?null:[r]}const n=t.getAttribute("colwidth");return n?n.split(",").map(r=>parseInt(r,10)).filter(r=>!isNaN(r)&&r>0):null},renderHTML:t=>{if(!t.colwidth||!Array.isArray(t.colwidth)||t.colwidth.length===0)return{};const i=t.colwidth.filter(r=>typeof r=="number"&&r>0);if(i.length===0)return{};const n=i[0];return{colwidth:i.join(","),style:`width: ${n}px !important`,width:String(n)}}}}}});_e.definePlugin({id:"table",tiptapExtensions:[lw.configure({resizable:!1}),Qk,cw,uw],toolbar:[{id:"insert-table",label:"Insert Table",action:"insertTable",args:[{rows:3,cols:3,withHeaderRow:!0}],iconComponent:"Table"}],slashCommands:[{name:"Table",command:"insertTable"}]});_e.definePlugin({id:"blockquote",toolbar:[{id:"blockquote",label:"Blockquote",action:"toggleBlockquote",iconComponent:"Quote"}],slashCommands:[{name:"Blockquote",command:"toggleBlockquote"}]});_e.definePlugin({id:"code-block",toolbar:[{id:"code-block",label:"Code Block",action:"toggleCodeBlock",iconComponent:"Code"}],slashCommands:[{name:"Code Block",command:"toggleCodeBlock"}]});function fw(e={}){return _e.definePlugin({id:"placeholder",tiptapExtensions:[tw.configure({placeholder:e.placeholder??"Start writing…"})]})}fw();var pw=vt.create({name:"pageBreak",group:"block",selectable:!1,draggable:!1,parseHTML(){return[{tag:'div[data-page-break="true"]'}]},renderHTML({HTMLAttributes:e}){return["div",Fe(e,{"data-page-break":"true","data-node-type":"pageBreak",class:"docs-editor-page-break"}),["span",{class:"docs-editor-page-break__label"},"Page break"]]},addNodeView(){return()=>{const e=document.createElement("div");e.className="docs-editor-page-break",e.setAttribute("data-page-break","true"),e.setAttribute("data-node-type","pageBreak"),e.setAttribute("contenteditable","false");const t=document.createElement("div");t.className="docs-editor-page-break__inner";const i=document.createElement("div");i.className="docs-editor-page-break__line";const n=document.createElement("span");return n.className="docs-editor-page-break__label-text",n.textContent="Page break",t.appendChild(i),t.appendChild(n),e.appendChild(t),{dom:e,contentDOM:void 0}}}});_e.definePlugin({id:"pageBreak",tiptapExtensions:[pw],toolbar:[{id:"insert-page-break",label:"Page Break",action:"insertPageBreak",iconComponent:"FileText"}],slashCommands:[{name:"Page Break",command:"insertPageBreak"}],commands:{insertPageBreak:e=>e.chain().focus().insertContent([{type:"pageBreak"},{type:"paragraph"}]).run()}});var dw=vt.create({name:"footnote",group:"inline",inline:!0,selectable:!0,draggable:!1,atom:!0,addAttributes(){return{content:{default:"",parseHTML:e=>e.getAttribute("data-footnote-content")??"",renderHTML:e=>({"data-footnote-content":e.content})},citationId:{default:null,parseHTML:e=>e.getAttribute("data-citation-id"),renderHTML:e=>e.citationId?{"data-citation-id":e.citationId}:{}},sourceId:{default:null,parseHTML:e=>e.getAttribute("data-footnote-source-id"),renderHTML:e=>e.sourceId?{"data-footnote-source-id":e.sourceId}:{}},locator:{default:"",parseHTML:e=>e.getAttribute("data-footnote-locator")??"",renderHTML:e=>e.locator?{"data-footnote-locator":e.locator}:{}}}},parseHTML(){return[{tag:'span[data-node-type="footnote"]'}]},renderHTML({HTMLAttributes:e}){return["span",Fe(e,{"data-node-type":"footnote",class:"docs-footnote-ref"}),"1"]},addNodeView(){return e=>{const t=e.node??e,i=t&&typeof t=="object"&&"attrs"in t?t.attrs:{},n=document.createElement("span");return n.className="docs-footnote-ref",n.setAttribute("data-node-type","footnote"),n.setAttribute("data-footnote-content",String(i.content??"")),i.sourceId&&(n.setAttribute("data-footnote-source-id",String(i.sourceId)),n.setAttribute("data-citation-id",String(i.citationId??"")),i.locator&&n.setAttribute("data-footnote-locator",String(i.locator))),n.textContent="1",{dom:n,update(r){try{const a=(r==null?void 0:r.attrs)??{};n.setAttribute("data-footnote-content",String(a.content??"")),a.sourceId?(n.setAttribute("data-footnote-source-id",String(a.sourceId)),n.setAttribute("data-citation-id",String(a.citationId??"")),a.locator&&n.setAttribute("data-footnote-locator",String(a.locator))):(n.removeAttribute("data-footnote-source-id"),n.removeAttribute("data-citation-id"),n.removeAttribute("data-footnote-locator"))}catch{}return!0}}}}});_e.definePlugin({id:"footnote",tiptapExtensions:[dw],toolbar:[{id:"insert-footnote",label:"Catatan Kaki",action:"insertFootnote",iconComponent:"FileText"}],slashCommands:[{name:"Catatan Kaki",command:"insertFootnote"}],commands:{insertFootnote:(e,...t)=>{const i=t[0];return e.chain().focus().insertContent({type:"footnote",attrs:{content:(i==null?void 0:i.content)??""}}).run()}}});function ip(e){const t=[];return e.descendants((i,n)=>{if(i.type.name==="heading"){const r=i.attrs.level;(r===1||r===2||r===3)&&t.push({level:r,text:i.textContent.trim(),pos:n})}return!0}),t}function mw(e){return ip(e.state.doc)}function np(e){let t=[];try{const n=e.view.dom.querySelector("[data-rm-pagination]");n&&(t=Array.from(n.querySelectorAll(".rm-page-break .breaker")).filter(r=>r instanceof HTMLElement))}catch{}if(t.length===0)return()=>null;const i=e.view.dom;return n=>{try{const a=e.view.coordsAtPos(n).top-i.getBoundingClientRect().top+i.scrollTop;let o=1;for(const l of t){if(a<l.offsetTop)return o;o++}return o}catch{return null}}}function hw(e,t,i){const n=e.nodes.tocEntry;return t.length===0?[n.create({level:1,pos:0})]:t.map(r=>{const a=[];r.text&&a.push(e.text(r.text));const o=i(r.pos);return o!==null&&a.push(e.nodes.tocPageNum.create({page:o})),n.create({level:r.level,pos:r.pos},a)})}function bw(e){const t=mw(e);if(t.length===0)return[{type:"tocEntry",attrs:{level:1,pos:0}}];const i=np(e);return t.map(n=>{const r=[];n.text&&r.push({type:"text",text:n.text});const a=i(n.pos);return a!==null&&r.push({type:"tocPageNum",attrs:{page:a}}),{type:"tocEntry",attrs:{level:n.level,pos:n.pos},...r.length>0?{content:r}:{}}})}function rp(e,t){const i=e.schema.nodes.toc;if(!i)return!1;const n=[];if(t.doc.descendants((a,o)=>a.type.name==="toc"?(n.push({pos:o,nodeSize:a.nodeSize}),!1):!0),n.length===0)return!1;const r=hw(e.schema,ip(t.doc),np(e));for(const a of n.reverse())t.replaceWith(a.pos,a.pos+a.nodeSize,i.create(null,r));return!0}function ap(e){const t=e.state.tr;return rp(e,t)?(e.view.dispatch(t),!0):!1}var gw=Ke.create({name:"tocCommands",addCommands(){return{insertToc:()=>({editor:e,chain:t})=>t().focus().insertContent({type:"toc",content:bw(e)}).run(),refreshToc:()=>({editor:e,tr:t})=>rp(e,t)}}}),vw=vt.create({name:"tocPageNum",inline:!0,group:"inline",atom:!0,selectable:!1,addAttributes(){return{page:{default:null,parseHTML:e=>Number(e.textContent)||null,renderHTML:e=>e.page?{"data-page":e.page}:{}}}},parseHTML(){return[{tag:"span[data-toc-page]"}]},renderHTML({node:e,HTMLAttributes:t}){return["span",Fe(t,{"data-toc-page":"",class:"docs-toc__page"}),String(e.attrs.page??"")]}}),yw=vt.create({name:"tocEntry",content:"inline*",defining:!0,addAttributes(){return{level:{default:1,parseHTML:e=>Number(e.getAttribute("data-level")??1),renderHTML:e=>({"data-level":e.level})},pos:{default:0,parseHTML:e=>Number(e.getAttribute("data-pos")??0),renderHTML:e=>({"data-pos":e.pos})}}},parseHTML(){return[{tag:"p[data-toc-entry]"}]},renderHTML({HTMLAttributes:e}){return["p",Fe(e,{"data-toc-entry":"",class:"docs-toc__entry"}),0]}}),xw=vt.create({name:"toc",group:"block",content:"tocEntry+",defining:!0,parseHTML(){return[{tag:"div[data-toc]"}]},renderHTML({HTMLAttributes:e}){return["div",Fe(e,{"data-toc":"",class:"docs-toc"}),0]},addNodeView(){return e=>{const t=e.editor,i=document.createElement("div");i.className="docs-toc",i.setAttribute("data-toc","");const n=document.createElement("div");n.className="docs-toc__chrome",n.contentEditable="false";const r=document.createElement("span");r.className="docs-toc__caption",r.textContent="Table of contents";const a=document.createElement("button");a.type="button",a.className="docs-toc__refresh",a.title="Refresh table of contents",a.textContent="⟳",n.appendChild(r),n.appendChild(a);const o=document.createElement("div");o.className="docs-toc__entries",i.appendChild(n),i.appendChild(o);const l=f=>{f.preventDefault(),ap(t)},c=f=>{var h,v;const p=(v=(h=f.target)==null?void 0:h.closest)==null?void 0:v.call(h,"[data-toc-entry]");if(!p)return;const m=Number(p.getAttribute("data-pos")??0),d=Math.min(Math.max(0,m),t.state.doc.content.size);t.chain().focus().setTextSelection(d).scrollIntoView().run()};return a.addEventListener("click",l),i.addEventListener("click",c),{dom:i,contentDOM:o,update(f){var p;return((p=f==null?void 0:f.type)==null?void 0:p.name)==="toc"},destroy(){a.removeEventListener("click",l),i.removeEventListener("click",c)}}}}});_e.definePlugin({id:"toc",tiptapExtensions:[vw,yw,xw,gw],slashCommands:[{name:"Table of contents",description:"Daftar isi",command:"insertToc"}],commands:{insertToc:e=>e.commands.insertToc(),refreshToc:e=>ap(e)}});_e.definePlugin({id:"font-size",tiptapExtensions:[_e.FontSizeExtension],commands:{setFontSize:(e,...t)=>{const i=t[0]||"16px";return i==="16px"?e.commands.unsetFontSize():e.commands.setFontSize(i),e.commands.focus(),!0}}});_e.definePlugin({id:"text-color",tiptapExtensions:[nw],toolbar:[{id:"text-color",label:"Text Color",action:"setTextColor",iconComponent:"Palette"}],commands:{setTextColor:(e,...t)=>{const i=t[0];return i?i==="default"?e.chain().focus().unsetColor().run():e.chain().focus().setColor(i).run():!1}}});var kw=ow.extend({parseHTML(){return[{tag:"mark"},{tag:"span",style:"background-color"}]},renderHTML({HTMLAttributes:e}){return["mark",Fe(this.options.HTMLAttributes,e),0]}});_e.definePlugin({id:"highlight",tiptapExtensions:[kw.configure({multicolor:!0})],toolbar:[{id:"highlight",label:"Highlight",action:"setHighlight",iconComponent:"Highlighter"}],commands:{setHighlight:(e,...t)=>{const i=t[0];return i?i==="default"?e.chain().focus().unsetHighlight().run():e.chain().focus().toggleHighlight({color:i}).run():e.chain().focus().toggleHighlight().run()}}});var Ze=new ot("docflow-ai"),Nc=1500;function rs(e){var t;return(t=e.storage.editorContext)==null?void 0:t.aiStream}function Ac(e,t,i){return{before:e.doc.textBetween(Math.max(0,t-Nc),t,`
15050
15050
  `," "),after:e.doc.textBetween(i,Math.min(e.doc.content.size,i+Nc),`
15051
15051
  `," ")}}function Oc(e,t,i){const n=rs(e);n&&(async()=>{const r=a=>{i.signal.aborted||e.isDestroyed||e.view.dispatch(e.state.tr.setMeta(Ze,a))};try{for await(const a of n(t,i.signal)){if(i.signal.aborted||e.isDestroyed)return;r({type:"chunk",text:a})}r({type:"done"})}catch(a){r({type:"error",message:a instanceof Error?a.message:"AI request failed"})}})()}function Tc(e){var i;const t=e.storage.ai;(i=t.abort)==null||i.abort(),t.abort=null}var ww=Ke.create({name:"ai",addStorage(){return{preview:null,abort:null}},addCommands(){return{aiTransform:e=>({editor:t,state:i,dispatch:n})=>{if(Ze.getState(i))return!1;if(!rs(t))return console.warn("[ai] no aiStream port injected — AI actions are inert"),!1;const{from:r,to:a,empty:o}=i.selection;if(o)return!1;const l=i.doc.textBetween(r,a,`
15052
15052
  `," ");if(!l.trim())return!1;const c=new AbortController;t.storage.ai.abort=c,n==null||n(i.tr.setMeta(Ze,{type:"start",mode:"transform",status:"streaming",from:r,to:a,originalText:l,action:e.action}));const f={action:e.action,selection:l,context:Ac(i,r,a),...e.prompt?{prompt:e.prompt}:{}};return Oc(t,f,c),!0},aiGenerate:()=>({editor:e,state:t,dispatch:i})=>{if(Ze.getState(t))return!1;if(!rs(e))return console.warn("[ai] no aiStream port injected — AI actions are inert"),!1;const n=t.selection.to;return i==null||i(t.tr.setMeta(Ze,{type:"start",mode:"generate",status:"prompt",from:n,to:n,originalText:"",action:"generate"})),!0},aiPromptSubmit:e=>({editor:t,state:i,dispatch:n})=>{var c;const r=Ze.getState(i);if(!r||r.mode!=="generate"||r.status!=="prompt")return!1;const a=(c=e.prompt)==null?void 0:c.trim();if(!a)return!1;const o=new AbortController;t.storage.ai.abort=o,n==null||n(i.tr.setMeta(Ze,{type:"start",mode:"generate",status:"streaming",from:r.from,to:r.to,originalText:"",action:"generate"}));const l={action:"generate",prompt:a,context:Ac(i,r.from,r.to)};return Oc(t,l,o),t.commands.focus(),!0},aiAccept:()=>({editor:e,state:t,dispatch:i})=>{const n=Ze.getState(t);if(!n||n.status==="prompt")return!1;if(Tc(e),!i)return!0;const r=t.tr;return n.text.trim()&&r.replaceWith(n.from,n.to,t.schema.text(n.text)),r.setMeta(Ze,{type:"clear"}),i(r),!0},aiReject:()=>({editor:e,state:t,dispatch:i})=>Ze.getState(t)?(Tc(e),i==null||i(t.tr.setMeta(Ze,{type:"clear"})),!0):!1}},addProseMirrorPlugins(){const e=this.editor;let t=null;function i(){if(t)return t;const r=document.createElement("span");r.className="docs-ai-prompt";const a=document.createElement("input");return a.type="text",a.className="docs-ai-prompt__input",a.placeholder="Ask AI to write… (Enter ⏎ · Esc cancel)",a.addEventListener("keydown",o=>{o.key==="Enter"?(o.preventDefault(),e.commands.aiPromptSubmit({prompt:a.value})):o.key==="Escape"&&(o.preventDefault(),e.commands.aiReject())}),a.addEventListener("blur",()=>{const o=Ze.getState(e.state);(o==null?void 0:o.status)==="prompt"&&e.commands.aiReject()}),r.appendChild(a),setTimeout(()=>a.focus(),0),t={dom:r,stopEvent:o=>o.target instanceof Node&&r.contains(o.target)},t}function n(r){const a=document.createElement("span");let o=null;if(r.status==="error")a.className="docs-ai-ghost docs-ai-ghost--error",a.textContent=` ${r.error??"AI error"} — press Esc`;else{a.className="docs-ai-ghost";const l=document.createElement("span");if(!r.text&&r.status==="streaming"?(l.textContent="AI writing…",l.className="docs-ai-ghost-placeholder"):l.textContent=r.text+(r.status==="streaming"?"▌":""),a.appendChild(l),r.status==="done"){o=document.createElement("span"),o.className="docs-ai-ghost-actions";const c=document.createElement("button");c.type="button",c.className="docs-ai-ghost-btn docs-ai-ghost-btn--accept",c.textContent="✓ Accept",c.title="Accept (Enter)",c.addEventListener("mousedown",p=>{p.preventDefault(),e.commands.aiAccept()});const f=document.createElement("button");f.type="button",f.className="docs-ai-ghost-btn docs-ai-ghost-btn--reject",f.textContent="✗ Reject",f.title="Reject (Esc)",f.addEventListener("mousedown",p=>{p.preventDefault(),e.commands.aiReject()}),o.appendChild(c),o.appendChild(f),a.appendChild(o)}}return{dom:a,stopEvent:l=>o!==null&&l.target instanceof Node&&o.contains(l.target)}}return[new ft({key:Ze,state:{init:()=>null,apply(r,a){const o=r.getMeta(Ze);if(o)switch(o.type){case"start":return{mode:o.mode,status:o.status,from:o.from,to:o.to,originalText:o.originalText,text:"",action:o.action};case"chunk":return a&&{...a,text:a.text+o.text};case"done":return a&&{...a,status:"done"};case"error":return a&&{...a,status:"error",error:o.message};case"clear":return null}if(!a)return a;if(a.status==="prompt"&&r.selectionSet)return null;if(r.docChanged){if(a.mode==="generate"){const f=r.mapping.map(a.from,1);return{...a,from:f,to:f}}const l=r.mapping.map(a.from,-1),c=r.mapping.map(a.to,1);return c<=l||r.doc.textBetween(l,c,`
15053
15053
  `," ")!==a.originalText?null:{...a,from:l,to:c}}return a}},props:{decorations(r){const a=Ze.getState(r);if(!a)return t=null,Be.empty;const o=[];if(a.mode==="transform"&&a.to>a.from&&o.push(tt.inline(a.from,a.to,{class:"docs-ai-selection"})),a.status==="prompt"){const l=i();o.push(tt.widget(a.to,l.dom,{key:"docs-ai-prompt",side:1,stopEvent:l.stopEvent}))}else{t=null;const l=n(a);o.push(tt.widget(a.to,l.dom,{key:`docs-ai-ghost-${a.status}-${a.text.length}-${(a.error??"").length}`,side:1,stopEvent:l.stopEvent}))}return Be.create(r.doc,o)},handleKeyDown(r,a){const o=Ze.getState(e.state);return o?a.key==="Escape"?(e.commands.aiReject(),!0):o.status==="prompt"?!1:(a.key==="Enter"||a.key==="Tab")&&o.status!=="error"?(a.preventDefault(),e.commands.aiAccept(),!0):!1:!1}}})]},onTransaction(){const e=this.editor.storage.ai;e.preview=Ze.getState(this.editor.state)??null},onDestroy(){var t;const e=this.editor.storage.ai;(t=e.abort)==null||t.abort(),e.abort=null,e.preview=null}});_e.definePlugin({id:"ai",tiptapExtensions:[ww],slashCommands:[{name:"AI",description:"Generate text with AI",command:"aiGenerate"}]});xi.create({name:"comment",inclusive:!0,addAttributes(){return{threadId:{default:null,parseHTML:e=>e.getAttribute("data-comment-thread"),renderHTML:e=>e.threadId?{"data-comment-thread":e.threadId,class:"docs-comment"}:{}},pos:{default:null,renderHTML:()=>({})}}},parseHTML(){return[{tag:"span[data-comment-thread]"}]},renderHTML({HTMLAttributes:e}){return["span",e,0]}});var ct={open:!1,query:"",position:{top:0,left:0},commands:[],selectedIndex:0},_w=[];function La(){_w.forEach(e=>e())}function ko(){ct={...ct,open:!1,query:""},La()}function Lr(e,t){const{selection:i}=e.state,n=i.head,r=e.coordsAtPos(n),a=Cw(),o=t?a.filter(l=>l.name.toLowerCase().includes(t.toLowerCase())):a;ct={open:!0,query:t,position:{top:r.bottom+4,left:r.left},commands:o.map(l=>({...l,action:null})),selectedIndex:0},La()}var as=new Map;function Sw(e,t){const i=as.get(e)||[];as.set(e,[...i,...t])}function Cw(){const e=[];as.forEach(i=>{e.push(...i)});const t=new Set;return e.filter(i=>t.has(i.name)?!1:(t.add(i.name),!0))}var Ew=Ke.create({name:"slashMenu",addProseMirrorPlugins(){return[new ft({key:new ot("slashMenu"),props:{handleTextInput(e,t,i,n){if(n==="/"){const r=e.state.doc.resolve(t),a=r.parent.textContent.slice(0,r.parentOffset);if(a===""||a.endsWith(" "))return setTimeout(()=>Lr(e,""),10),!1}if(ct.open&&n.length===1&&/[a-zA-Z]/.test(n)){const r=ct.query+n;return Lr(e,r),!1}return!1},handleKeyDown(e,t){if(!ct.open)return!1;if(t.key==="ArrowDown")return t.preventDefault(),ct.selectedIndex=Math.min(ct.selectedIndex+1,ct.commands.length-1),La(),!0;if(t.key==="ArrowUp")return t.preventDefault(),ct.selectedIndex=Math.max(ct.selectedIndex-1,0),La(),!0;if(t.key==="Enter"){t.preventDefault();const i=ct.commands[ct.selectedIndex];if(i){const n=e.state.doc.resolve(e.state.selection.head),r=n.start(),a=r+n.parent.textContent.lastIndexOf("/");if(a>=r){const l=e.state.tr.delete(a,e.state.selection.head);e.dispatch(l)}const o=e._tiptapEditor;if(o){const l=o;typeof l[i.command]=="function"&&l[i.command]()}}return ko(),!0}if(t.key==="Escape")return ko(),!0;if(t.key==="Backspace")if(ct.query.length>0){const i=ct.query.slice(0,-1);return i?Lr(e,i):Lr(e,""),!1}else{const i=e.state.doc.resolve(e.state.selection.head),n=i.start(),r=i.parent.textContent.lastIndexOf("/");if(r>=0){const a=e.state.tr.delete(n+r,e.state.selection.head);e.dispatch(a)}return ko(),!0}return!1}}})]}});_e.definePlugin({id:"slash-menu",tiptapExtensions:[Ew],hooks:{onInit(e){Sw("default",[])}}});const ss=/\[(\d{1,3})\]/g;function Nw(e){return e.replace(ss,"")}function Aw(e,t,i){const n=[];let r=0;ss.lastIndex=0;let a;for(;(a=ss.exec(e))!==null;){const l=Number(a[1]),c=t.get(l),f=e.slice(r,a.index);if(f&&n.push(f),!c){r=a.index+a[0].length;continue}n.push(Bf(i,{sourceId:c.sourceId})),r=a.index+a[0].length}const o=e.slice(r);return o&&n.push(o),n}const Ow={class:"ai-sidebar flex h-full w-80 flex-shrink-0 flex-col border-l border-slate-200 bg-white/80 text-slate-800 backdrop-blur-xl transition-all dark:border-white/5 dark:bg-[#0a0f1e]/85 dark:text-slate-100"},Tw={class:"flex items-start justify-between border-b border-slate-200 p-4 dark:border-white/5"},Mw={class:"flex items-center gap-1.5 font-mono text-xs font-bold uppercase tracking-widest text-slate-500 dark:text-slate-400"},zw={class:"mt-1.5 text-[10px] leading-relaxed text-slate-400 dark:text-slate-500"},Iw=["aria-label"],Dw={key:0,class:"flex flex-1 flex-col items-center justify-center p-6 text-center text-slate-400 dark:text-slate-500"},Rw={class:"text-xs"},Lw={class:"space-y-2 border-b border-slate-200 p-4 dark:border-white/5"},Bw={class:"block font-mono text-[10px] font-bold uppercase tracking-widest text-slate-400 dark:text-slate-500"},Pw={class:"grid grid-cols-2 gap-2"},Vw=["disabled","title","onClick"],Fw={key:0,class:"flex h-full flex-col items-center justify-center p-4 text-center text-slate-400 dark:text-slate-500"},Uw={class:"text-[10px]"},Hw={class:"flex items-center gap-1 font-mono text-[9px] font-bold uppercase tracking-widest text-slate-400 dark:text-slate-500"},jw={key:0,class:"animate-pulse text-cyan-500"},qw={key:0,class:"flex flex-wrap gap-1 pl-1"},$w={key:1,class:"flex gap-1.5"},Ww=["onClick"],Gw=["onClick"],Kw={class:"border-t border-slate-200 bg-slate-50 p-4 dark:border-white/5 dark:bg-[#0a0f1e]/80"},Xw=["disabled","placeholder","onKeydown"],Jw={class:"flex justify-end"},Zw=["disabled"],op=s.defineComponent({__name:"AISidebar",props:{editor:{},aiStream:{type:Function},aiDraft:{type:Function}},emits:["close"],setup(e,{emit:t}){const i=e,n=t,{t:r}=rt();function a(){return i.editor?s.toRaw(i.editor):null}const o=s.ref([]),l=s.ref(""),c=s.ref(!1),f=s.ref(null),p=s.ref(null),m=s.ref(null);let d=null;const h=s.computed(()=>{var P,W,L;return i.aiStream?i.aiStream:(L=(W=(P=a())==null?void 0:P.storage)==null?void 0:W.editorContext)==null?void 0:L.aiStream}),v=s.computed(()=>{var P,W,L;return i.aiDraft?i.aiDraft:(L=(W=(P=a())==null?void 0:P.storage)==null?void 0:W.editorContext)==null?void 0:L.aiDraft}),b=s.ref(!1),y=s.ref(0);function g(){y.value++}s.watch(()=>i.editor,(P,W)=>{W&&s.toRaw(W).off("transaction",g),P&&s.toRaw(P).on("transaction",g)},{immediate:!0});const x=s.computed(()=>{var Q;y.value;const P=(Q=a())==null?void 0:Q.state;if(!P||P.selection.empty)return null;const{from:W,to:L}=P.selection;return{from:W,to:L,text:P.doc.textBetween(W,L,`
15054
15054
  `," ")}});function k(){var j;const P=(j=a())==null?void 0:j.state;if(!P)return;const{from:W,to:L}=P.selection,Q=1500;return{before:P.doc.textBetween(Math.max(0,W-Q),W,`
15055
15055
  `," "),after:P.doc.textBetween(L,Math.min(P.doc.content.size,L+Q),`
15056
- `," ")}}async function w(){await s.nextTick(),m.value&&(m.value.scrollTop=m.value.scrollHeight)}async function C(P,W){const L=h.value;if(!L||c.value)return;d==null||d.abort(),d=new AbortController,c.value=!0,o.value.push({role:"user",text:W}),o.value.push({role:"assistant",text:"",streaming:!0});const Q=o.value.length-1;await w();try{for await(const j of L(P,d.signal))o.value[Q].text+=j,w();o.value[Q].text||(o.value[Q].text=r("sidebars.ai.emptyResponse"),o.value[Q].error=!0)}catch(j){d.signal.aborted||(o.value[Q].text=`${r("sidebars.ai.aiError")}: ${j instanceof Error?j.message:String(j)}`,o.value[Q].error=!0)}finally{o.value[Q].streaming=!1,c.value=!1,d=null,w()}}function E(){const P=l.value.trim();if(!P||c.value)return;if(l.value="",b.value){B({prompt:P,context:k()},P);return}const W=x.value;C({action:"chat",prompt:P,...W?{selection:W.text}:{},context:k()},P)}async function B(P,W){const L=v.value;if(!L||c.value)return;d==null||d.abort(),d=new AbortController,c.value=!0,o.value.push({role:"user",text:W}),o.value.push({role:"assistant",text:"",streaming:!0});const Q=o.value.length-1;await w();try{for await(const j of L(P,d.signal))j.type==="delta"?(o.value[Q].text+=j.text,w()):j.type==="done"?o.value[Q].citations=j.citations:j.type==="error"&&(o.value[Q].text=`${r("sidebars.ai.aiError")}: ${j.message}`,o.value[Q].error=!0,o.value[Q].citations=void 0);!o.value[Q].text&&!o.value[Q].error&&(o.value[Q].text=r("sidebars.ai.emptyResponse"),o.value[Q].error=!0)}catch(j){d.signal.aborted||(o.value[Q].text=`${r("sidebars.ai.aiError")}: ${j instanceof Error?j.message:String(j)}`,o.value[Q].error=!0,o.value[Q].citations=void 0)}finally{o.value[Q].streaming=!1,c.value=!1,d=null,w()}}function _(){b.value=!b.value,s.nextTick(()=>{const P=document.querySelector(".ai-sidebar textarea");P==null||P.focus()})}function S(P){if(c.value||!P.action)return;const W=x.value;P.needsSelection&&!W||C({action:P.action,...W?{selection:W.text}:{},...P.prompt?{prompt:P.prompt}:{},context:k()},P.prompt??P.label)}function T(){var P,W,L;x.value&&((L=(W=(P=a())==null?void 0:P.commands)==null?void 0:W.aiTransform)==null||L.call(W,{action:"rewrite"}))}const D=s.computed(()=>[{label:r("sidebars.ai.summarize"),icon:No,color:"text-cyan-500",action:"summarize",needsSelection:!0},{label:r("sidebars.ai.fixGrammar"),icon:Qp,color:"text-emerald-500",action:"grammar",needsSelection:!0},{label:r("sidebars.ai.continue"),icon:Ud,color:"text-amber-500",action:"generate",prompt:"Continue writing naturally from where the text ends, matching the existing style."},{label:r("sidebars.ai.toSpanish"),icon:Gc,color:"text-cyan-500",action:"translate",prompt:"translate to Spanish",needsSelection:!0},{label:r("sidebars.ai.improveSelection"),icon:Ed,color:"text-violet-500",improve:!0,needsSelection:!0},{label:r("sidebars.ai.draft"),icon:Kr,color:"text-cyan-500",draft:!0,disabled:!v.value}]);function H(P,W){P.text&&(navigator.clipboard.writeText(P.text),f.value=W,setTimeout(()=>f.value=null,2e3))}function V(P){p.value=P,setTimeout(()=>{p.value===P&&(p.value=null)},2e3)}function M(P,W){const L=a();if(!P.text||!L)return;const{state:Q,view:j}=L,{from:O,to:R}=Q.selection;if(!P.citations||P.citations.length===0){j.dispatch(Q.tr.insertText(P.text,O,R)),j.focus(),V(W);return}const U=fn(L);if(!U){j.dispatch(Q.tr.insertText(Nw(P.text),O,R)),j.focus(),V(W);return}const oe=new Map(P.citations.map(F=>[F.ref,F])),ie=Aw(P.text,oe,U),ee=Q.schema,te=ie.map(F=>typeof F=="string"?ee.text(F):ee.nodeFromJSON(F)).filter(F=>!!F),X=new ae(Z.from(te),0,0);j.dispatch(Q.tr.replace(O,R,X)),j.focus(),V(W)}function $(){d==null||d.abort(),c.value=!1,n("close")}return s.onUnmounted(()=>{var P;d==null||d.abort(),(P=a())==null||P.off("transaction",g)}),(P,W)=>(s.openBlock(),s.createElementBlock("div",Ow,[s.createElementVNode("div",Tw,[s.createElementVNode("div",null,[s.createElementVNode("h3",Mw,[s.createVNode(s.unref(on),{class:"h-4 w-4 animate-pulse text-cyan-400"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.ai.title")),1)]),s.createElementVNode("p",zw,s.toDisplayString(s.unref(r)("sidebars.ai.description")),1)]),s.createElementVNode("button",{type:"button",class:"rounded-md p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/5 dark:hover:text-slate-200","aria-label":s.unref(r)("sidebars.ai.close"),onClick:$},[s.createVNode(s.unref(Dt),{class:"h-4 w-4"})],8,Iw)]),h.value?(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createElementVNode("div",Lw,[s.createElementVNode("span",Bw,s.toDisplayString(s.unref(r)("sidebars.ai.quickMacros")),1),s.createElementVNode("div",Pw,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(D.value,L=>(s.openBlock(),s.createElementBlock("button",{key:L.label,type:"button",disabled:c.value||L.needsSelection&&!x.value||"disabled"in L&&L.disabled,title:L.needsSelection&&!x.value?s.unref(r)("sidebars.ai.selectTextFirst"):L.label,class:s.normalizeClass(["flex items-center gap-1.5 rounded-lg border px-2.5 py-1.5 text-left text-[11px] font-bold transition-colors disabled:opacity-40","draft"in L&&L.draft&&b.value?"border-cyan-500 bg-cyan-500/10 text-cyan-700 dark:border-cyan-400/50 dark:bg-cyan-500/15 dark:text-cyan-300":"border-slate-200 bg-slate-50 text-slate-700 hover:border-cyan-500/50 dark:border-white/10 dark:bg-white/[0.02] dark:text-slate-300 dark:hover:border-cyan-500/30"]),onClick:Q=>L.improve?T():"draft"in L&&L.draft?_():S(L)},[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(L.icon),{class:s.normalizeClass(["h-3 w-3",L.color])},null,8,["class"])),s.createElementVNode("span",null,s.toDisplayString(L.label),1)],10,Vw))),128))])]),s.createElementVNode("div",{ref_key:"turnsEl",ref:m,class:"flex-1 space-y-3 overflow-y-auto p-4"},[o.value.length===0?(s.openBlock(),s.createElementBlock("div",Fw,[s.createVNode(s.unref(on),{class:"mb-2 h-6 w-6 text-cyan-500 opacity-30"}),s.createElementVNode("p",Uw,s.toDisplayString(s.unref(r)("sidebars.ai.noDraft")),1)])):s.createCommentVNode("",!0),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(o.value,(L,Q)=>(s.openBlock(),s.createElementBlock("div",{key:Q,class:s.normalizeClass(["flex flex-col gap-1",L.role==="user"?"items-end":"items-start"])},[s.createElementVNode("span",Hw,[L.role==="user"?(s.openBlock(),s.createBlock(s.unref(fs),{key:0,class:"h-2.5 w-2.5"})):(s.openBlock(),s.createBlock(s.unref(on),{key:1,class:"h-2.5 w-2.5 text-cyan-400"})),s.createTextVNode(" "+s.toDisplayString(L.role==="user"?s.unref(r)("sidebars.ai.you"):s.unref(r)("sidebars.ai.assistant")),1)]),s.createElementVNode("div",{class:s.normalizeClass(["max-w-full whitespace-pre-wrap rounded-xl px-3 py-2 text-xs leading-relaxed",[L.role==="user"?"bg-cyan-500/10 text-slate-700 dark:bg-cyan-500/15 dark:text-slate-200":L.error?"bg-red-50 text-red-700 dark:bg-red-500/10 dark:text-red-300":"bg-slate-100 text-slate-700 dark:bg-white/[0.04] dark:text-slate-300"]])},[s.createTextVNode(s.toDisplayString(L.text),1),L.streaming?(s.openBlock(),s.createElementBlock("span",jw,"▌")):s.createCommentVNode("",!0)],2),L.role==="assistant"&&L.citations&&L.citations.length>0?(s.openBlock(),s.createElementBlock("div",qw,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(L.citations,j=>(s.openBlock(),s.createElementBlock("span",{key:j.ref,class:"inline-flex items-center gap-1 rounded-full border border-cyan-500/30 bg-cyan-500/5 px-2 py-0.5 text-[10px] font-semibold text-cyan-700 dark:border-cyan-400/30 dark:bg-cyan-500/10 dark:text-cyan-300"},[s.createVNode(s.unref(Kr),{class:"h-2.5 w-2.5"}),s.createTextVNode(s.toDisplayString(j.label),1)]))),128))])):s.createCommentVNode("",!0),L.role==="assistant"&&!L.streaming&&!L.error&&L.text?(s.openBlock(),s.createElementBlock("div",$w,[s.createElementVNode("button",{type:"button",class:"flex items-center gap-1 rounded-lg border border-slate-200 bg-white px-2 py-1 text-[10px] font-semibold text-slate-600 transition-all hover:bg-slate-50 dark:border-white/10 dark:bg-white/[0.02] dark:text-slate-300 dark:hover:bg-white/5",onClick:j=>H(L,Q)},[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(f.value===Q?s.unref(Wr):s.unref(od)),{class:s.normalizeClass(["h-3 w-3",f.value===Q?"text-emerald-500":""])},null,8,["class"])),s.createElementVNode("span",null,s.toDisplayString(f.value===Q?s.unref(r)("sidebars.ai.copied"):s.unref(r)("sidebars.ai.copy")),1)],8,Ww),s.createElementVNode("button",{type:"button",class:"flex items-center gap-1 rounded-lg bg-cyan-500 px-2 py-1 text-[10px] font-bold text-black shadow-cyan transition-all hover:bg-cyan-400",onClick:j=>M(L,Q)},[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(p.value===Q?s.unref(Wr):s.unref(Jp)),{class:"h-3 w-3"})),s.createElementVNode("span",null,s.toDisplayString(p.value===Q?s.unref(r)("sidebars.ai.inserted"):s.unref(r)("sidebars.ai.insert")),1)],8,Gw)])):s.createCommentVNode("",!0)],2))),128))],512),s.createElementVNode("div",Kw,[s.createElementVNode("form",{class:"space-y-2",onSubmit:s.withModifiers(E,["prevent"])},[s.withDirectives(s.createElementVNode("textarea",{"onUpdate:modelValue":W[0]||(W[0]=L=>l.value=L),rows:"2",disabled:c.value,placeholder:b.value?s.unref(r)("sidebars.ai.draftPlaceholder"):s.unref(r)("sidebars.ai.promptPlaceholder"),class:"w-full min-h-[55px] resize-none rounded-xl border border-slate-200 bg-white p-2.5 text-xs text-slate-800 transition-all focus:border-cyan-500/50 focus:shadow-cyan focus:outline-none disabled:opacity-60 dark:border-white/10 dark:bg-white/[0.02] dark:text-slate-100 dark:focus:border-cyan-500/30",onKeydown:s.withKeys(s.withModifiers(E,["exact","prevent"]),["enter"])},null,40,Xw),[[s.vModelText,l.value]]),s.createElementVNode("div",Jw,[s.createElementVNode("button",{type:"submit",disabled:c.value||!l.value.trim(),class:"flex items-center gap-1 rounded-lg bg-cyan-500 px-3.5 py-2 text-xs font-bold text-black shadow-cyan transition-all hover:bg-cyan-400 disabled:opacity-40"},[s.createVNode(s.unref(Eo),{class:"h-3.5 w-3.5"}),s.createTextVNode(" "+s.toDisplayString(b.value?s.unref(r)("sidebars.ai.promptDraft"):s.unref(r)("sidebars.ai.promptAI")),1)],8,Zw)])],32)])],64)):(s.openBlock(),s.createElementBlock("div",Dw,[s.createVNode(s.unref(on),{class:"mb-2 h-6 w-6 text-cyan-500 opacity-30"}),s.createElementVNode("p",Rw,s.toDisplayString(s.unref(r)("sidebars.ai.notConfigured")),1)]))]))}}),Qw={class:"comments-sidebar flex h-full w-80 flex-shrink-0 flex-col border-l border-slate-200 bg-white/80 text-slate-800 backdrop-blur-xl transition-all dark:border-white/5 dark:bg-[#0a0f1e]/85 dark:text-slate-100"},Yw={class:"border-b border-slate-200 p-4 dark:border-white/5"},e_={class:"mb-3 flex items-center justify-between"},t_={class:"flex items-center gap-1.5 font-mono text-xs font-bold uppercase tracking-widest text-slate-500 dark:text-slate-400"},i_={class:"flex rounded-xl border border-slate-200 bg-slate-50 p-1 text-[11px] font-semibold dark:border-white/10 dark:bg-white/[0.02]"},n_={key:0,class:"mb-1 rounded-xl border border-cyan-500/25 bg-cyan-500/5 p-2.5 text-xs text-cyan-700 animate-fadeIn dark:border-cyan-500/15 dark:bg-cyan-500/10 dark:text-cyan-400"},r_={class:"mb-1 font-mono text-[9px] font-bold uppercase tracking-wider"},a_={class:"line-clamp-1 border-l-2 border-cyan-400 bg-cyan-500/10 py-0.5 pl-2.5 italic dark:bg-cyan-500/5"},o_={class:"flex-1 space-y-4 overflow-y-auto p-4"},s_={class:"flex items-start justify-between"},l_={class:"flex items-center gap-2"},c_={class:"text-xs font-bold text-slate-800 dark:text-slate-200"},u_={class:"font-mono text-[9px] text-slate-400 dark:text-slate-500"},f_={class:"flex items-center gap-1.5"},p_=["title","onClick"],d_=["title","onClick"],m_={key:0,class:"inline-flex items-center gap-1 rounded-full border border-amber-400/40 bg-amber-500/10 px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider text-amber-600 dark:border-amber-500/30 dark:text-amber-400"},h_={class:"whitespace-pre-wrap break-words text-xs leading-relaxed text-slate-700 dark:text-slate-300"},b_={key:2,class:"space-y-2.5 border-l border-slate-200 pl-4 pt-1 dark:border-white/10"},g_={class:"flex items-center gap-1.5"},v_={class:"text-[10px] font-bold text-slate-600 dark:text-slate-300"},y_={class:"font-mono text-[8px] text-slate-400 dark:text-slate-500"},x_={class:"break-words pl-1 text-xs text-slate-600 dark:text-slate-400"},k_={key:3,class:"flex items-center justify-between border-t border-slate-100 pt-2 dark:border-white/5"},w_={key:0,class:"flex w-full items-center gap-1.5"},__=["onUpdate:modelValue","placeholder","onKeydown"],S_=["onClick"],C_=["onClick"],E_={key:4,class:"rounded-lg border border-green-100/40 bg-green-50/55 p-2 text-[10px] text-green-700 dark:border-green-500/10 dark:bg-green-950/10 dark:text-green-400"},N_={key:0},A_={key:0,class:"py-12 text-center text-slate-400 dark:text-slate-500"},O_={class:"text-xs"},T_={key:0,class:"border-t border-slate-200 bg-slate-50 p-4 dark:border-white/5 dark:bg-[#0a0f1e]/80"},M_=["placeholder"],z_={class:"flex items-center justify-between"},I_={class:"font-mono text-[9px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500"},D_=["disabled"],sp=s.defineComponent({__name:"CommentsSidebar",props:{comments:{},selectedTextSnippet:{},selectedTextIndex:{},orphanedIds:{}},emits:["add-comment","add-reply","resolve-comment","delete-comment"],setup(e,{emit:t}){const i=e,n=t,{t:r}=rt(),a=s.ref(""),o=s.ref({}),l=s.ref(null),c=s.ref("active"),f=s.computed(()=>(i.comments??[]).filter(b=>c.value==="resolved"?b.resolved:!b.resolved));function p(){a.value.trim()&&n("add-comment",a.value.trim(),i.selectedTextSnippet,i.selectedTextIndex)}function m(b){const y=o.value[b]||"";y.trim()&&(n("add-reply",b,y.trim()),o.value={...o.value,[b]:""},l.value=null)}function d(b){return b.split(" ").map(y=>y[0]).join("").slice(0,2).toUpperCase()}function h(b){var y;return((y=i.orphanedIds)==null?void 0:y.includes(b.id))===!0}function v(b){typeof window<"u"&&!window.confirm(r("sidebars.comments.confirmDelete"))||n("delete-comment",b)}return(b,y)=>(s.openBlock(),s.createElementBlock("div",Qw,[s.createElementVNode("div",Yw,[s.createElementVNode("div",e_,[s.createElementVNode("h3",t_,[s.createVNode(s.unref(Yc),{class:"h-4 w-4 text-cyan-400"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.comments.title")),1)]),s.createElementVNode("div",i_,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([c.value==="active"?"bg-cyan-500/15 text-cyan-600 dark:text-cyan-400 font-bold":"text-slate-400 hover:text-slate-600","rounded-lg px-2.5 py-1 transition-all"]),onClick:y[0]||(y[0]=g=>c.value="active")},s.toDisplayString(s.unref(r)("sidebars.comments.active")),3),s.createElementVNode("button",{type:"button",class:s.normalizeClass([c.value==="resolved"?"bg-cyan-500/15 text-cyan-600 dark:text-cyan-400 font-bold":"text-slate-400 hover:text-slate-600","rounded-lg px-2.5 py-1 transition-all"]),onClick:y[1]||(y[1]=g=>c.value="resolved")},s.toDisplayString(s.unref(r)("sidebars.comments.resolved")),3)])]),e.selectedTextSnippet?(s.openBlock(),s.createElementBlock("div",n_,[s.createElementVNode("p",r_,s.toDisplayString(s.unref(r)("sidebars.comments.creatingAnchored")),1),s.createElementVNode("p",a_,' "'+s.toDisplayString(e.selectedTextSnippet)+'" ',1)])):s.createCommentVNode("",!0)]),s.createElementVNode("div",o_,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(f.value,g=>(s.openBlock(),s.createElementBlock("div",{key:g.id,class:"relative space-y-3 rounded-2xl border border-slate-200/60 bg-slate-50/60 p-4 transition-all hover:border-cyan-500/30 hover:shadow-cyan dark:border-white/5 dark:bg-[#02040a]/40"},[s.createElementVNode("div",s_,[s.createElementVNode("div",l_,[s.createElementVNode("div",{class:"flex h-6 w-6 items-center justify-center rounded-full text-[10px] font-bold text-white shadow-sm",style:s.normalizeStyle({backgroundColor:g.authorColor})},s.toDisplayString(d(g.authorName)),5),s.createElementVNode("div",null,[s.createElementVNode("h4",c_,s.toDisplayString(g.authorName),1),s.createElementVNode("p",u_,s.toDisplayString(new Date(g.createdAt).toLocaleTimeString()),1)])]),s.createElementVNode("div",f_,[g.resolved?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"rounded-lg p-1.5 text-slate-400 transition-colors hover:bg-green-500/10 hover:text-green-500",title:s.unref(r)("sidebars.comments.resolve"),onClick:x=>n("resolve-comment",g.id)},[s.createVNode(s.unref(nd),{class:"h-4 w-4"})],8,p_)),h(g)?(s.openBlock(),s.createElementBlock("button",{key:1,type:"button",class:"rounded-lg p-1.5 text-slate-400 transition-colors hover:bg-red-500/10 hover:text-red-500",title:s.unref(r)("sidebars.comments.delete"),onClick:x=>v(g.id)},[s.createVNode(s.unref(us),{class:"h-4 w-4"})],8,d_)):s.createCommentVNode("",!0)])]),h(g)?(s.openBlock(),s.createElementBlock("div",m_,s.toDisplayString(s.unref(r)("sidebars.comments.orphaned")),1)):s.createCommentVNode("",!0),g.anchorText?(s.openBlock(),s.createElementBlock("div",{key:1,class:s.normalizeClass(["max-w-full truncate rounded-r-lg border-l-2 py-1 pl-2.5 text-[10px] italic text-slate-500 dark:text-slate-400",h(g)?"border-amber-500/50 bg-amber-50/50 line-through opacity-70 dark:border-amber-500/40 dark:bg-amber-500/5":"border-cyan-500/50 bg-slate-100 dark:border-cyan-500/40 dark:bg-white/5"])},s.toDisplayString(s.unref(r)("sidebars.comments.quote"))+' "'+s.toDisplayString(g.anchorText)+'" ',3)):s.createCommentVNode("",!0),s.createElementVNode("p",h_,s.toDisplayString(g.content),1),g.replies.length>0?(s.openBlock(),s.createElementBlock("div",b_,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(g.replies,x=>(s.openBlock(),s.createElementBlock("div",{key:x.id,class:"space-y-1"},[s.createElementVNode("div",g_,[s.createElementVNode("div",{class:"flex h-4.5 w-4.5 items-center justify-center rounded-full text-[8px] font-bold text-white shadow-sm",style:s.normalizeStyle({backgroundColor:x.authorColor})},s.toDisplayString(d(x.authorName)),5),s.createElementVNode("span",v_,s.toDisplayString(x.authorName),1),s.createElementVNode("span",y_,s.toDisplayString(new Date(x.createdAt).toLocaleTimeString()),1)]),s.createElementVNode("p",x_,s.toDisplayString(x.content),1)]))),128))])):s.createCommentVNode("",!0),g.resolved?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",k_,[l.value===g.id?(s.openBlock(),s.createElementBlock("div",w_,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":x=>o.value[g.id]=x,type:"text",placeholder:s.unref(r)("sidebars.comments.reply"),class:"flex-1 rounded-lg border border-slate-200 bg-white px-2.5 py-1.5 text-xs text-slate-800 focus:border-cyan-500/50 focus:outline-none dark:border-white/10 dark:bg-white/[0.02] dark:text-slate-100 dark:focus:border-cyan-500/30",onKeydown:s.withKeys(x=>m(g.id),["enter"])},null,40,__),[[s.vModelText,o.value[g.id]]]),s.createElementVNode("button",{type:"button",class:"rounded-lg bg-cyan-500 p-1.5 font-bold text-black shadow-cyan hover:bg-cyan-400",onClick:x=>m(g.id)},[s.createVNode(s.unref(Eo),{class:"h-3.5 w-3.5"})],8,S_)])):(s.openBlock(),s.createElementBlock("button",{key:1,type:"button",class:"flex items-center gap-1 text-[10px] font-bold text-cyan-600 transition-all hover:text-cyan-500",onClick:x=>l.value=g.id},[s.createVNode(s.unref(Td),{class:"h-3 w-3"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.comments.replyInThread")),1)],8,C_))])),g.resolved?(s.openBlock(),s.createElementBlock("div",E_,[s.createTextVNode(s.toDisplayString(s.unref(r)("sidebars.comments.resolvedBy").replace("{user}",g.resolvedByName||g.resolvedBy||"You"))+" ",1),g.resolvedAt?(s.openBlock(),s.createElementBlock("span",N_,"at "+s.toDisplayString(new Date(g.resolvedAt).toLocaleTimeString()),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)]))),128)),f.value.length===0?(s.openBlock(),s.createElementBlock("div",A_,[s.createVNode(s.unref(kd),{class:"mx-auto mb-2 h-8 w-8 text-cyan-500 opacity-50"}),s.createElementVNode("p",O_,s.toDisplayString(s.unref(r)("sidebars.comments.noComments").replace("{mode}",c.value)),1)])):s.createCommentVNode("",!0)]),c.value==="active"?(s.openBlock(),s.createElementBlock("div",T_,[s.createElementVNode("form",{class:"space-y-2",onSubmit:s.withModifiers(p,["prevent"])},[s.withDirectives(s.createElementVNode("textarea",{"onUpdate:modelValue":y[2]||(y[2]=g=>a.value=g),rows:"2",placeholder:e.selectedTextSnippet?s.unref(r)("sidebars.comments.commentOnSelection"):s.unref(r)("sidebars.comments.generalComment"),class:"w-full min-h-[60px] resize-none rounded-xl border border-slate-200 bg-white p-2.5 text-xs text-slate-800 transition-all focus:border-cyan-500/50 focus:shadow-cyan focus:outline-none dark:border-white/10 dark:bg-white/[0.02] dark:text-slate-100 dark:focus:border-cyan-500/30"},null,8,M_),[[s.vModelText,a.value]]),s.createElementVNode("div",z_,[s.createElementVNode("span",I_,s.toDisplayString(e.selectedTextSnippet?s.unref(r)("sidebars.comments.anchoredComment"):s.unref(r)("sidebars.comments.general")),1),s.createElementVNode("button",{type:"submit",disabled:!a.value.trim(),class:"flex items-center gap-1 rounded-lg bg-cyan-500 px-3.5 py-2 text-xs font-bold text-black shadow-cyan transition-all hover:bg-cyan-400 disabled:opacity-50"},[s.createVNode(s.unref(Eo),{class:"h-3.5 w-3.5"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.comments.post")),1)],8,D_)])],32)])):s.createCommentVNode("",!0)]))}}),R_={class:"history-sidebar flex h-full w-80 flex-shrink-0 flex-col border-l border-slate-200 bg-white/80 text-slate-800 backdrop-blur-xl transition-all dark:border-white/5 dark:bg-[#0a0f1e]/85 dark:text-slate-100"},L_={class:"border-b border-slate-200 p-4 dark:border-white/5"},B_={class:"flex items-center gap-1.5 font-mono text-xs font-bold uppercase tracking-widest text-slate-500 dark:text-slate-400"},P_={class:"mt-1.5 text-[10px] leading-relaxed text-slate-400 dark:text-slate-500"},V_={class:"flex-1 space-y-3 overflow-y-auto p-4"},F_={key:0,class:"space-y-2 rounded-2xl border border-amber-500/30 bg-amber-500/10 p-3.5 text-xs animate-fadeIn dark:border-amber-500/20"},U_={class:"flex items-start gap-1.5 text-amber-700 dark:text-amber-400"},H_={class:"font-bold"},j_={class:"mt-0.5 text-[10px] leading-relaxed text-amber-600 dark:text-amber-500"},q_={class:"flex justify-end gap-2 pt-1"},$_={class:"space-y-2.5"},W_={class:"mb-1 flex items-center justify-between"},G_={class:"rounded-md bg-slate-200 px-1.5 py-0.5 font-mono text-[9px] font-bold text-slate-500 dark:bg-cyan-500/10 dark:text-cyan-400"},K_={class:"flex items-center gap-0.5 font-mono text-[9px] text-slate-400 dark:text-slate-500"},X_={class:"text-xs font-bold leading-snug text-slate-800 dark:text-slate-200"},J_={class:"flex items-center gap-1.5 text-[10px] text-slate-500"},Z_={class:"font-semibold text-slate-600 dark:text-slate-300"},Q_={class:"flex justify-end gap-2 border-t border-slate-200/50 pt-2 dark:border-white/5"},Y_=["onClick"],eS=["onClick"],tS={key:0,class:"py-6 text-center text-xs text-slate-400 dark:text-slate-500"},iS={class:"border-t border-slate-200 bg-slate-50 p-4 dark:border-white/5 dark:bg-[#0a0f1e]/85"},nS=["placeholder"],rS={class:"flex justify-end gap-2"},aS={type:"submit",class:"rounded-lg bg-cyan-500 px-3.5 py-1.5 text-xs font-bold text-black shadow-cyan hover:bg-cyan-400"},lp=s.defineComponent({__name:"HistorySidebar",props:{snapshots:{},activePreviewIndex:{}},emits:["save-snapshot","restore-snapshot","preview-snapshot"],setup(e,{emit:t}){const i=e,n=t,{t:r}=rt(),a=s.ref(""),o=s.ref(!1);function l(){a.value.trim()&&(n("save-snapshot",a.value.trim()),a.value="",o.value=!1)}const c=s.computed(()=>i.snapshots??[]);return(f,p)=>(s.openBlock(),s.createElementBlock("div",R_,[s.createElementVNode("div",L_,[s.createElementVNode("h3",B_,[s.createVNode(s.unref(Xc),{class:"h-4 w-4 text-cyan-400"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.history.title")),1)]),s.createElementVNode("p",P_,s.toDisplayString(s.unref(r)("sidebars.history.empty")),1)]),s.createElementVNode("div",V_,[e.activePreviewIndex!==null?(s.openBlock(),s.createElementBlock("div",F_,[s.createElementVNode("div",U_,[s.createVNode(s.unref(Id),{class:"mt-0.5 h-4 w-4 flex-shrink-0 text-amber-500"}),s.createElementVNode("div",null,[s.createElementVNode("p",H_,s.toDisplayString(s.unref(r)("sidebars.history.viewingPreview")),1),s.createElementVNode("p",j_,s.toDisplayString(s.unref(r)("sidebars.history.readOnlyPreview").replace("{index}",String(e.activePreviewIndex))),1)])]),s.createElementVNode("div",q_,[s.createElementVNode("button",{type:"button",class:"rounded-lg px-2.5 py-1 text-[10px] font-semibold text-slate-500 hover:bg-white/5 hover:text-slate-700 dark:text-slate-400",onClick:p[0]||(p[0]=m=>n("preview-snapshot",null))},s.toDisplayString(s.unref(r)("sidebars.history.closePreview")),1),s.createElementVNode("button",{type:"button",class:"flex items-center gap-1 rounded-lg bg-cyan-500 px-3 py-1 text-[10px] font-bold text-black shadow-cyan transition-all hover:bg-cyan-400",onClick:p[1]||(p[1]=()=>{n("restore-snapshot",e.activePreviewIndex),n("preview-snapshot",null)})},[s.createVNode(s.unref(pl),{class:"h-3 w-3"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.history.restoreThis")),1)])])])):s.createCommentVNode("",!0),s.createElementVNode("div",$_,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(c.value,m=>(s.openBlock(),s.createElementBlock("div",{key:m.versionIndex,class:s.normalizeClass(["space-y-2.5 rounded-2xl border p-4 transition-all",e.activePreviewIndex===m.versionIndex?"border-cyan-500/40 bg-cyan-500/5 shadow-cyan dark:border-cyan-500/30":"border-slate-200/60 bg-slate-50/60 hover:border-cyan-500/30 dark:border-white/5 dark:bg-[#02040a]/40 dark:hover:border-white/10"])},[s.createElementVNode("div",null,[s.createElementVNode("div",W_,[s.createElementVNode("span",G_,s.toDisplayString(s.unref(r)("sidebars.history.version"))+" #"+s.toDisplayString(m.versionIndex),1),s.createElementVNode("span",K_,[s.createVNode(s.unref($c),{class:"h-2.5 w-2.5"}),s.createTextVNode(" "+s.toDisplayString(new Date(m.timestamp).toLocaleDateString())+" "+s.toDisplayString(new Date(m.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})),1)])]),s.createElementVNode("h4",X_,s.toDisplayString(m.title),1)]),s.createElementVNode("div",J_,[s.createVNode(s.unref(fs),{class:"h-3.5 w-3.5"}),s.createElementVNode("span",null,[s.createTextVNode(s.toDisplayString(s.unref(r)("sidebars.history.modifiedBy"))+" ",1),s.createElementVNode("strong",Z_,s.toDisplayString(m.modifiedBy),1)])]),s.createElementVNode("div",Q_,[e.activePreviewIndex!==m.versionIndex?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"flex items-center gap-1 text-[10px] font-bold text-slate-500 transition-colors hover:text-cyan-600 dark:text-slate-400 dark:hover:text-cyan-400",onClick:d=>n("preview-snapshot",m)},[s.createVNode(s.unref(sd),{class:"h-3 w-3"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.history.preview")),1)],8,Y_)):s.createCommentVNode("",!0),s.createElementVNode("button",{type:"button",class:"flex items-center gap-1 text-[10px] font-bold text-cyan-600 transition-colors hover:text-cyan-500 dark:text-cyan-400 dark:hover:text-cyan-300",onClick:d=>n("restore-snapshot",m.versionIndex)},[s.createVNode(s.unref(pl),{class:"h-3 w-3"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.history.restore")),1)],8,eS)])],2))),128)),c.value.length===0?(s.openBlock(),s.createElementBlock("p",tS,s.toDisplayString(s.unref(r)("sidebars.history.noSnapshots")),1)):s.createCommentVNode("",!0)])]),s.createElementVNode("div",iS,[o.value?(s.openBlock(),s.createElementBlock("form",{key:0,class:"space-y-2 animate-fadeIn",onSubmit:s.withModifiers(l,["prevent"])},[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":p[2]||(p[2]=m=>a.value=m),type:"text",required:"",placeholder:s.unref(r)("sidebars.history.snapshotPlaceholder"),class:"w-full rounded-xl border border-slate-200 bg-white px-2.5 py-1.5 text-xs text-slate-800 transition-all focus:border-cyan-500/50 focus:shadow-cyan focus:outline-none dark:border-white/10 dark:bg-white/[0.02] dark:text-slate-100 dark:focus:border-cyan-500/30"},null,8,nS),[[s.vModelText,a.value]]),s.createElementVNode("div",rS,[s.createElementVNode("button",{type:"button",class:"rounded-lg px-2.5 py-1 text-[10px] text-slate-500 hover:bg-white/5 dark:text-slate-400",onClick:p[3]||(p[3]=m=>o.value=!1)},s.toDisplayString(s.unref(r)("sidebars.history.cancel")),1),s.createElementVNode("button",aS,s.toDisplayString(s.unref(r)("sidebars.history.save")),1)])],32)):(s.openBlock(),s.createElementBlock("button",{key:1,type:"button",class:"flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-slate-300 py-2.5 text-xs font-bold text-slate-500 transition-all hover:border-cyan-500 hover:bg-cyan-500/5 hover:text-cyan-500 dark:border-white/10 dark:text-slate-400 dark:hover:border-cyan-400/50 dark:hover:text-cyan-400",onClick:p[4]||(p[4]=m=>o.value=!0)},[s.createVNode(s.unref(Md),{class:"h-3.5 w-3.5 animate-pulse"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.history.saveNamedSnapshot")),1)]))])]))}}),oS={class:"w-full max-w-md rounded-xl border border-slate-200 bg-white p-6 shadow-2xl dark:border-slate-800 dark:bg-[#0e1525]"},sS={class:"mb-4 flex items-center justify-between"},lS={class:"text-lg font-bold text-slate-800 dark:text-slate-100"},cS={key:0,class:"space-y-4"},uS={class:"flex items-start gap-3"},fS={class:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-cyan-500/10 text-cyan-600 dark:text-cyan-400"},pS={class:"text-[11px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500"},dS={class:"text-sm font-medium text-slate-800 dark:text-slate-200"},mS={class:"flex items-start gap-3"},hS={class:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-blue-500/10 text-blue-600 dark:text-blue-400"},bS={class:"text-[11px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500"},gS={class:"text-sm font-medium text-slate-800 dark:text-slate-200"},vS={class:"text-xs text-slate-500 dark:text-slate-400"},yS={class:"flex items-start gap-3"},xS={class:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-amber-500/10 text-amber-600 dark:text-amber-400"},kS={class:"text-[11px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500"},wS={class:"text-sm font-medium text-slate-800 dark:text-slate-200"},_S={class:"grid grid-cols-2 gap-3"},SS={class:"flex items-start gap-3"},CS={class:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-emerald-500/10 text-emerald-600 dark:text-emerald-400"},ES={class:"text-[11px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500"},NS={class:"text-xs font-medium text-slate-800 dark:text-slate-200"},AS={class:"flex items-start gap-3"},OS={class:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-purple-500/10 text-purple-600 dark:text-purple-400"},TS={class:"text-[11px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500"},MS={class:"text-xs font-medium text-slate-800 dark:text-slate-200"},zS={class:"rounded-lg border border-slate-200 bg-slate-50 p-4 dark:border-slate-700/50 dark:bg-white/5"},IS={class:"mb-2 flex items-center gap-2 text-[11px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500"},DS={class:"grid grid-cols-3 gap-3 text-center"},RS={class:"text-lg font-bold text-slate-800 dark:text-slate-100"},LS={class:"text-[10px] uppercase tracking-wide text-slate-500 dark:text-slate-400"},BS={class:"text-lg font-bold text-slate-800 dark:text-slate-100"},PS={class:"text-[10px] uppercase tracking-wide text-slate-500 dark:text-slate-400"},VS={class:"text-lg font-bold text-slate-800 dark:text-slate-100"},FS={class:"text-[10px] uppercase tracking-wide text-slate-500 dark:text-slate-400"},US={key:1,class:"py-8 text-center text-sm text-slate-500 dark:text-slate-400"},cp=s.defineComponent({__name:"DetailsDialog",props:{isOpen:{type:Boolean},meta:{}},emits:["close"],setup(e,{emit:t}){const{t:i}=rt(),n=t;function r(a){return a?new Date(a).toLocaleString():"-"}return(a,o)=>e.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-slate-900/50 p-4 backdrop-blur-sm",onClick:o[1]||(o[1]=s.withModifiers(l=>n("close"),["self"]))},[s.createElementVNode("div",oS,[s.createElementVNode("div",sS,[s.createElementVNode("h2",lS,s.toDisplayString(s.unref(i)("editor.details.title")),1),s.createElementVNode("button",{type:"button",class:"rounded p-1 text-slate-400 transition hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/5 dark:hover:text-slate-300",onClick:o[0]||(o[0]=l=>n("close"))},[s.createVNode(s.unref(Dt),{class:"h-4 w-4"})])]),e.meta?(s.openBlock(),s.createElementBlock("div",cS,[s.createElementVNode("div",uS,[s.createElementVNode("div",fS,[s.createVNode(s.unref(sn),{class:"h-4 w-4"})]),s.createElementVNode("div",null,[s.createElementVNode("label",pS,s.toDisplayString(s.unref(i)("editor.details.titleLabel")),1),s.createElementVNode("p",dS,s.toDisplayString(e.meta.title),1)])]),s.createElementVNode("div",mS,[s.createElementVNode("div",hS,[s.createVNode(s.unref(fs),{class:"h-4 w-4"})]),s.createElementVNode("div",null,[s.createElementVNode("label",bS,s.toDisplayString(s.unref(i)("editor.details.owner")),1),s.createElementVNode("p",gS,s.toDisplayString(e.meta.owner.name),1),s.createElementVNode("p",vS,s.toDisplayString(e.meta.owner.email),1)])]),s.createElementVNode("div",yS,[s.createElementVNode("div",xS,[s.createVNode(s.unref(cd),{class:"h-4 w-4"})]),s.createElementVNode("div",null,[s.createElementVNode("label",kS,s.toDisplayString(s.unref(i)("editor.details.location")),1),s.createElementVNode("p",wS,s.toDisplayString(e.meta.folderName||s.unref(i)("editor.details.noFolder")),1)])]),s.createElementVNode("div",_S,[s.createElementVNode("div",SS,[s.createElementVNode("div",CS,[s.createVNode(s.unref($c),{class:"h-4 w-4"})]),s.createElementVNode("div",null,[s.createElementVNode("label",ES,s.toDisplayString(s.unref(i)("editor.details.created")),1),s.createElementVNode("p",NS,s.toDisplayString(r(e.meta.createdAt)),1)])]),s.createElementVNode("div",AS,[s.createElementVNode("div",OS,[s.createVNode(s.unref(rd),{class:"h-4 w-4"})]),s.createElementVNode("div",null,[s.createElementVNode("label",TS,s.toDisplayString(s.unref(i)("editor.details.modified")),1),s.createElementVNode("p",MS,s.toDisplayString(r(e.meta.updatedAt)),1)])])]),s.createElementVNode("div",zS,[s.createElementVNode("div",IS,[s.createVNode(s.unref(Kc),{class:"h-3.5 w-3.5"}),s.createTextVNode(" "+s.toDisplayString(s.unref(i)("editor.details.statistics")),1)]),s.createElementVNode("div",DS,[s.createElementVNode("div",null,[s.createElementVNode("p",RS,s.toDisplayString(e.meta.wordCount),1),s.createElementVNode("p",LS,s.toDisplayString(s.unref(i)("editor.details.words")),1)]),s.createElementVNode("div",null,[s.createElementVNode("p",BS,s.toDisplayString(e.meta.charCount),1),s.createElementVNode("p",PS,s.toDisplayString(s.unref(i)("editor.details.characters")),1)]),s.createElementVNode("div",null,[s.createElementVNode("p",VS,s.toDisplayString(e.meta.pageCount),1),s.createElementVNode("p",FS,s.toDisplayString(s.unref(i)("editor.details.pages")),1)])])])])):(s.openBlock(),s.createElementBlock("div",US,s.toDisplayString(s.unref(i)("editor.details.loading")),1))])])):s.createCommentVNode("",!0)}}),HS={class:"w-full max-w-md rounded-xl border border-slate-200 bg-white p-6 shadow-2xl dark:border-slate-800 dark:bg-[#0e1525]"},jS={class:"mb-4 flex items-center justify-between"},qS={class:"flex items-center gap-2"},$S={class:"flex h-8 w-8 items-center justify-center rounded-lg bg-cyan-500/10 text-cyan-600 dark:text-cyan-400"},WS={class:"text-lg font-bold text-slate-800 dark:text-slate-100"},GS={class:"mb-4 rounded-md border border-slate-200 bg-slate-50 p-3 dark:border-slate-700/50 dark:bg-white/5"},KS={class:"mb-1 block text-[11px] font-bold uppercase tracking-wide text-slate-500 dark:text-slate-400"},XS={class:"flex items-center gap-2"},JS=["value"],ZS=["title"],QS={class:"space-y-3"},YS={class:"mb-1 block text-xs font-medium text-slate-600 dark:text-slate-400"},eC=["placeholder"],tC={class:"mb-1 block text-xs font-medium text-slate-600 dark:text-slate-400"},iC={class:"mb-1 block text-xs font-medium text-slate-600 dark:text-slate-400"},nC={class:"mt-5 flex justify-end gap-2"},rC=["href"],up=s.defineComponent({__name:"EmailDialog",props:{isOpen:{type:Boolean},documentTitle:{},shareUrl:{},defaultRecipient:{}},emits:["close","copy-link"],setup(e,{emit:t}){const{t:i}=rt(),n=e,r=t,a=s.ref(n.defaultRecipient||""),o=s.ref(""),l=s.ref(""),c=s.ref(!1),f=s.ref(!1),p=s.computed(()=>i("editor.email.defaultSubject",{title:n.documentTitle})),m=s.computed(()=>i("editor.email.defaultBody",{url:n.shareUrl})),d=s.computed(()=>o.value===p.value),h=s.computed(()=>l.value===m.value);s.watch(()=>n.documentTitle,()=>{o.value=p.value},{immediate:!0}),s.watch(()=>n.shareUrl,()=>{l.value=m.value},{immediate:!0});const v=s.computed(()=>{const g=new URLSearchParams;o.value.trim()&&g.set("subject",o.value.trim()),l.value.trim()&&g.set("body",l.value.trim());const x=g.toString();let k=`mailto:${a.value.trim()}`;return x&&(k+=`?${x}`),k});function b(){r("copy-link")}function y(){a.value=n.defaultRecipient||"",o.value=p.value,l.value=m.value,c.value=!1,f.value=!1}return s.watch(()=>n.isOpen,g=>{g&&y()}),(g,x)=>e.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-slate-900/50 p-4 backdrop-blur-sm",onClick:x[10]||(x[10]=s.withModifiers(k=>r("close"),["self"]))},[s.createElementVNode("div",HS,[s.createElementVNode("div",jS,[s.createElementVNode("div",qS,[s.createElementVNode("div",$S,[s.createVNode(s.unref(yd),{class:"h-4 w-4"})]),s.createElementVNode("h2",WS,s.toDisplayString(s.unref(i)("editor.email.title")),1)]),s.createElementVNode("button",{type:"button",class:"rounded p-1 text-slate-400 transition hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/5 dark:hover:text-slate-300",onClick:x[0]||(x[0]=k=>r("close"))},[s.createVNode(s.unref(Dt),{class:"h-4 w-4"})])]),s.createElementVNode("div",GS,[s.createElementVNode("label",KS,s.toDisplayString(s.unref(i)("editor.email.shareableLink")),1),s.createElementVNode("div",XS,[s.createElementVNode("input",{type:"text",value:e.shareUrl,readonly:"",class:"flex-1 rounded-md border border-slate-300 bg-white px-2 py-1.5 text-xs text-slate-700 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-300"},null,8,JS),s.createElementVNode("button",{type:"button",class:"flex h-7 w-7 items-center justify-center rounded-md border border-slate-300 text-slate-500 transition hover:bg-slate-100 dark:border-slate-600 dark:text-slate-400 dark:hover:bg-slate-700",title:s.unref(i)("editor.email.copyLink"),onClick:b},[s.createVNode(s.unref(Zc),{class:"h-3.5 w-3.5"})],8,ZS)])]),s.createElementVNode("div",QS,[s.createElementVNode("div",null,[s.createElementVNode("label",YS,s.toDisplayString(s.unref(i)("editor.email.to")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":x[1]||(x[1]=k=>a.value=k),type:"email",class:"w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-xs text-slate-700 focus:border-cyan-500 focus:outline-none dark:border-slate-600 dark:bg-slate-900 dark:text-slate-300",placeholder:s.unref(i)("editor.email.toPlaceholder")},null,8,eC),[[s.vModelText,a.value]])]),s.createElementVNode("div",null,[s.createElementVNode("label",tC,s.toDisplayString(s.unref(i)("editor.email.subject")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":x[2]||(x[2]=k=>o.value=k),type:"text",class:s.normalizeClass(["w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-xs focus:border-cyan-500 focus:outline-none dark:border-slate-600 dark:bg-slate-900",d.value&&!c.value?"text-slate-400 dark:text-slate-500":"text-slate-700 dark:text-slate-300"]),onFocus:x[3]||(x[3]=k=>c.value=!0),onBlur:x[4]||(x[4]=k=>c.value=!1)},null,34),[[s.vModelText,o.value]])]),s.createElementVNode("div",null,[s.createElementVNode("label",iC,s.toDisplayString(s.unref(i)("editor.email.body")),1),s.withDirectives(s.createElementVNode("textarea",{"onUpdate:modelValue":x[5]||(x[5]=k=>l.value=k),rows:"4",class:s.normalizeClass(["w-full resize-none rounded-md border border-slate-300 bg-white px-3 py-2 text-xs focus:border-cyan-500 focus:outline-none dark:border-slate-600 dark:bg-slate-900",h.value&&!f.value?"text-slate-400 dark:text-slate-500":"text-slate-700 dark:text-slate-300"]),onFocus:x[6]||(x[6]=k=>f.value=!0),onBlur:x[7]||(x[7]=k=>f.value=!1)},null,34),[[s.vModelText,l.value]])])]),s.createElementVNode("div",nC,[s.createElementVNode("button",{type:"button",class:"rounded-md px-3 py-1.5 text-xs font-semibold text-slate-700 transition hover:bg-slate-100 dark:text-slate-300",onClick:x[8]||(x[8]=k=>r("close"))},s.toDisplayString(s.unref(i)("common.cancel")),1),s.createElementVNode("a",{href:v.value,class:"inline-flex rounded-md bg-cyan-600 px-3 py-1.5 text-xs font-semibold text-white transition hover:bg-cyan-700",onClick:x[9]||(x[9]=k=>r("close"))},s.toDisplayString(s.unref(i)("editor.email.send")),9,rC)])])])):s.createCommentVNode("",!0)}}),aC=["aria-label"],oC={class:"flex items-center gap-1.5"},sC=["placeholder"],lC={class:"w-16 flex-shrink-0 text-center text-[11px] text-slate-400 dark:text-slate-500"},cC=["disabled","title"],uC=["disabled","title"],fC=["title"],pC={class:"mt-2 flex items-center gap-1.5"},dC=["placeholder","onKeydown"],mC=["disabled"],hC=["disabled"],bC=s.defineComponent({__name:"FindReplaceDialog",props:{isOpen:{type:Boolean},editor:{}},emits:["close"],setup(e,{emit:t}){const{t:i}=rt(),n=e,r=t,a=s.ref(null),o=s.ref(""),l=s.ref(""),c=s.ref({query:"",matches:[],activeIndex:0}),f=s.computed(()=>{if(!o.value)return"";const{matches:x,activeIndex:k}=c.value;return x.length===0?i("editor.findReplace.noMatches"):i("editor.findReplace.matchCount",{current:k+1,total:x.length})}),p=()=>{n.editor&&(c.value=_e.getSearchState(n.editor))};s.watch(()=>n.editor,(x,k)=>{k==null||k.off("transaction",p),x==null||x.on("transaction",p)}),s.watch(()=>n.isOpen,async x=>{var k,w;if(n.editor)if(x){const{from:C,to:E}=n.editor.state.selection;C!==E&&(o.value=n.editor.state.doc.textBetween(C,E," ")),m(),n.editor.on("transaction",p),await s.nextTick(),(k=a.value)==null||k.focus(),(w=a.value)==null||w.select()}else g()});function m(){n.editor&&(_e.setSearchQuery(n.editor,o.value),p())}s.watch(o,m);function d(){n.editor&&_e.searchNext(n.editor)}function h(){n.editor&&_e.searchPrev(n.editor)}function v(){n.editor&&_e.replaceCurrent(n.editor,l.value)}function b(){n.editor&&_e.replaceAll(n.editor,l.value)}function y(x){x.key==="Enter"&&x.shiftKey?(x.preventDefault(),h()):x.key==="Enter"?(x.preventDefault(),d()):x.key==="Escape"&&(x.preventDefault(),g())}function g(){var x;n.editor&&_e.clearSearch(n.editor),(x=n.editor)==null||x.off("transaction",p),o.value="",l.value="",c.value={query:"",matches:[],activeIndex:0},r("close")}return s.onUnmounted(()=>{var x;(x=n.editor)==null||x.off("transaction",p)}),(x,k)=>e.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"absolute right-4 top-16 z-40 w-[340px] rounded-xl border border-slate-200 bg-white p-3 shadow-2xl dark:border-slate-700 dark:bg-[#0e1525]",role:"dialog","aria-label":s.unref(i)("editor.findReplace.title")},[s.createElementVNode("div",oC,[s.withDirectives(s.createElementVNode("input",{ref_key:"findInput",ref:a,"onUpdate:modelValue":k[0]||(k[0]=w=>o.value=w),type:"text",placeholder:s.unref(i)("editor.findReplace.findPlaceholder"),class:"min-w-0 flex-1 rounded-lg border border-slate-200 bg-transparent px-2.5 py-1.5 text-sm text-slate-800 focus:border-cyan-500 focus:outline-none dark:border-slate-600 dark:text-slate-100",onKeydown:y},null,40,sC),[[s.vModelText,o.value]]),s.createElementVNode("span",lC,s.toDisplayString(f.value),1),s.createElementVNode("button",{type:"button",class:"flex h-7 w-7 items-center justify-center rounded-md text-slate-500 transition-colors hover:bg-slate-100 disabled:opacity-30 dark:text-slate-400 dark:hover:bg-slate-800",disabled:c.value.matches.length===0,title:s.unref(i)("editor.findReplace.previous"),onClick:h},[s.createVNode(s.unref(td),{class:"h-4 w-4"})],8,cC),s.createElementVNode("button",{type:"button",class:"flex h-7 w-7 items-center justify-center rounded-md text-slate-500 transition-colors hover:bg-slate-100 disabled:opacity-30 dark:text-slate-400 dark:hover:bg-slate-800",disabled:c.value.matches.length===0,title:s.unref(i)("editor.findReplace.next"),onClick:d},[s.createVNode(s.unref(ei),{class:"h-4 w-4"})],8,uC),s.createElementVNode("button",{type:"button",class:"flex h-7 w-7 items-center justify-center rounded-md text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-slate-800",title:s.unref(i)("editor.findReplace.close"),onClick:g},[s.createVNode(s.unref(Dt),{class:"h-4 w-4"})],8,fC)]),s.createElementVNode("div",pC,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":k[1]||(k[1]=w=>l.value=w),type:"text",placeholder:s.unref(i)("editor.findReplace.replacePlaceholder"),class:"min-w-0 flex-1 rounded-lg border border-slate-200 bg-transparent px-2.5 py-1.5 text-sm text-slate-800 focus:border-cyan-500 focus:outline-none dark:border-slate-600 dark:text-slate-100",onKeydown:s.withKeys(s.withModifiers(v,["prevent"]),["enter"])},null,40,dC),[[s.vModelText,l.value]]),s.createElementVNode("button",{type:"button",class:"flex-shrink-0 rounded-lg border border-slate-200 px-2.5 py-1.5 text-xs font-semibold text-slate-600 transition-colors hover:bg-slate-50 disabled:opacity-30 dark:border-slate-600 dark:text-slate-300 dark:hover:bg-white/5",disabled:c.value.matches.length===0,onClick:v},s.toDisplayString(s.unref(i)("editor.findReplace.replace")),9,mC),s.createElementVNode("button",{type:"button",class:"flex-shrink-0 rounded-lg border border-slate-200 px-2.5 py-1.5 text-xs font-semibold text-slate-600 transition-colors hover:bg-slate-50 disabled:opacity-30 dark:border-slate-600 dark:text-slate-300 dark:hover:bg-white/5",disabled:c.value.matches.length===0,onClick:b},s.toDisplayString(s.unref(i)("editor.findReplace.replaceAll")),9,hC)])],8,aC)):s.createCommentVNode("",!0)}}),gC={class:"w-full max-w-md rounded-lg border border-slate-200 bg-white p-6 shadow-xl dark:border-slate-700 dark:bg-slate-800"},vC={class:"mb-4 flex items-center justify-between"},yC={class:"flex items-center gap-2 text-base font-semibold text-slate-900 dark:text-slate-100"},xC={class:"mb-4"},kC={class:"mb-1 block text-xs font-medium text-slate-600 dark:text-slate-400"},wC=["placeholder"],_C={class:"mb-2"},SC={class:"mb-1 block text-xs font-medium text-slate-600 dark:text-slate-400"},CC=["placeholder"],EC={key:0,class:"mt-1 text-[11px] text-red-600 dark:text-red-400"},NC={class:"flex items-center justify-end gap-2 pt-2"},AC=s.defineComponent({__name:"LinkDialog",props:{isOpen:{type:Boolean},initialText:{},initialUrl:{},isEditing:{type:Boolean}},emits:["apply","remove","close"],setup(e,{emit:t}){const{t:i}=rt(),n=e,r=t,a=s.ref(""),o=s.ref(""),l=s.ref("");s.watch(()=>n.isOpen,v=>{v&&(a.value=n.initialText??"",o.value=n.initialUrl??"https://",l.value="")});function c(){const v=o.value.trim();if(!v)return l.value=i("editor.linkDialog.urlRequired"),!1;if(/^(\/|#|mailto:|tel:)/.test(v))return l.value="",!0;try{return new URL(v),l.value="",!0}catch{return l.value=i("editor.linkDialog.urlInvalid"),!1}}function f(v){const b=v.trim();return/^(\/|#|mailto:|tel:)/.test(b)||/^https?:\/\//i.test(b)?b:`https://${b}`}function p(){c()&&r("apply",{text:a.value.trim(),url:f(o.value)})}function m(){r("remove")}function d(){r("close")}function h(v){v.key==="Escape"&&d()}return(v,b)=>e.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:s.withModifiers(d,["self"]),onKeydown:h},[s.createElementVNode("div",gC,[s.createElementVNode("div",vC,[s.createElementVNode("h3",yC,[s.createVNode(s.unref(Zc),{class:"h-5 w-5 text-slate-500 dark:text-slate-400"}),s.createTextVNode(" "+s.toDisplayString(e.isEditing?s.unref(i)("editor.linkDialog.editTitle"):s.unref(i)("editor.linkDialog.insertTitle")),1)]),s.createElementVNode("button",{type:"button",class:"rounded-md p-1 text-sm text-slate-400 transition-all hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-slate-700 dark:hover:text-slate-300",onClick:d},[s.createVNode(s.unref(Dt),{class:"h-4 w-4"})])]),s.createElementVNode("div",xC,[s.createElementVNode("label",kC,s.toDisplayString(s.unref(i)("editor.linkDialog.text")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":b[0]||(b[0]=y=>a.value=y),type:"text",placeholder:s.unref(i)("editor.linkDialog.textPlaceholder"),class:"w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-xs text-slate-700 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-300",onKeydown:s.withKeys(p,["enter"])},null,40,wC),[[s.vModelText,a.value]])]),s.createElementVNode("div",_C,[s.createElementVNode("label",SC,s.toDisplayString(s.unref(i)("editor.linkDialog.url")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":b[1]||(b[1]=y=>o.value=y),type:"text",placeholder:s.unref(i)("editor.linkDialog.urlPlaceholder"),class:"w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-xs text-slate-700 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-300",onKeydown:s.withKeys(p,["enter"])},null,40,CC),[[s.vModelText,o.value]]),l.value?(s.openBlock(),s.createElementBlock("p",EC,s.toDisplayString(l.value),1)):s.createCommentVNode("",!0)]),s.createElementVNode("div",NC,[e.isEditing?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"mr-auto flex items-center gap-1 rounded-md px-3 py-1.5 text-xs font-semibold text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40",onClick:m},[s.createVNode(s.unref(us),{class:"h-3.5 w-3.5"}),s.createTextVNode(" "+s.toDisplayString(s.unref(i)("editor.linkDialog.remove")),1)])):s.createCommentVNode("",!0),s.createElementVNode("button",{type:"button",class:"rounded-md px-3 py-1.5 text-xs font-semibold hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-700",onClick:d},s.toDisplayString(s.unref(i)("editor.linkDialog.cancel")),1),s.createElementVNode("button",{type:"button",class:"rounded-md bg-cyan-600 px-3 py-1.5 text-xs font-semibold text-white transition-all hover:bg-cyan-700",onClick:p},s.toDisplayString(e.isEditing?s.unref(i)("editor.linkDialog.update"):s.unref(i)("editor.linkDialog.insert")),1)])])],32)):s.createCommentVNode("",!0)}});async function Mc(e,t){var i,n;if(typeof document>"u")return!1;try{if(t&&typeof ClipboardItem<"u"&&((i=navigator.clipboard)!=null&&i.write)){const r=new ClipboardItem({"text/plain":new Blob([e],{type:"text/plain"}),"text/html":new Blob([t],{type:"text/html"})});return await navigator.clipboard.write([r]),!0}if((n=navigator.clipboard)!=null&&n.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const r=document.createElement("textarea");r.value=e,r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select();const a=document.execCommand("copy");return r.remove(),a}catch{return!1}}async function OC(){var e;if(typeof navigator>"u"||!((e=navigator.clipboard)!=null&&e.read))return null;try{const t=await navigator.clipboard.read();for(const i of t)if(i.types.includes("text/html"))return await(await i.getType("text/html")).text();for(const i of t)if(i.types.includes("text/plain"))return await(await i.getType("text/plain")).text();return null}catch{return null}}async function wo(){var e;if(typeof navigator>"u"||!((e=navigator.clipboard)!=null&&e.readText))return null;try{return await navigator.clipboard.readText()}catch{return null}}const TC={class:"docs-editor flex h-screen w-full flex-col overflow-hidden bg-slate-50 transition-colors dark:bg-[#02040a]"},MC=["title","aria-label"],zC={class:"docs-editor__body relative flex flex-1 overflow-hidden"},IC=["title"],DC={class:"flex flex-1 flex-col items-center gap-4 w-full relative"},RC=["aria-label"],LC={key:5,class:"fixed inset-0 z-50 flex items-center justify-center bg-slate-900/50 backdrop-blur-sm px-4"},BC={class:"w-full max-w-lg rounded-xl border border-slate-200 bg-white p-6 shadow-2xl dark:border-slate-800 dark:bg-[#0e1525] text-slate-800 dark:text-slate-200"},PC={class:"text-lg font-bold mb-4"},VC={class:"mb-6"},FC={class:"flex justify-between items-center mb-2"},UC={class:"text-sm font-semibold text-slate-500 dark:text-slate-400"},HC={class:"grid grid-cols-2 gap-3"},jC={class:"text-[11px] font-medium block mb-1"},qC=["placeholder"],$C={class:"text-[11px] font-medium block mb-1"},WC=["placeholder"],GC={class:"rounded-lg bg-slate-50 p-3 text-[11px] text-slate-500 dark:bg-white/5 dark:text-slate-400 mb-6"},KC={class:"flex justify-end gap-2"},XC={key:6,class:"fixed inset-0 z-50 flex items-center justify-center bg-slate-900/40 backdrop-blur-sm px-4 select-none"},JC={class:"w-full max-w-sm rounded-3xl border border-slate-100 bg-white p-7 shadow-2xl dark:border-slate-800 dark:bg-[#0e1525] text-slate-800 dark:text-slate-200"},ZC={class:"text-xl font-medium mb-6 text-slate-900 dark:text-white"},QC={class:"mb-6"},YC={class:"text-xs font-semibold text-slate-700 dark:text-slate-300 mb-3"},eE={class:"space-y-4"},tE={class:"text-xs font-medium text-slate-600 dark:text-slate-400 block mb-1.5"},iE={class:"text-xs font-medium text-slate-600 dark:text-slate-400 block mb-1.5"},nE={class:"mb-8"},rE={class:"text-xs font-semibold text-slate-700 dark:text-slate-300 mb-3"},aE={class:"space-y-3"},oE={class:"flex items-center gap-3 cursor-pointer text-xs font-medium text-slate-700 dark:text-slate-300 select-none"},sE={class:"flex items-center gap-3 cursor-pointer text-xs font-medium text-slate-700 dark:text-slate-300 select-none"},lE={class:"flex justify-end items-center gap-3"},cE={key:7,class:"fixed inset-0 z-50 flex items-center justify-center bg-slate-900/40 backdrop-blur-sm px-4 select-none"},uE={class:"w-full max-w-sm rounded-3xl border border-slate-100 bg-white p-7 shadow-2xl dark:border-slate-800 dark:bg-[#0e1525] text-slate-800 dark:text-slate-200"},fE={class:"text-xl font-medium mb-6 text-slate-900 dark:text-white"},pE={class:"mb-6"},dE={class:"text-xs font-semibold text-slate-700 dark:text-slate-300 mb-3"},mE={class:"space-y-3"},hE={class:"flex items-center gap-3 cursor-pointer text-xs font-medium text-slate-700 dark:text-slate-300 select-none"},bE={class:"flex items-center gap-3 cursor-pointer text-xs font-medium text-slate-700 dark:text-slate-300 select-none"},gE={class:"flex items-center gap-3 cursor-pointer text-xs font-medium text-slate-700 dark:text-slate-300 select-none pt-1"},vE={class:"mb-8"},yE={class:"text-xs font-semibold text-slate-700 dark:text-slate-300 mb-3"},xE={class:"space-y-3"},kE={class:"flex items-center gap-3"},wE={class:"flex items-center gap-3 cursor-pointer text-xs font-medium text-slate-700 dark:text-slate-300 select-none"},_E={class:"flex items-center gap-3 cursor-pointer text-xs font-medium text-slate-700 dark:text-slate-300 select-none"},SE={class:"flex justify-end items-center gap-3"},CE={key:8,class:"fixed inset-0 z-50 flex items-center justify-center bg-slate-900/50 backdrop-blur-sm px-4"},EE={class:"w-full max-w-md rounded-xl border border-slate-200 bg-white p-6 shadow-2xl dark:border-slate-800 dark:bg-[#0e1525] text-slate-800 dark:text-slate-200"},NE={class:"text-lg font-bold mb-4"},AE={class:"mb-4"},OE={class:"block text-xs font-semibold text-slate-600 dark:text-slate-400 mb-1.5"},TE=["value"],ME={class:"mb-4"},zE={class:"block text-xs font-semibold text-slate-600 dark:text-slate-400 mb-1.5"},IE={class:"flex gap-2"},DE={class:"mb-6"},RE={class:"block text-xs font-semibold text-slate-600 dark:text-slate-400 mb-1.5"},LE={class:"grid grid-cols-2 gap-3"},BE={class:"text-[11px] text-slate-500 dark:text-slate-400 block mb-1"},PE=["max"],VE={class:"text-[11px] text-slate-500 dark:text-slate-400 block mb-1"},FE=["max"],UE={class:"text-[11px] text-slate-500 dark:text-slate-400 block mb-1"},HE=["max"],jE={class:"text-[11px] text-slate-500 dark:text-slate-400 block mb-1"},qE=["max"],$E={class:"flex justify-end gap-2"},WE=189,Sn=37.795,_o=0,So=5,zc=.1,tn=0,GE=s.defineComponent({__name:"DocsEditor",props:{modelValue:{default:void 0},plugins:{default:()=>[]},editable:{type:Boolean,default:!0},collaboration:{default:void 0},pageSize:{default:"a4"},pageless:{type:Boolean,default:!1},virtualPages:{type:Boolean,default:!1},title:{default:"Untitled Document"},collaborators:{default:()=>[]},starred:{type:Boolean,default:!1},connectionState:{default:"connected"},userName:{default:""},userAvatar:{default:""},locale:{default:void 0},documentMeta:{default:void 0},shareUrl:{default:""},onImageUpload:{type:Function,default:void 0},citation:{default:void 0},aiStream:{type:Function,default:void 0},aiDraft:{type:Function,default:void 0},debug:{type:Boolean,default:!1},comments:{default:()=>[]},selectedTextSnippet:{default:""},selectedTextIndex:{default:void 0},snapshots:{default:()=>[]},activePreviewIndex:{default:null},orientation:{default:"portrait"},margins:{default:()=>({top:94,bottom:94,left:94,right:94})},headerMarginCm:{default:.5},footerMarginCm:{default:.5}},emits:["update:modelValue","update:title","update:pageSize","update:orientation","update:margins","update:header-footer-margins","update:pageless","update:pageCount","update:locale","citation-sources-change","update:citation-style","toggle-star","back","share","menu-click","export","ready","add-comment","add-reply","resolve-comment","delete-comment","save-snapshot","restore-snapshot","preview-snapshot"],setup(e,{emit:t}){var el,tl,il,nl,rl;const i=e,n=t,{locale:r,setLocale:a,t:o}=Fc(i.locale);s.watch(()=>i.locale,N=>{N&&N!==r.value&&a(N)}),s.watch(r,N=>{n("update:locale",N)});const l=s.ref({top:((el=i.margins)==null?void 0:el.top)??94,bottom:((tl=i.margins)==null?void 0:tl.bottom)??94,left:((il=i.margins)==null?void 0:il.left)??94,right:((nl=i.margins)==null?void 0:nl.right)??94});function c(N,A=.5){const z=typeof N=="number"?N:Number(N);if(!Number.isFinite(z))return A;const le=Math.min(So,Math.max(_o,z));return Math.round(le*10)/10}const f=s.ref(i.orientation??"portrait"),p=s.ref(i.pageSize??"a4"),m=s.ref(i.pageless??!1);s.watch(()=>i.orientation,N=>{N!==void 0&&(f.value=N)}),s.watch(()=>i.margins,N=>{N!==void 0&&(l.value={...N})}),s.watch(()=>i.headerMarginCm,N=>{typeof N=="number"&&Number.isFinite(N)&&($t.value=c(N))}),s.watch(()=>i.footerMarginCm,N=>{typeof N=="number"&&Number.isFinite(N)&&(Wt.value=c(N))});const d=s.computed(()=>{const N=Cn.getPageSize(p.value)??Cn.PAGE_SIZES[0];let A=N.pageWidth,z=N.pageHeight;return f.value==="landscape"&&([A,z]=[z,A]),{pageHeight:z,pageWidth:A,margins:{...l.value}}}),h=s.computed(()=>`${d.value.pageWidth}px`),{isDark:v}=Ba(),b=s.computed(()=>i.virtualPages===!0),y=s.computed(()=>({enabled:!m.value&&!b.value,pageHeight:d.value.pageHeight,pageWidth:d.value.pageWidth,marginTop:d.value.margins.top,marginBottom:d.value.margins.bottom,marginLeft:d.value.margins.left,marginRight:d.value.margins.right,contentMarginTop:0,contentMarginBottom:0,pageGap:40,pageBreakBackground:v.value?"#02040a":"#f1f5f9",headerLeft:"",headerRight:"",footerLeft:"",footerRight:"",onHeaderClick:N=>{gr(N==null?void 0:N.event)},onFooterClick:N=>{N!=null&&N.event&&N.event.detail!==2||vr()}})),x=(N=>{const A=N;return A&&typeof A=="object"&&A.type==="tabbed-doc"&&Array.isArray(A.tabs)?A:{type:"tabbed-doc",activeTabId:"tab-1",tabs:[{id:"tab-1",label:"Tab 1",content:N||{type:"doc",content:[{type:"paragraph"}]}}]}})(i.modelValue),k=s.ref(x.headerLeft||""),w=s.ref(x.headerRight||""),C=s.ref(x.footerLeft||""),E=s.ref(x.footerRight||""),B=s.ref(x.tabs.map(N=>({id:N.id,label:N.label,active:N.id===x.activeTabId}))),_=s.ref({});x.tabs.forEach(N=>{_.value[N.id]=N.content});const S=s.ref(x.activeTabId),T=s.computed(()=>_.value[S.value]),D=s.ref(!1),H=s.ref(null),V=s.ref(null),M=s.ref(localStorage.getItem("docflow:view:showRuler")!=="false"),$=s.ref(!1);s.watch(M,N=>{localStorage.setItem("docflow:view:showRuler",N?"true":"false")});const P=s.ref(0),W=s.ref(0),L=s.ref("saved"),Q=s.ref(Date.now()),j=s.ref(null),O=s.ref(new Set);let R=null;const U=s.ref(!1);function oe(){if(!G.value||!we.value)return;const N=G.value.state.doc;if(i.collaboration&&!U.value&&N.content.size<=2)return;U.value=!0;const A=new Set;N.descendants(z=>{for(const le of z.marks)le.type.name==="comment"&&le.attrs.threadId&&A.add(le.attrs.threadId);return!0}),O.value=A}function ie(){R&&clearTimeout(R),R=setTimeout(oe,200)}const ee=s.computed(()=>{if(!U.value)return[];const N=O.value;return(i.comments??[]).filter(A=>A.anchorIndex!=null&&!N.has(A.id)).map(A=>A.id)});s.onUnmounted(()=>{R&&clearTimeout(R)});const te=s.computed(()=>{const N=[];for(const A of i.plugins)for(const z of A.slashCommands||[])N.push({name:z.name,command:z.command});return N}),X=()=>{const N={type:"tabbed-doc",activeTabId:S.value,tabs:B.value.map(A=>({id:A.id,label:A.label,content:_.value[A.id]})),headerLeft:k.value,headerRight:w.value,footerLeft:C.value,footerRight:E.value};n("update:modelValue",N),L.value="saving",j.value&&clearTimeout(j.value),j.value=setTimeout(()=>{L.value="saved",Q.value=Date.now()},800)},F=s.ref((()=>{var A;const N=(A=i.citation)==null?void 0:A.sources;return Array.isArray(N)?[...N]:typeof N=="function"?[...N()]:[]})()),q=s.ref(((rl=i.citation)==null?void 0:rl.style)||"chicago-notes-bibliography");let ne=null;const se=s.ref(!1),Se=N=>{ne==null||ne(N),ne=null,se.value=!1},Ae=()=>new Promise(N=>{Se(null),ne=N,se.value=!0,V.value="references"}),fe=s.computed(()=>{const N=i.citation;if(N)return{...N,sources:()=>F.value,onSourceRequest:N.onSourceRequest??Ae}}),{editorRef:ke,editor:G,pluginActions:yt,isReady:we,docsEditor:At}=Ic({content:T,plugins:i.plugins,editable:i.editable,collaboration:i.collaboration,onImageUpload:i.onImageUpload,citation:fe.value,aiStream:i.aiStream,aiDraft:i.aiDraft,debug:i.debug,getPageMap:()=>new Map,paginationOptions:y.value,onUpdate:N=>{_.value[S.value]=N,X()}}),K=()=>{var N,A,z;return((z=(A=(N=G.value)==null?void 0:N.storage)==null?void 0:A.citation)==null?void 0:z.engine)??null},I=()=>{var N;(N=K())==null||N.updateSources(F.value),n("citation-sources-change",F.value)},J=N=>{F.value=[...F.value,N],I()},ze=N=>{F.value=F.value.map(A=>A.id===N.id?N:A),I()},Ue=N=>{F.value=F.value.filter(A=>A.id!==N),I()},qe=N=>{var A;q.value=N,(A=K())==null||A.setStyle(N),n("update:citation-style",N)},Ht=N=>{var A,z;ne?(Se(N),V.value=null):(z=(A=yt.value).insertCitation)==null||z.call(A,{sourceId:N})};s.watch(V,(N,A)=>{A==="references"&&N!=="references"&&Se(null)});const pt=s.ref(!1),dt=s.ref(""),Ot=s.computed(()=>{var N,A;return!!((N=i.citation)!=null&&N.onImportDoi||(A=i.citation)!=null&&A.onImportBibliography)}),ri=async N=>{const A=i.citation;if(!(!(A!=null&&A.onImportDoi)||pt.value)){pt.value=!0,dt.value="";try{const z=await A.onImportDoi(N);if(!z){dt.value=o("sidebars.references.import.doiFailed");return}const le=F.value.some(ue=>ue.id===z.id);F.value=le?F.value.map(ue=>ue.id===z.id?z:ue):[...F.value,z],I(),dt.value=o("sidebars.references.import.doiSuccess")}catch{dt.value=o("sidebars.references.import.doiFailed")}finally{pt.value=!1}}},Xe=async N=>{const A=i.citation;if(!(!(A!=null&&A.onImportBibliography)||pt.value)){pt.value=!0,dt.value="";try{const{imported:z,failed:le}=await A.onImportBibliography(N);if(z.length>0){const ue=new Map(F.value.map(xe=>[xe.id,xe]));for(const xe of z)ue.set(xe.id,xe);F.value=[...ue.values()],I()}dt.value=le>0?o("sidebars.references.import.partial").replace("{ok}",String(z.length)).replace("{failed}",String(le)):o("sidebars.references.import.batchSuccess").replace("{count}",String(z.length))}catch{dt.value=o("sidebars.references.import.failed")}finally{pt.value=!1}}},Si=()=>{var A;const N=((A=G.value)==null?void 0:A.getText())??"";W.value=N.length,P.value=N.trim()?N.trim().split(/\s+/).length:0},dn=()=>{if(!G.value)return null;const{from:N,to:A,head:z}=G.value.state.selection;if(N===A)return null;const le=G.value.view.coordsAtPos(z);if(!le)return null;const ue=12,xe=180,Oe=le.top-48,Ee=(le.left+le.right)/2;if(typeof window>"u")return{top:Math.max(ue,Oe),left:Ee};const me=Math.min(xe,Math.max(0,window.innerWidth/2-ue)),pe=ue+me,ce=window.innerWidth-ue-me,be=Math.max(ue,window.innerHeight-48);return{top:Math.min(be,Math.max(ue,Oe)),left:Math.min(ce,Math.max(pe,Ee))}},mn=()=>{if(!G.value){D.value=!1,H.value=null;return}const{from:N,to:A}=G.value.state.selection;D.value=N!==A,H.value=N!==A?dn():null},Ci=s.ref(null);let ai=null;const Wa=()=>{G.value&&(ai&&clearTimeout(ai),ai=setTimeout(()=>{G.value&&G.value.view.dispatch(G.value.state.tr)},150))},jt=s.ref(1),mt=s.ref(1),Tt=s.computed(()=>{const N=d.value;return{pageSize:{id:p.value,name:p.value.toUpperCase(),pageWidth:N.pageWidth,pageHeight:N.pageHeight},margins:{top:N.margins.top,bottom:N.margins.bottom,left:N.margins.left,right:N.margins.right},pageGap:40,headerLeft:k.value,headerRight:w.value,footerLeft:C.value,footerRight:E.value}}),{data:hn,totalPages:Mt,isReady:Ei,refreshData:Ga}=Dp({editorRef:s.computed(()=>G.value),scrollRef:Ci,config:Tt.value,bufferPages:2});s.watch([Mt,Ei],()=>{b.value&&Ei.value&&(jt.value=Mt.value)}),s.watch(b,N=>{N&&Ga()});const qt=()=>{if(!G.value||!we.value){jt.value=1,mt.value=1;return}const N=G.value.view.dom,A=N.querySelector("[data-rm-pagination]");A?jt.value=A.children.length||1:jt.value=1;try{const{selection:z}=G.value.state,le=G.value.view.coordsAtPos(z.head);if(le&&A){const ue=Array.from(A.querySelectorAll(".rm-page-break")),xe=N.getBoundingClientRect(),Oe=le.top-xe.top+N.scrollTop;let Ee=1,me=!1;for(let pe=0;pe<ue.length;pe++){const ce=ue[pe].querySelector(".breaker");if(ce instanceof HTMLElement&&Oe<ce.offsetTop){mt.value=Ee,me=!0;break}Ee++}me||(mt.value=Ee)}else mt.value=1}catch{mt.value=1}};s.watch(d,N=>{G.value&&(G.value.commands.updatePageHeight(N.pageHeight),G.value.commands.updatePageWidth(N.pageWidth),G.value.commands.updateMargins({top:N.margins.top,bottom:N.margins.bottom,left:N.margins.left,right:N.margins.right}),qt())});const oi=N=>{N!==m.value&&(m.value=N,n("update:pageless",N),G.value&&(N?G.value.commands.disablePagination():G.value.commands.enablePagination(),setTimeout(()=>{qt(),Oi()},60)))};s.watch(()=>i.pageless,N=>oi(N??!1));const zt=s.ref(!1),si=s.ref(!1),st=s.ref(""),lt=s.ref(""),li=s.ref(""),Yn=s.ref(""),$t=s.ref(c(i.headerMarginCm)),Wt=s.ref(c(i.footerMarginCm)),er=s.ref(!1),bn=s.ref($t.value),gn=s.ref(Wt.value),tr=s.ref(!1),ir=s.ref(!1),nr=s.ref(!1),rr=s.ref("header"),ar=s.ref(!0),or=s.ref("startAt"),sr=s.ref(1),Gi=s.ref("header"),lr=s.ref(!0),Ki=s.ref("startAt"),cr=s.ref(1),Ka=N=>{if(!ar.value&&N===0)return"";let A=N+1;return or.value==="startAt"&&(A=N+sr.value),String(A)},It=()=>{if(!G.value||!we.value)return;const N=String(jt.value),A=G.value.view.dom,z=k.value.replace(/{total}/g,N),le=w.value.replace(/{total}/g,N),ue=C.value.replace(/{total}/g,N),xe=E.value.replace(/{total}/g,N);G.value.commands.updateHeaderContent(z,le),G.value.commands.updateFooterContent(ue,xe);const Oe=`${Math.max(0,$t.value)*Sn}px`,Ee=`${Math.max(0,Wt.value)*Sn}px`;A.style.setProperty("--rm-header-margin-top",Oe),A.style.setProperty("--rm-footer-margin-bottom",Ee),G.value.view.dispatch(G.value.state.tr),setTimeout(()=>{requestAnimationFrame(()=>{if(!G.value||G.value.view.dom!==A)return;const me=(be,Ne)=>{let Ce=z,Me=le;return Ne&&zt.value?(Ce=st.value.replace(/{total}/g,N),Me=lt.value.replace(/{total}/g,N)):si.value&&be%2===0&&(Ce=li.value.replace(/{total}/g,N),Me=Yn.value.replace(/{total}/g,N)),{left:Ce.replace(/{page}/g,Ka(be-1)),right:Me.replace(/{page}/g,Ka(be-1))}},pe=(be,Ne,Ce)=>{const Me=me(Ne,Ce),Te=be.querySelector(".rm-page-header-left"),Le=be.querySelector(".rm-page-header-right");Te&&(Te.innerHTML=Me.left),Le&&(Le.innerHTML=Me.right)},ce=A.querySelector(".rm-first-page-header");ce&&pe(ce,1,!0),Array.from(A.querySelectorAll(".rm-page-break .rm-page-header")).forEach((be,Ne)=>{pe(be,Ne+2,!1)}),Array.from(A.querySelectorAll(".rm-page-break .rm-page-footer")).forEach((be,Ne)=>{const Ce=Ne+1,Me=Ka(Ce-1),Te=be.querySelector(".rm-page-footer-left"),Le=be.querySelector(".rm-page-footer-right");Te&&(Te.innerHTML=ue.replace(/{page}/g,Me)),Le&&(Le.innerHTML=xe.replace(/{page}/g,Me))})})},50)};s.watch(zt,()=>{It()}),s.watch([si,$t,Wt,rr,ar,or,sr],()=>{It()}),s.watch(jt,N=>{It(),n("update:pageCount",N)}),s.watch(v,N=>{G.value&&(G.value.commands.updatePageBreakBackground(N?"#02040a":"#f1f5f9"),G.value.view.dispatch(G.value.state.tr))}),s.watch(y,N=>{if(!G.value||!we.value)return;const A=G.value.storage.PaginationPlus;!A||!(A.pageHeight!==N.pageHeight||A.pageWidth!==N.pageWidth||A.marginTop!==N.marginTop||A.marginBottom!==N.marginBottom||A.marginLeft!==N.marginLeft||A.marginRight!==N.marginRight||A.pageGap!==N.pageGap||A.contentMarginTop!==N.contentMarginTop||A.contentMarginBottom!==N.contentMarginBottom||A.pageBreakBackground!==N.pageBreakBackground||A.enabled!==N.enabled)||(A.pageHeight=N.pageHeight,A.pageWidth=N.pageWidth,A.marginTop=N.marginTop,A.marginBottom=N.marginBottom,A.marginLeft=N.marginLeft,A.marginRight=N.marginRight,A.pageGap=N.pageGap,A.contentMarginTop=N.contentMarginTop,A.contentMarginBottom=N.contentMarginBottom,A.pageBreakBackground=N.pageBreakBackground,A.enabled=N.enabled,G.value.view.dispatch(G.value.state.tr))},{deep:!0}),s.watch(we,N=>{var A,z,le,ue,xe,Oe,Ee,me;N&&G.value&&(!k.value&&!w.value&&!C.value&&!E.value&&(k.value=((z=(A=G.value.storage.PaginationPlus)==null?void 0:A.appliedConfig)==null?void 0:z.headerLeft)||"",w.value=((ue=(le=G.value.storage.PaginationPlus)==null?void 0:le.appliedConfig)==null?void 0:ue.headerRight)||"",C.value=((Oe=(xe=G.value.storage.PaginationPlus)==null?void 0:xe.appliedConfig)==null?void 0:Oe.footerLeft)||"",E.value=((me=(Ee=G.value.storage.PaginationPlus)==null?void 0:Ee.appliedConfig)==null?void 0:me.footerRight)||""),It(),At.value&&n("ready",At.value),G.value.on("selectionUpdate",()=>{mn(),qt()}),G.value.on("transaction",()=>{qt(),Si(),ie()}),mn(),Si(),qt(),ie(),setTimeout(()=>{var ce;return(ce=G.value)==null?void 0:ce.commands.focus("start")},50),[100,300,600,1200,2500].forEach(ce=>{setTimeout(()=>{G.value&&G.value.view.dispatch(G.value.state.tr)},ce)}),G.value.view.dom.addEventListener("keydown",ce=>{(ce.metaKey||ce.ctrlKey)&&ce.key.toLowerCase()==="k"&&(ce.preventDefault(),Ws())}),G.value.view.dom.addEventListener("click",ce=>{const be=ce.target;if(!be||be.closest('.rm-google-docs-header-bar, .rm-options-dropdown, [contenteditable="true"]'))return;if(be.closest(".rm-page-header, .rm-first-page-header")){gr(ce);return}const Ce=be.closest(".rm-with-pagination, .rm-page-break, .page, .docs-editor-page");if(Ce){const Me=Ce.getBoundingClientRect(),Te=ce.clientY-Me.top,Le=$t.value*37.795;if(Te>=0&&Te<=Math.max(Le,40)+15){let Je=null;Ce.classList.contains("rm-page-break")&&(Je=Ce.querySelector(".rm-page-header")),Je||(Je=document.querySelector(".rm-page-header, .rm-first-page-header")),Je&&gr(ce)}}}),G.value.view.dom.addEventListener("dblclick",ce=>{const be=ce.target;if(!be)return;if(be.closest(".rm-page-footer")){vr();return}const Ce=be.closest(".rm-with-pagination, .rm-page-break, .page, .docs-editor-page");if(Ce){const Te=Ce.getBoundingClientRect().bottom-ce.clientY,Le=Wt.value*37.795;Te>=0&&Te<=Math.max(Le,40)+15&&vr()}}))}),s.watch(()=>i.collaboration,()=>{},{deep:!0}),s.onUnmounted(()=>{ui(!1),j.value&&clearTimeout(j.value),ai&&clearTimeout(ai)});const ur=s.ref(!1),vn=s.ref(""),yn=s.ref(""),fr=s.ref(!1),Xa=s.ref(!1),Ja=s.ref(!1),pr=s.ref(!1),xn=s.ref(!1),dr=s.ref(""),Za=s.ref(""),mr=s.ref(!1);function Ws(){if(!G.value)return;const{state:N}=G.value,{from:A,to:z,empty:le}=N.selection,ue=G.value.getAttributes("link");ue.href?(mr.value=!0,Za.value=ue.href,le?dr.value="":dr.value=N.doc.textBetween(A,z," ")):(mr.value=!1,Za.value="https://",dr.value=le?"":N.doc.textBetween(A,z," ")),xn.value=!0}function fp(N){if(!G.value)return;const{state:A}=G.value,{from:z,to:le,empty:ue}=A.selection,xe=N.text.trim(),Oe=G.value.chain().focus();mr.value||G.value.isActive("link")?(Oe.setLink({href:N.url,target:"_blank"}).run(),xe&&!ue&&Oe.insertContentAt({from:z,to:le},xe).run()):xe?Oe.insertContentAt({from:z,to:le},{type:"text",text:xe,marks:[{type:"link",attrs:{href:N.url,target:"_blank"}}]}).run():ue?Oe.insertContent({type:"text",text:N.url,marks:[{type:"link",attrs:{href:N.url,target:"_blank"}}]}).run():Oe.setLink({href:N.url,target:"_blank"}).run(),xn.value=!1}function pp(){if(!G.value)return;G.value.chain().focus().unsetLink().run(),xn.value=!1}const hr=s.ref(p.value),Ni=s.ref(f.value),$e=s.ref({top:ci(l.value.top),bottom:ci(l.value.bottom),left:ci(l.value.left),right:ci(l.value.right)}),kn=Number((WE/Sn).toFixed(1));function ci(N){return Math.round(N/Sn*10)/10}function br(N){return Math.round(N*Sn)}const dp=()=>{hr.value=p.value,Ni.value=f.value,$e.value={top:ci(l.value.top),bottom:ci(l.value.bottom),left:ci(l.value.left),right:ci(l.value.right)},fr.value=!0},mp=()=>{const N=A=>{const z=typeof A=="number"?A:Number(A);return Number.isFinite(z)?Math.min(kn,Math.max(tn,z)):tn};p.value=hr.value,f.value=Ni.value,$e.value={top:N($e.value.top),bottom:N($e.value.bottom),left:N($e.value.left),right:N($e.value.right)},l.value={top:br($e.value.top),bottom:br($e.value.bottom),left:br($e.value.left),right:br($e.value.right)},n("update:pageSize",p.value),n("update:orientation",Ni.value),n("update:margins",{...l.value}),fr.value=!1},Qa=s.ref(!1),Ai={value:null},hp=()=>{bn.value=$t.value,gn.value=Wt.value,tr.value=zt.value,ir.value=si.value,er.value=!0},bp=()=>{$t.value=c(bn.value),Wt.value=c(gn.value),bn.value=$t.value,gn.value=Wt.value,zt.value=tr.value,si.value=ir.value,er.value=!1,It(),n("update:header-footer-margins",{headerMarginCm:$t.value,footerMarginCm:Wt.value}),X()},gp=()=>{Gi.value=rr.value,lr.value=ar.value,Ki.value=or.value,cr.value=sr.value,nr.value=!0},vp=()=>{rr.value=Gi.value,ar.value=lr.value,or.value=Ki.value,sr.value=cr.value,nr.value=!1;const N="{page}";rr.value==="footer"?(w.value.includes(N)&&(w.value=w.value.replace(/{page}/g,"").trim()),E.value=N):(E.value.includes(N)&&(E.value=E.value.replace(/{page}/g,"").trim()),w.value=N),It(),X()},yp=()=>{k.value="",w.value="",It(),X(),Qa.value=!1},xp=N=>{const A=N===1,z=N%2===0;return zt.value&&A?st.value:si.value&&z?li.value:k.value},ui=(N=!0)=>{var le;const A=Ai.value;if(!A)return;const z=A.input.innerHTML.trim();document.removeEventListener("mousedown",A.onOutsideMouseDown),window.removeEventListener("resize",A.onResize),window.removeEventListener("scroll",A.onWindowScroll),(le=Ci.value)==null||le.removeEventListener("scroll",A.onScroll),A.overlay.remove(),A.generatedContent&&(A.generatedContent.style.visibility=""),A.targetHeader.classList.remove("rm-header-active"),Ai.value=null,Qa.value=!1,N&&(zt.value&&A.isFirstPage?st.value=z:si.value&&A.pageIndex%2===0?li.value=z:k.value=z,It(),X())},Gs=N=>{if(!N.targetHeader.parentNode||!G.value)return;const A=G.value.view.dom,z=N.targetHeader.getBoundingClientRect(),le=A.getBoundingClientRect(),ue=getComputedStyle(A),xe=parseFloat(ue.getPropertyValue("--rm-margin-left"))||0,Oe=parseFloat(ue.getPropertyValue("--rm-margin-right"))||0,Ee=N.targetHeader.querySelector(".rm-page-header-content"),me=(Ee==null?void 0:Ee.getBoundingClientRect())??z,pe=N.isFirstPage?z.left:z.left+xe,ce=N.isFirstPage?z.right:z.right-Oe,be=Math.max(0,pe-le.left),Ne=Math.max(0,le.right-ce);N.overlay.style.left=`${pe}px`,N.overlay.style.top=`${me.top}px`,N.overlay.style.width=`${Math.max(ce-pe,1)}px`,N.overlay.style.height=`${Math.max(me.height,24)}px`,N.activeBar.style.setProperty("--rm-header-bar-left",`${-be}px`),N.activeBar.style.setProperty("--rm-header-bar-width",`${le.width}px`),N.activeBar.style.setProperty("--rm-header-bar-padding-left",`${be}px`),N.activeBar.style.setProperty("--rm-header-bar-padding-right",`${Ne}px`)},gr=N=>{var al,ol;const A=Ai.value;if(A){const ge=N==null?void 0:N.target;if(!ge||ge instanceof Node&&A.targetHeader.contains(ge))return;ui(!1)}let z=null;if(N){const ge=N.target;z=ge==null?void 0:ge.closest(".rm-page-header, .rm-first-page-header")}if(z||(z=(al=G.value)==null?void 0:al.view.dom.querySelector(".rm-first-page-header, .rm-page-header")),!z||!G.value)return;const le=G.value.view.dom,ue=z.classList.contains("rm-first-page-header"),xe=Array.from(le.querySelectorAll(".rm-page-break .rm-page-header")),Oe=ue?1:xe.indexOf(z)+2;if(!ue&&Oe<2)return;const Ee=z.querySelector(".rm-page-header-content");Ee&&(Ee.style.visibility="hidden");const me=document.createElement("div");me.className="rm-header-edit-input",me.contentEditable="true",me.setAttribute("role","textbox"),me.setAttribute("aria-label",o("editor.headerFooter.header")||"Header"),me.dataset.placeholder=o("editor.headerFooter.headerPlaceholder")||"Header",me.innerHTML=xp(Oe);const pe=document.createElement("div");pe.className="rm-header-edit-overlay",pe.appendChild(me);const ce=document.createElement("div");ce.className="rm-google-docs-header-bar",ce.innerHTML=`
15056
+ `," ")}}async function w(){await s.nextTick(),m.value&&(m.value.scrollTop=m.value.scrollHeight)}async function C(P,W){const L=h.value;if(!L||c.value)return;d==null||d.abort(),d=new AbortController,c.value=!0,o.value.push({role:"user",text:W}),o.value.push({role:"assistant",text:"",streaming:!0});const Q=o.value.length-1;await w();try{for await(const j of L(P,d.signal))o.value[Q].text+=j,w();o.value[Q].text||(o.value[Q].text=r("sidebars.ai.emptyResponse"),o.value[Q].error=!0)}catch(j){d.signal.aborted||(o.value[Q].text=`${r("sidebars.ai.aiError")}: ${j instanceof Error?j.message:String(j)}`,o.value[Q].error=!0)}finally{o.value[Q].streaming=!1,c.value=!1,d=null,w()}}function E(){const P=l.value.trim();if(!P||c.value)return;if(l.value="",b.value){B({prompt:P,context:k()},P);return}const W=x.value;C({action:"chat",prompt:P,...W?{selection:W.text}:{},context:k()},P)}async function B(P,W){const L=v.value;if(!L||c.value)return;d==null||d.abort(),d=new AbortController,c.value=!0,o.value.push({role:"user",text:W}),o.value.push({role:"assistant",text:"",streaming:!0});const Q=o.value.length-1;await w();try{for await(const j of L(P,d.signal))j.type==="delta"?(o.value[Q].text+=j.text,w()):j.type==="done"?o.value[Q].citations=j.citations:j.type==="error"&&(o.value[Q].text=`${r("sidebars.ai.aiError")}: ${j.message}`,o.value[Q].error=!0,o.value[Q].citations=void 0);!o.value[Q].text&&!o.value[Q].error&&(o.value[Q].text=r("sidebars.ai.emptyResponse"),o.value[Q].error=!0)}catch(j){d.signal.aborted||(o.value[Q].text=`${r("sidebars.ai.aiError")}: ${j instanceof Error?j.message:String(j)}`,o.value[Q].error=!0,o.value[Q].citations=void 0)}finally{o.value[Q].streaming=!1,c.value=!1,d=null,w()}}function _(){b.value=!b.value,s.nextTick(()=>{const P=document.querySelector(".ai-sidebar textarea");P==null||P.focus()})}function S(P){if(c.value||!P.action)return;const W=x.value;P.needsSelection&&!W||C({action:P.action,...W?{selection:W.text}:{},...P.prompt?{prompt:P.prompt}:{},context:k()},P.prompt??P.label)}function T(){var P,W,L;x.value&&((L=(W=(P=a())==null?void 0:P.commands)==null?void 0:W.aiTransform)==null||L.call(W,{action:"rewrite"}))}const D=s.computed(()=>[{label:r("sidebars.ai.summarize"),icon:No,color:"text-cyan-500",action:"summarize",needsSelection:!0},{label:r("sidebars.ai.fixGrammar"),icon:Qp,color:"text-emerald-500",action:"grammar",needsSelection:!0},{label:r("sidebars.ai.continue"),icon:Ud,color:"text-amber-500",action:"generate",prompt:"Continue writing naturally from where the text ends, matching the existing style."},{label:r("sidebars.ai.toSpanish"),icon:Gc,color:"text-cyan-500",action:"translate",prompt:"translate to Spanish",needsSelection:!0},{label:r("sidebars.ai.improveSelection"),icon:Ed,color:"text-violet-500",improve:!0,needsSelection:!0},{label:r("sidebars.ai.draft"),icon:Kr,color:"text-cyan-500",draft:!0,disabled:!v.value}]);function H(P,W){P.text&&(navigator.clipboard.writeText(P.text),f.value=W,setTimeout(()=>f.value=null,2e3))}function V(P){p.value=P,setTimeout(()=>{p.value===P&&(p.value=null)},2e3)}function M(P,W){const L=a();if(!P.text||!L)return;const{state:Q,view:j}=L,{from:O,to:R}=Q.selection;if(!P.citations||P.citations.length===0){j.dispatch(Q.tr.insertText(P.text,O,R)),j.focus(),V(W);return}const U=fn(L);if(!U){j.dispatch(Q.tr.insertText(Nw(P.text),O,R)),j.focus(),V(W);return}const oe=new Map(P.citations.map(F=>[F.ref,F])),ie=Aw(P.text,oe,U),ee=Q.schema,te=ie.map(F=>typeof F=="string"?ee.text(F):ee.nodeFromJSON(F)).filter(F=>!!F),X=new ae(Z.from(te),0,0);j.dispatch(Q.tr.replace(O,R,X)),j.focus(),V(W)}function $(){d==null||d.abort(),c.value=!1,n("close")}return s.onUnmounted(()=>{var P;d==null||d.abort(),(P=a())==null||P.off("transaction",g)}),(P,W)=>(s.openBlock(),s.createElementBlock("div",Ow,[s.createElementVNode("div",Tw,[s.createElementVNode("div",null,[s.createElementVNode("h3",Mw,[s.createVNode(s.unref(on),{class:"h-4 w-4 animate-pulse text-cyan-400"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.ai.title")),1)]),s.createElementVNode("p",zw,s.toDisplayString(s.unref(r)("sidebars.ai.description")),1)]),s.createElementVNode("button",{type:"button",class:"rounded-md p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/5 dark:hover:text-slate-200","aria-label":s.unref(r)("sidebars.ai.close"),onClick:$},[s.createVNode(s.unref(Dt),{class:"h-4 w-4"})],8,Iw)]),h.value?(s.openBlock(),s.createElementBlock(s.Fragment,{key:1},[s.createElementVNode("div",Lw,[s.createElementVNode("span",Bw,s.toDisplayString(s.unref(r)("sidebars.ai.quickMacros")),1),s.createElementVNode("div",Pw,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(D.value,L=>(s.openBlock(),s.createElementBlock("button",{key:L.label,type:"button",disabled:c.value||L.needsSelection&&!x.value||"disabled"in L&&L.disabled,title:L.needsSelection&&!x.value?s.unref(r)("sidebars.ai.selectTextFirst"):L.label,class:s.normalizeClass(["flex items-center gap-1.5 rounded-lg border px-2.5 py-1.5 text-left text-[11px] font-bold transition-colors disabled:opacity-40","draft"in L&&L.draft&&b.value?"border-cyan-500 bg-cyan-500/10 text-cyan-700 dark:border-cyan-400/50 dark:bg-cyan-500/15 dark:text-cyan-300":"border-slate-200 bg-slate-50 text-slate-700 hover:border-cyan-500/50 dark:border-white/10 dark:bg-white/[0.02] dark:text-slate-300 dark:hover:border-cyan-500/30"]),onClick:Q=>L.improve?T():"draft"in L&&L.draft?_():S(L)},[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(L.icon),{class:s.normalizeClass(["h-3 w-3",L.color])},null,8,["class"])),s.createElementVNode("span",null,s.toDisplayString(L.label),1)],10,Vw))),128))])]),s.createElementVNode("div",{ref_key:"turnsEl",ref:m,class:"flex-1 space-y-3 overflow-y-auto p-4"},[o.value.length===0?(s.openBlock(),s.createElementBlock("div",Fw,[s.createVNode(s.unref(on),{class:"mb-2 h-6 w-6 text-cyan-500 opacity-30"}),s.createElementVNode("p",Uw,s.toDisplayString(s.unref(r)("sidebars.ai.noDraft")),1)])):s.createCommentVNode("",!0),(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(o.value,(L,Q)=>(s.openBlock(),s.createElementBlock("div",{key:Q,class:s.normalizeClass(["flex flex-col gap-1",L.role==="user"?"items-end":"items-start"])},[s.createElementVNode("span",Hw,[L.role==="user"?(s.openBlock(),s.createBlock(s.unref(fs),{key:0,class:"h-2.5 w-2.5"})):(s.openBlock(),s.createBlock(s.unref(on),{key:1,class:"h-2.5 w-2.5 text-cyan-400"})),s.createTextVNode(" "+s.toDisplayString(L.role==="user"?s.unref(r)("sidebars.ai.you"):s.unref(r)("sidebars.ai.assistant")),1)]),s.createElementVNode("div",{class:s.normalizeClass(["max-w-full whitespace-pre-wrap rounded-xl px-3 py-2 text-xs leading-relaxed",[L.role==="user"?"bg-cyan-500/10 text-slate-700 dark:bg-cyan-500/15 dark:text-slate-200":L.error?"bg-red-50 text-red-700 dark:bg-red-500/10 dark:text-red-300":"bg-slate-100 text-slate-700 dark:bg-white/[0.04] dark:text-slate-300"]])},[s.createTextVNode(s.toDisplayString(L.text),1),L.streaming?(s.openBlock(),s.createElementBlock("span",jw,"▌")):s.createCommentVNode("",!0)],2),L.role==="assistant"&&L.citations&&L.citations.length>0?(s.openBlock(),s.createElementBlock("div",qw,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(L.citations,j=>(s.openBlock(),s.createElementBlock("span",{key:j.ref,class:"inline-flex items-center gap-1 rounded-full border border-cyan-500/30 bg-cyan-500/5 px-2 py-0.5 text-[10px] font-semibold text-cyan-700 dark:border-cyan-400/30 dark:bg-cyan-500/10 dark:text-cyan-300"},[s.createVNode(s.unref(Kr),{class:"h-2.5 w-2.5"}),s.createTextVNode(s.toDisplayString(j.label),1)]))),128))])):s.createCommentVNode("",!0),L.role==="assistant"&&!L.streaming&&!L.error&&L.text?(s.openBlock(),s.createElementBlock("div",$w,[s.createElementVNode("button",{type:"button",class:"flex items-center gap-1 rounded-lg border border-slate-200 bg-white px-2 py-1 text-[10px] font-semibold text-slate-600 transition-all hover:bg-slate-50 dark:border-white/10 dark:bg-white/[0.02] dark:text-slate-300 dark:hover:bg-white/5",onClick:j=>H(L,Q)},[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(f.value===Q?s.unref(Wr):s.unref(od)),{class:s.normalizeClass(["h-3 w-3",f.value===Q?"text-emerald-500":""])},null,8,["class"])),s.createElementVNode("span",null,s.toDisplayString(f.value===Q?s.unref(r)("sidebars.ai.copied"):s.unref(r)("sidebars.ai.copy")),1)],8,Ww),s.createElementVNode("button",{type:"button",class:"flex items-center gap-1 rounded-lg bg-cyan-500 px-2 py-1 text-[10px] font-bold text-black shadow-cyan transition-all hover:bg-cyan-400",onClick:j=>M(L,Q)},[(s.openBlock(),s.createBlock(s.resolveDynamicComponent(p.value===Q?s.unref(Wr):s.unref(Jp)),{class:"h-3 w-3"})),s.createElementVNode("span",null,s.toDisplayString(p.value===Q?s.unref(r)("sidebars.ai.inserted"):s.unref(r)("sidebars.ai.insert")),1)],8,Gw)])):s.createCommentVNode("",!0)],2))),128))],512),s.createElementVNode("div",Kw,[s.createElementVNode("form",{class:"space-y-2",onSubmit:s.withModifiers(E,["prevent"])},[s.withDirectives(s.createElementVNode("textarea",{"onUpdate:modelValue":W[0]||(W[0]=L=>l.value=L),rows:"2",disabled:c.value,placeholder:b.value?s.unref(r)("sidebars.ai.draftPlaceholder"):s.unref(r)("sidebars.ai.promptPlaceholder"),class:"w-full min-h-[55px] resize-none rounded-xl border border-slate-200 bg-white p-2.5 text-xs text-slate-800 transition-all focus:border-cyan-500/50 focus:shadow-cyan focus:outline-none disabled:opacity-60 dark:border-white/10 dark:bg-white/[0.02] dark:text-slate-100 dark:focus:border-cyan-500/30",onKeydown:s.withKeys(s.withModifiers(E,["exact","prevent"]),["enter"])},null,40,Xw),[[s.vModelText,l.value]]),s.createElementVNode("div",Jw,[s.createElementVNode("button",{type:"submit",disabled:c.value||!l.value.trim(),class:"flex items-center gap-1 rounded-lg bg-cyan-500 px-3.5 py-2 text-xs font-bold text-black shadow-cyan transition-all hover:bg-cyan-400 disabled:opacity-40"},[s.createVNode(s.unref(Eo),{class:"h-3.5 w-3.5"}),s.createTextVNode(" "+s.toDisplayString(b.value?s.unref(r)("sidebars.ai.promptDraft"):s.unref(r)("sidebars.ai.promptAI")),1)],8,Zw)])],32)])],64)):(s.openBlock(),s.createElementBlock("div",Dw,[s.createVNode(s.unref(on),{class:"mb-2 h-6 w-6 text-cyan-500 opacity-30"}),s.createElementVNode("p",Rw,s.toDisplayString(s.unref(r)("sidebars.ai.notConfigured")),1)]))]))}}),Qw={class:"comments-sidebar flex h-full w-80 flex-shrink-0 flex-col border-l border-slate-200 bg-white/80 text-slate-800 backdrop-blur-xl transition-all dark:border-white/5 dark:bg-[#0a0f1e]/85 dark:text-slate-100"},Yw={class:"border-b border-slate-200 p-4 dark:border-white/5"},e_={class:"mb-3 flex items-center justify-between"},t_={class:"flex items-center gap-1.5 font-mono text-xs font-bold uppercase tracking-widest text-slate-500 dark:text-slate-400"},i_={class:"flex rounded-xl border border-slate-200 bg-slate-50 p-1 text-[11px] font-semibold dark:border-white/10 dark:bg-white/[0.02]"},n_={key:0,class:"mb-1 rounded-xl border border-cyan-500/25 bg-cyan-500/5 p-2.5 text-xs text-cyan-700 animate-fadeIn dark:border-cyan-500/15 dark:bg-cyan-500/10 dark:text-cyan-400"},r_={class:"mb-1 font-mono text-[9px] font-bold uppercase tracking-wider"},a_={class:"line-clamp-1 border-l-2 border-cyan-400 bg-cyan-500/10 py-0.5 pl-2.5 italic dark:bg-cyan-500/5"},o_={class:"flex-1 space-y-4 overflow-y-auto p-4"},s_={class:"flex items-start justify-between"},l_={class:"flex items-center gap-2"},c_={class:"text-xs font-bold text-slate-800 dark:text-slate-200"},u_={class:"font-mono text-[9px] text-slate-400 dark:text-slate-500"},f_={class:"flex items-center gap-1.5"},p_=["title","onClick"],d_=["title","onClick"],m_={key:0,class:"inline-flex items-center gap-1 rounded-full border border-amber-400/40 bg-amber-500/10 px-2 py-0.5 text-[10px] font-bold uppercase tracking-wider text-amber-600 dark:border-amber-500/30 dark:text-amber-400"},h_={class:"whitespace-pre-wrap break-words text-xs leading-relaxed text-slate-700 dark:text-slate-300"},b_={key:2,class:"space-y-2.5 border-l border-slate-200 pl-4 pt-1 dark:border-white/10"},g_={class:"flex items-center gap-1.5"},v_={class:"text-[10px] font-bold text-slate-600 dark:text-slate-300"},y_={class:"font-mono text-[8px] text-slate-400 dark:text-slate-500"},x_={class:"break-words pl-1 text-xs text-slate-600 dark:text-slate-400"},k_={key:3,class:"flex items-center justify-between border-t border-slate-100 pt-2 dark:border-white/5"},w_={key:0,class:"flex w-full items-center gap-1.5"},__=["onUpdate:modelValue","placeholder","onKeydown"],S_=["onClick"],C_=["onClick"],E_={key:4,class:"rounded-lg border border-green-100/40 bg-green-50/55 p-2 text-[10px] text-green-700 dark:border-green-500/10 dark:bg-green-950/10 dark:text-green-400"},N_={key:0},A_={key:0,class:"py-12 text-center text-slate-400 dark:text-slate-500"},O_={class:"text-xs"},T_={key:0,class:"border-t border-slate-200 bg-slate-50 p-4 dark:border-white/5 dark:bg-[#0a0f1e]/80"},M_=["placeholder"],z_={class:"flex items-center justify-between"},I_={class:"font-mono text-[9px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500"},D_=["disabled"],sp=s.defineComponent({__name:"CommentsSidebar",props:{comments:{},selectedTextSnippet:{},selectedTextIndex:{},orphanedIds:{}},emits:["add-comment","add-reply","resolve-comment","delete-comment"],setup(e,{emit:t}){const i=e,n=t,{t:r}=rt(),a=s.ref(""),o=s.ref({}),l=s.ref(null),c=s.ref("active"),f=s.computed(()=>(i.comments??[]).filter(b=>c.value==="resolved"?b.resolved:!b.resolved));function p(){a.value.trim()&&n("add-comment",a.value.trim(),i.selectedTextSnippet,i.selectedTextIndex)}function m(b){const y=o.value[b]||"";y.trim()&&(n("add-reply",b,y.trim()),o.value={...o.value,[b]:""},l.value=null)}function d(b){return b.split(" ").map(y=>y[0]).join("").slice(0,2).toUpperCase()}function h(b){var y;return((y=i.orphanedIds)==null?void 0:y.includes(b.id))===!0}function v(b){typeof window<"u"&&!window.confirm(r("sidebars.comments.confirmDelete"))||n("delete-comment",b)}return(b,y)=>(s.openBlock(),s.createElementBlock("div",Qw,[s.createElementVNode("div",Yw,[s.createElementVNode("div",e_,[s.createElementVNode("h3",t_,[s.createVNode(s.unref(Yc),{class:"h-4 w-4 text-cyan-400"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.comments.title")),1)]),s.createElementVNode("div",i_,[s.createElementVNode("button",{type:"button",class:s.normalizeClass([c.value==="active"?"bg-cyan-500/15 text-cyan-600 dark:text-cyan-400 font-bold":"text-slate-400 hover:text-slate-600","rounded-lg px-2.5 py-1 transition-all"]),onClick:y[0]||(y[0]=g=>c.value="active")},s.toDisplayString(s.unref(r)("sidebars.comments.active")),3),s.createElementVNode("button",{type:"button",class:s.normalizeClass([c.value==="resolved"?"bg-cyan-500/15 text-cyan-600 dark:text-cyan-400 font-bold":"text-slate-400 hover:text-slate-600","rounded-lg px-2.5 py-1 transition-all"]),onClick:y[1]||(y[1]=g=>c.value="resolved")},s.toDisplayString(s.unref(r)("sidebars.comments.resolved")),3)])]),e.selectedTextSnippet?(s.openBlock(),s.createElementBlock("div",n_,[s.createElementVNode("p",r_,s.toDisplayString(s.unref(r)("sidebars.comments.creatingAnchored")),1),s.createElementVNode("p",a_,' "'+s.toDisplayString(e.selectedTextSnippet)+'" ',1)])):s.createCommentVNode("",!0)]),s.createElementVNode("div",o_,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(f.value,g=>(s.openBlock(),s.createElementBlock("div",{key:g.id,class:"relative space-y-3 rounded-2xl border border-slate-200/60 bg-slate-50/60 p-4 transition-all hover:border-cyan-500/30 hover:shadow-cyan dark:border-white/5 dark:bg-[#02040a]/40"},[s.createElementVNode("div",s_,[s.createElementVNode("div",l_,[s.createElementVNode("div",{class:"flex h-6 w-6 items-center justify-center rounded-full text-[10px] font-bold text-white shadow-sm",style:s.normalizeStyle({backgroundColor:g.authorColor})},s.toDisplayString(d(g.authorName)),5),s.createElementVNode("div",null,[s.createElementVNode("h4",c_,s.toDisplayString(g.authorName),1),s.createElementVNode("p",u_,s.toDisplayString(new Date(g.createdAt).toLocaleTimeString()),1)])]),s.createElementVNode("div",f_,[g.resolved?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"rounded-lg p-1.5 text-slate-400 transition-colors hover:bg-green-500/10 hover:text-green-500",title:s.unref(r)("sidebars.comments.resolve"),onClick:x=>n("resolve-comment",g.id)},[s.createVNode(s.unref(nd),{class:"h-4 w-4"})],8,p_)),h(g)?(s.openBlock(),s.createElementBlock("button",{key:1,type:"button",class:"rounded-lg p-1.5 text-slate-400 transition-colors hover:bg-red-500/10 hover:text-red-500",title:s.unref(r)("sidebars.comments.delete"),onClick:x=>v(g.id)},[s.createVNode(s.unref(us),{class:"h-4 w-4"})],8,d_)):s.createCommentVNode("",!0)])]),h(g)?(s.openBlock(),s.createElementBlock("div",m_,s.toDisplayString(s.unref(r)("sidebars.comments.orphaned")),1)):s.createCommentVNode("",!0),g.anchorText?(s.openBlock(),s.createElementBlock("div",{key:1,class:s.normalizeClass(["max-w-full truncate rounded-r-lg border-l-2 py-1 pl-2.5 text-[10px] italic text-slate-500 dark:text-slate-400",h(g)?"border-amber-500/50 bg-amber-50/50 line-through opacity-70 dark:border-amber-500/40 dark:bg-amber-500/5":"border-cyan-500/50 bg-slate-100 dark:border-cyan-500/40 dark:bg-white/5"])},s.toDisplayString(s.unref(r)("sidebars.comments.quote"))+' "'+s.toDisplayString(g.anchorText)+'" ',3)):s.createCommentVNode("",!0),s.createElementVNode("p",h_,s.toDisplayString(g.content),1),g.replies.length>0?(s.openBlock(),s.createElementBlock("div",b_,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(g.replies,x=>(s.openBlock(),s.createElementBlock("div",{key:x.id,class:"space-y-1"},[s.createElementVNode("div",g_,[s.createElementVNode("div",{class:"flex h-4.5 w-4.5 items-center justify-center rounded-full text-[8px] font-bold text-white shadow-sm",style:s.normalizeStyle({backgroundColor:x.authorColor})},s.toDisplayString(d(x.authorName)),5),s.createElementVNode("span",v_,s.toDisplayString(x.authorName),1),s.createElementVNode("span",y_,s.toDisplayString(new Date(x.createdAt).toLocaleTimeString()),1)]),s.createElementVNode("p",x_,s.toDisplayString(x.content),1)]))),128))])):s.createCommentVNode("",!0),g.resolved?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",k_,[l.value===g.id?(s.openBlock(),s.createElementBlock("div",w_,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":x=>o.value[g.id]=x,type:"text",placeholder:s.unref(r)("sidebars.comments.reply"),class:"flex-1 rounded-lg border border-slate-200 bg-white px-2.5 py-1.5 text-xs text-slate-800 focus:border-cyan-500/50 focus:outline-none dark:border-white/10 dark:bg-white/[0.02] dark:text-slate-100 dark:focus:border-cyan-500/30",onKeydown:s.withKeys(x=>m(g.id),["enter"])},null,40,__),[[s.vModelText,o.value[g.id]]]),s.createElementVNode("button",{type:"button",class:"rounded-lg bg-cyan-500 p-1.5 font-bold text-black shadow-cyan hover:bg-cyan-400",onClick:x=>m(g.id)},[s.createVNode(s.unref(Eo),{class:"h-3.5 w-3.5"})],8,S_)])):(s.openBlock(),s.createElementBlock("button",{key:1,type:"button",class:"flex items-center gap-1 text-[10px] font-bold text-cyan-600 transition-all hover:text-cyan-500",onClick:x=>l.value=g.id},[s.createVNode(s.unref(Td),{class:"h-3 w-3"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.comments.replyInThread")),1)],8,C_))])),g.resolved?(s.openBlock(),s.createElementBlock("div",E_,[s.createTextVNode(s.toDisplayString(s.unref(r)("sidebars.comments.resolvedBy").replace("{user}",g.resolvedByName||g.resolvedBy||"You"))+" ",1),g.resolvedAt?(s.openBlock(),s.createElementBlock("span",N_,"at "+s.toDisplayString(new Date(g.resolvedAt).toLocaleTimeString()),1)):s.createCommentVNode("",!0)])):s.createCommentVNode("",!0)]))),128)),f.value.length===0?(s.openBlock(),s.createElementBlock("div",A_,[s.createVNode(s.unref(kd),{class:"mx-auto mb-2 h-8 w-8 text-cyan-500 opacity-50"}),s.createElementVNode("p",O_,s.toDisplayString(s.unref(r)("sidebars.comments.noComments").replace("{mode}",c.value)),1)])):s.createCommentVNode("",!0)]),c.value==="active"?(s.openBlock(),s.createElementBlock("div",T_,[s.createElementVNode("form",{class:"space-y-2",onSubmit:s.withModifiers(p,["prevent"])},[s.withDirectives(s.createElementVNode("textarea",{"onUpdate:modelValue":y[2]||(y[2]=g=>a.value=g),rows:"2",placeholder:e.selectedTextSnippet?s.unref(r)("sidebars.comments.commentOnSelection"):s.unref(r)("sidebars.comments.generalComment"),class:"w-full min-h-[60px] resize-none rounded-xl border border-slate-200 bg-white p-2.5 text-xs text-slate-800 transition-all focus:border-cyan-500/50 focus:shadow-cyan focus:outline-none dark:border-white/10 dark:bg-white/[0.02] dark:text-slate-100 dark:focus:border-cyan-500/30"},null,8,M_),[[s.vModelText,a.value]]),s.createElementVNode("div",z_,[s.createElementVNode("span",I_,s.toDisplayString(e.selectedTextSnippet?s.unref(r)("sidebars.comments.anchoredComment"):s.unref(r)("sidebars.comments.general")),1),s.createElementVNode("button",{type:"submit",disabled:!a.value.trim(),class:"flex items-center gap-1 rounded-lg bg-cyan-500 px-3.5 py-2 text-xs font-bold text-black shadow-cyan transition-all hover:bg-cyan-400 disabled:opacity-50"},[s.createVNode(s.unref(Eo),{class:"h-3.5 w-3.5"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.comments.post")),1)],8,D_)])],32)])):s.createCommentVNode("",!0)]))}}),R_={class:"history-sidebar flex h-full w-80 flex-shrink-0 flex-col border-l border-slate-200 bg-white/80 text-slate-800 backdrop-blur-xl transition-all dark:border-white/5 dark:bg-[#0a0f1e]/85 dark:text-slate-100"},L_={class:"border-b border-slate-200 p-4 dark:border-white/5"},B_={class:"flex items-center gap-1.5 font-mono text-xs font-bold uppercase tracking-widest text-slate-500 dark:text-slate-400"},P_={class:"mt-1.5 text-[10px] leading-relaxed text-slate-400 dark:text-slate-500"},V_={class:"flex-1 space-y-3 overflow-y-auto p-4"},F_={key:0,class:"space-y-2 rounded-2xl border border-amber-500/30 bg-amber-500/10 p-3.5 text-xs animate-fadeIn dark:border-amber-500/20"},U_={class:"flex items-start gap-1.5 text-amber-700 dark:text-amber-400"},H_={class:"font-bold"},j_={class:"mt-0.5 text-[10px] leading-relaxed text-amber-600 dark:text-amber-500"},q_={class:"flex justify-end gap-2 pt-1"},$_={class:"space-y-2.5"},W_={class:"mb-1 flex items-center justify-between"},G_={class:"rounded-md bg-slate-200 px-1.5 py-0.5 font-mono text-[9px] font-bold text-slate-500 dark:bg-cyan-500/10 dark:text-cyan-400"},K_={class:"flex items-center gap-0.5 font-mono text-[9px] text-slate-400 dark:text-slate-500"},X_={class:"text-xs font-bold leading-snug text-slate-800 dark:text-slate-200"},J_={class:"flex items-center gap-1.5 text-[10px] text-slate-500"},Z_={class:"font-semibold text-slate-600 dark:text-slate-300"},Q_={class:"flex justify-end gap-2 border-t border-slate-200/50 pt-2 dark:border-white/5"},Y_=["onClick"],eS=["onClick"],tS={key:0,class:"py-6 text-center text-xs text-slate-400 dark:text-slate-500"},iS={class:"border-t border-slate-200 bg-slate-50 p-4 dark:border-white/5 dark:bg-[#0a0f1e]/85"},nS=["placeholder"],rS={class:"flex justify-end gap-2"},aS={type:"submit",class:"rounded-lg bg-cyan-500 px-3.5 py-1.5 text-xs font-bold text-black shadow-cyan hover:bg-cyan-400"},lp=s.defineComponent({__name:"HistorySidebar",props:{snapshots:{},activePreviewIndex:{}},emits:["save-snapshot","restore-snapshot","preview-snapshot"],setup(e,{emit:t}){const i=e,n=t,{t:r}=rt(),a=s.ref(""),o=s.ref(!1);function l(){a.value.trim()&&(n("save-snapshot",a.value.trim()),a.value="",o.value=!1)}const c=s.computed(()=>i.snapshots??[]);return(f,p)=>(s.openBlock(),s.createElementBlock("div",R_,[s.createElementVNode("div",L_,[s.createElementVNode("h3",B_,[s.createVNode(s.unref(Xc),{class:"h-4 w-4 text-cyan-400"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.history.title")),1)]),s.createElementVNode("p",P_,s.toDisplayString(s.unref(r)("sidebars.history.empty")),1)]),s.createElementVNode("div",V_,[e.activePreviewIndex!==null?(s.openBlock(),s.createElementBlock("div",F_,[s.createElementVNode("div",U_,[s.createVNode(s.unref(Id),{class:"mt-0.5 h-4 w-4 flex-shrink-0 text-amber-500"}),s.createElementVNode("div",null,[s.createElementVNode("p",H_,s.toDisplayString(s.unref(r)("sidebars.history.viewingPreview")),1),s.createElementVNode("p",j_,s.toDisplayString(s.unref(r)("sidebars.history.readOnlyPreview").replace("{index}",String(e.activePreviewIndex))),1)])]),s.createElementVNode("div",q_,[s.createElementVNode("button",{type:"button",class:"rounded-lg px-2.5 py-1 text-[10px] font-semibold text-slate-500 hover:bg-white/5 hover:text-slate-700 dark:text-slate-400",onClick:p[0]||(p[0]=m=>n("preview-snapshot",null))},s.toDisplayString(s.unref(r)("sidebars.history.closePreview")),1),s.createElementVNode("button",{type:"button",class:"flex items-center gap-1 rounded-lg bg-cyan-500 px-3 py-1 text-[10px] font-bold text-black shadow-cyan transition-all hover:bg-cyan-400",onClick:p[1]||(p[1]=()=>{n("restore-snapshot",e.activePreviewIndex),n("preview-snapshot",null)})},[s.createVNode(s.unref(pl),{class:"h-3 w-3"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.history.restoreThis")),1)])])])):s.createCommentVNode("",!0),s.createElementVNode("div",$_,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(c.value,m=>(s.openBlock(),s.createElementBlock("div",{key:m.versionIndex,class:s.normalizeClass(["space-y-2.5 rounded-2xl border p-4 transition-all",e.activePreviewIndex===m.versionIndex?"border-cyan-500/40 bg-cyan-500/5 shadow-cyan dark:border-cyan-500/30":"border-slate-200/60 bg-slate-50/60 hover:border-cyan-500/30 dark:border-white/5 dark:bg-[#02040a]/40 dark:hover:border-white/10"])},[s.createElementVNode("div",null,[s.createElementVNode("div",W_,[s.createElementVNode("span",G_,s.toDisplayString(s.unref(r)("sidebars.history.version"))+" #"+s.toDisplayString(m.versionIndex),1),s.createElementVNode("span",K_,[s.createVNode(s.unref($c),{class:"h-2.5 w-2.5"}),s.createTextVNode(" "+s.toDisplayString(new Date(m.timestamp).toLocaleDateString())+" "+s.toDisplayString(new Date(m.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})),1)])]),s.createElementVNode("h4",X_,s.toDisplayString(m.title),1)]),s.createElementVNode("div",J_,[s.createVNode(s.unref(fs),{class:"h-3.5 w-3.5"}),s.createElementVNode("span",null,[s.createTextVNode(s.toDisplayString(s.unref(r)("sidebars.history.modifiedBy"))+" ",1),s.createElementVNode("strong",Z_,s.toDisplayString(m.modifiedBy),1)])]),s.createElementVNode("div",Q_,[e.activePreviewIndex!==m.versionIndex?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"flex items-center gap-1 text-[10px] font-bold text-slate-500 transition-colors hover:text-cyan-600 dark:text-slate-400 dark:hover:text-cyan-400",onClick:d=>n("preview-snapshot",m)},[s.createVNode(s.unref(sd),{class:"h-3 w-3"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.history.preview")),1)],8,Y_)):s.createCommentVNode("",!0),s.createElementVNode("button",{type:"button",class:"flex items-center gap-1 text-[10px] font-bold text-cyan-600 transition-colors hover:text-cyan-500 dark:text-cyan-400 dark:hover:text-cyan-300",onClick:d=>n("restore-snapshot",m.versionIndex)},[s.createVNode(s.unref(pl),{class:"h-3 w-3"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.history.restore")),1)],8,eS)])],2))),128)),c.value.length===0?(s.openBlock(),s.createElementBlock("p",tS,s.toDisplayString(s.unref(r)("sidebars.history.noSnapshots")),1)):s.createCommentVNode("",!0)])]),s.createElementVNode("div",iS,[o.value?(s.openBlock(),s.createElementBlock("form",{key:0,class:"space-y-2 animate-fadeIn",onSubmit:s.withModifiers(l,["prevent"])},[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":p[2]||(p[2]=m=>a.value=m),type:"text",required:"",placeholder:s.unref(r)("sidebars.history.snapshotPlaceholder"),class:"w-full rounded-xl border border-slate-200 bg-white px-2.5 py-1.5 text-xs text-slate-800 transition-all focus:border-cyan-500/50 focus:shadow-cyan focus:outline-none dark:border-white/10 dark:bg-white/[0.02] dark:text-slate-100 dark:focus:border-cyan-500/30"},null,8,nS),[[s.vModelText,a.value]]),s.createElementVNode("div",rS,[s.createElementVNode("button",{type:"button",class:"rounded-lg px-2.5 py-1 text-[10px] text-slate-500 hover:bg-white/5 dark:text-slate-400",onClick:p[3]||(p[3]=m=>o.value=!1)},s.toDisplayString(s.unref(r)("sidebars.history.cancel")),1),s.createElementVNode("button",aS,s.toDisplayString(s.unref(r)("sidebars.history.save")),1)])],32)):(s.openBlock(),s.createElementBlock("button",{key:1,type:"button",class:"flex w-full items-center justify-center gap-1.5 rounded-xl border border-dashed border-slate-300 py-2.5 text-xs font-bold text-slate-500 transition-all hover:border-cyan-500 hover:bg-cyan-500/5 hover:text-cyan-500 dark:border-white/10 dark:text-slate-400 dark:hover:border-cyan-400/50 dark:hover:text-cyan-400",onClick:p[4]||(p[4]=m=>o.value=!0)},[s.createVNode(s.unref(Md),{class:"h-3.5 w-3.5 animate-pulse"}),s.createTextVNode(" "+s.toDisplayString(s.unref(r)("sidebars.history.saveNamedSnapshot")),1)]))])]))}}),oS={class:"w-full max-w-md rounded-xl border border-slate-200 bg-white p-6 shadow-2xl dark:border-slate-800 dark:bg-[#0e1525]"},sS={class:"mb-4 flex items-center justify-between"},lS={class:"text-lg font-bold text-slate-800 dark:text-slate-100"},cS={key:0,class:"space-y-4"},uS={class:"flex items-start gap-3"},fS={class:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-cyan-500/10 text-cyan-600 dark:text-cyan-400"},pS={class:"text-[11px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500"},dS={class:"text-sm font-medium text-slate-800 dark:text-slate-200"},mS={class:"flex items-start gap-3"},hS={class:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-blue-500/10 text-blue-600 dark:text-blue-400"},bS={class:"text-[11px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500"},gS={class:"text-sm font-medium text-slate-800 dark:text-slate-200"},vS={class:"text-xs text-slate-500 dark:text-slate-400"},yS={class:"flex items-start gap-3"},xS={class:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-amber-500/10 text-amber-600 dark:text-amber-400"},kS={class:"text-[11px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500"},wS={class:"text-sm font-medium text-slate-800 dark:text-slate-200"},_S={class:"grid grid-cols-2 gap-3"},SS={class:"flex items-start gap-3"},CS={class:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-emerald-500/10 text-emerald-600 dark:text-emerald-400"},ES={class:"text-[11px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500"},NS={class:"text-xs font-medium text-slate-800 dark:text-slate-200"},AS={class:"flex items-start gap-3"},OS={class:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-purple-500/10 text-purple-600 dark:text-purple-400"},TS={class:"text-[11px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500"},MS={class:"text-xs font-medium text-slate-800 dark:text-slate-200"},zS={class:"rounded-lg border border-slate-200 bg-slate-50 p-4 dark:border-slate-700/50 dark:bg-white/5"},IS={class:"mb-2 flex items-center gap-2 text-[11px] font-bold uppercase tracking-wider text-slate-400 dark:text-slate-500"},DS={class:"grid grid-cols-3 gap-3 text-center"},RS={class:"text-lg font-bold text-slate-800 dark:text-slate-100"},LS={class:"text-[10px] uppercase tracking-wide text-slate-500 dark:text-slate-400"},BS={class:"text-lg font-bold text-slate-800 dark:text-slate-100"},PS={class:"text-[10px] uppercase tracking-wide text-slate-500 dark:text-slate-400"},VS={class:"text-lg font-bold text-slate-800 dark:text-slate-100"},FS={class:"text-[10px] uppercase tracking-wide text-slate-500 dark:text-slate-400"},US={key:1,class:"py-8 text-center text-sm text-slate-500 dark:text-slate-400"},cp=s.defineComponent({__name:"DetailsDialog",props:{isOpen:{type:Boolean},meta:{}},emits:["close"],setup(e,{emit:t}){const{t:i}=rt(),n=t;function r(a){return a?new Date(a).toLocaleString():"-"}return(a,o)=>e.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-slate-900/50 p-4 backdrop-blur-sm",onClick:o[1]||(o[1]=s.withModifiers(l=>n("close"),["self"]))},[s.createElementVNode("div",oS,[s.createElementVNode("div",sS,[s.createElementVNode("h2",lS,s.toDisplayString(s.unref(i)("editor.details.title")),1),s.createElementVNode("button",{type:"button",class:"rounded p-1 text-slate-400 transition hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/5 dark:hover:text-slate-300",onClick:o[0]||(o[0]=l=>n("close"))},[s.createVNode(s.unref(Dt),{class:"h-4 w-4"})])]),e.meta?(s.openBlock(),s.createElementBlock("div",cS,[s.createElementVNode("div",uS,[s.createElementVNode("div",fS,[s.createVNode(s.unref(sn),{class:"h-4 w-4"})]),s.createElementVNode("div",null,[s.createElementVNode("label",pS,s.toDisplayString(s.unref(i)("editor.details.titleLabel")),1),s.createElementVNode("p",dS,s.toDisplayString(e.meta.title),1)])]),s.createElementVNode("div",mS,[s.createElementVNode("div",hS,[s.createVNode(s.unref(fs),{class:"h-4 w-4"})]),s.createElementVNode("div",null,[s.createElementVNode("label",bS,s.toDisplayString(s.unref(i)("editor.details.owner")),1),s.createElementVNode("p",gS,s.toDisplayString(e.meta.owner.name),1),s.createElementVNode("p",vS,s.toDisplayString(e.meta.owner.email),1)])]),s.createElementVNode("div",yS,[s.createElementVNode("div",xS,[s.createVNode(s.unref(cd),{class:"h-4 w-4"})]),s.createElementVNode("div",null,[s.createElementVNode("label",kS,s.toDisplayString(s.unref(i)("editor.details.location")),1),s.createElementVNode("p",wS,s.toDisplayString(e.meta.folderName||s.unref(i)("editor.details.noFolder")),1)])]),s.createElementVNode("div",_S,[s.createElementVNode("div",SS,[s.createElementVNode("div",CS,[s.createVNode(s.unref($c),{class:"h-4 w-4"})]),s.createElementVNode("div",null,[s.createElementVNode("label",ES,s.toDisplayString(s.unref(i)("editor.details.created")),1),s.createElementVNode("p",NS,s.toDisplayString(r(e.meta.createdAt)),1)])]),s.createElementVNode("div",AS,[s.createElementVNode("div",OS,[s.createVNode(s.unref(rd),{class:"h-4 w-4"})]),s.createElementVNode("div",null,[s.createElementVNode("label",TS,s.toDisplayString(s.unref(i)("editor.details.modified")),1),s.createElementVNode("p",MS,s.toDisplayString(r(e.meta.updatedAt)),1)])])]),s.createElementVNode("div",zS,[s.createElementVNode("div",IS,[s.createVNode(s.unref(Kc),{class:"h-3.5 w-3.5"}),s.createTextVNode(" "+s.toDisplayString(s.unref(i)("editor.details.statistics")),1)]),s.createElementVNode("div",DS,[s.createElementVNode("div",null,[s.createElementVNode("p",RS,s.toDisplayString(e.meta.wordCount),1),s.createElementVNode("p",LS,s.toDisplayString(s.unref(i)("editor.details.words")),1)]),s.createElementVNode("div",null,[s.createElementVNode("p",BS,s.toDisplayString(e.meta.charCount),1),s.createElementVNode("p",PS,s.toDisplayString(s.unref(i)("editor.details.characters")),1)]),s.createElementVNode("div",null,[s.createElementVNode("p",VS,s.toDisplayString(e.meta.pageCount),1),s.createElementVNode("p",FS,s.toDisplayString(s.unref(i)("editor.details.pages")),1)])])])])):(s.openBlock(),s.createElementBlock("div",US,s.toDisplayString(s.unref(i)("editor.details.loading")),1))])])):s.createCommentVNode("",!0)}}),HS={class:"w-full max-w-md rounded-xl border border-slate-200 bg-white p-6 shadow-2xl dark:border-slate-800 dark:bg-[#0e1525]"},jS={class:"mb-4 flex items-center justify-between"},qS={class:"flex items-center gap-2"},$S={class:"flex h-8 w-8 items-center justify-center rounded-lg bg-cyan-500/10 text-cyan-600 dark:text-cyan-400"},WS={class:"text-lg font-bold text-slate-800 dark:text-slate-100"},GS={class:"mb-4 rounded-md border border-slate-200 bg-slate-50 p-3 dark:border-slate-700/50 dark:bg-white/5"},KS={class:"mb-1 block text-[11px] font-bold uppercase tracking-wide text-slate-500 dark:text-slate-400"},XS={class:"flex items-center gap-2"},JS=["value"],ZS=["title"],QS={class:"space-y-3"},YS={class:"mb-1 block text-xs font-medium text-slate-600 dark:text-slate-400"},eC=["placeholder"],tC={class:"mb-1 block text-xs font-medium text-slate-600 dark:text-slate-400"},iC={class:"mb-1 block text-xs font-medium text-slate-600 dark:text-slate-400"},nC={class:"mt-5 flex justify-end gap-2"},rC=["href"],up=s.defineComponent({__name:"EmailDialog",props:{isOpen:{type:Boolean},documentTitle:{},shareUrl:{},defaultRecipient:{}},emits:["close","copy-link"],setup(e,{emit:t}){const{t:i}=rt(),n=e,r=t,a=s.ref(n.defaultRecipient||""),o=s.ref(""),l=s.ref(""),c=s.ref(!1),f=s.ref(!1),p=s.computed(()=>i("editor.email.defaultSubject",{title:n.documentTitle})),m=s.computed(()=>i("editor.email.defaultBody",{url:n.shareUrl})),d=s.computed(()=>o.value===p.value),h=s.computed(()=>l.value===m.value);s.watch(()=>n.documentTitle,()=>{o.value=p.value},{immediate:!0}),s.watch(()=>n.shareUrl,()=>{l.value=m.value},{immediate:!0});const v=s.computed(()=>{const g=new URLSearchParams;o.value.trim()&&g.set("subject",o.value.trim()),l.value.trim()&&g.set("body",l.value.trim());const x=g.toString();let k=`mailto:${a.value.trim()}`;return x&&(k+=`?${x}`),k});function b(){r("copy-link")}function y(){a.value=n.defaultRecipient||"",o.value=p.value,l.value=m.value,c.value=!1,f.value=!1}return s.watch(()=>n.isOpen,g=>{g&&y()}),(g,x)=>e.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-slate-900/50 p-4 backdrop-blur-sm",onClick:x[10]||(x[10]=s.withModifiers(k=>r("close"),["self"]))},[s.createElementVNode("div",HS,[s.createElementVNode("div",jS,[s.createElementVNode("div",qS,[s.createElementVNode("div",$S,[s.createVNode(s.unref(yd),{class:"h-4 w-4"})]),s.createElementVNode("h2",WS,s.toDisplayString(s.unref(i)("editor.email.title")),1)]),s.createElementVNode("button",{type:"button",class:"rounded p-1 text-slate-400 transition hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-white/5 dark:hover:text-slate-300",onClick:x[0]||(x[0]=k=>r("close"))},[s.createVNode(s.unref(Dt),{class:"h-4 w-4"})])]),s.createElementVNode("div",GS,[s.createElementVNode("label",KS,s.toDisplayString(s.unref(i)("editor.email.shareableLink")),1),s.createElementVNode("div",XS,[s.createElementVNode("input",{type:"text",value:e.shareUrl,readonly:"",class:"flex-1 rounded-md border border-slate-300 bg-white px-2 py-1.5 text-xs text-slate-700 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-300"},null,8,JS),s.createElementVNode("button",{type:"button",class:"flex h-7 w-7 items-center justify-center rounded-md border border-slate-300 text-slate-500 transition hover:bg-slate-100 dark:border-slate-600 dark:text-slate-400 dark:hover:bg-slate-700",title:s.unref(i)("editor.email.copyLink"),onClick:b},[s.createVNode(s.unref(Zc),{class:"h-3.5 w-3.5"})],8,ZS)])]),s.createElementVNode("div",QS,[s.createElementVNode("div",null,[s.createElementVNode("label",YS,s.toDisplayString(s.unref(i)("editor.email.to")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":x[1]||(x[1]=k=>a.value=k),type:"email",class:"w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-xs text-slate-700 focus:border-cyan-500 focus:outline-none dark:border-slate-600 dark:bg-slate-900 dark:text-slate-300",placeholder:s.unref(i)("editor.email.toPlaceholder")},null,8,eC),[[s.vModelText,a.value]])]),s.createElementVNode("div",null,[s.createElementVNode("label",tC,s.toDisplayString(s.unref(i)("editor.email.subject")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":x[2]||(x[2]=k=>o.value=k),type:"text",class:s.normalizeClass(["w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-xs focus:border-cyan-500 focus:outline-none dark:border-slate-600 dark:bg-slate-900",d.value&&!c.value?"text-slate-400 dark:text-slate-500":"text-slate-700 dark:text-slate-300"]),onFocus:x[3]||(x[3]=k=>c.value=!0),onBlur:x[4]||(x[4]=k=>c.value=!1)},null,34),[[s.vModelText,o.value]])]),s.createElementVNode("div",null,[s.createElementVNode("label",iC,s.toDisplayString(s.unref(i)("editor.email.body")),1),s.withDirectives(s.createElementVNode("textarea",{"onUpdate:modelValue":x[5]||(x[5]=k=>l.value=k),rows:"4",class:s.normalizeClass(["w-full resize-none rounded-md border border-slate-300 bg-white px-3 py-2 text-xs focus:border-cyan-500 focus:outline-none dark:border-slate-600 dark:bg-slate-900",h.value&&!f.value?"text-slate-400 dark:text-slate-500":"text-slate-700 dark:text-slate-300"]),onFocus:x[6]||(x[6]=k=>f.value=!0),onBlur:x[7]||(x[7]=k=>f.value=!1)},null,34),[[s.vModelText,l.value]])])]),s.createElementVNode("div",nC,[s.createElementVNode("button",{type:"button",class:"rounded-md px-3 py-1.5 text-xs font-semibold text-slate-700 transition hover:bg-slate-100 dark:text-slate-300",onClick:x[8]||(x[8]=k=>r("close"))},s.toDisplayString(s.unref(i)("common.cancel")),1),s.createElementVNode("a",{href:v.value,class:"inline-flex rounded-md bg-cyan-600 px-3 py-1.5 text-xs font-semibold text-white transition hover:bg-cyan-700",onClick:x[9]||(x[9]=k=>r("close"))},s.toDisplayString(s.unref(i)("editor.email.send")),9,rC)])])])):s.createCommentVNode("",!0)}}),aC=["aria-label"],oC={class:"flex items-center gap-1.5"},sC=["placeholder"],lC={class:"w-16 flex-shrink-0 text-center text-[11px] text-slate-400 dark:text-slate-500"},cC=["disabled","title"],uC=["disabled","title"],fC=["title"],pC={class:"mt-2 flex items-center gap-1.5"},dC=["placeholder","onKeydown"],mC=["disabled"],hC=["disabled"],bC=s.defineComponent({__name:"FindReplaceDialog",props:{isOpen:{type:Boolean},editor:{}},emits:["close"],setup(e,{emit:t}){const{t:i}=rt(),n=e,r=t,a=s.ref(null),o=s.ref(""),l=s.ref(""),c=s.ref({query:"",matches:[],activeIndex:0}),f=s.computed(()=>{if(!o.value)return"";const{matches:x,activeIndex:k}=c.value;return x.length===0?i("editor.findReplace.noMatches"):i("editor.findReplace.matchCount",{current:k+1,total:x.length})}),p=()=>{n.editor&&(c.value=_e.getSearchState(n.editor))};s.watch(()=>n.editor,(x,k)=>{k==null||k.off("transaction",p),x==null||x.on("transaction",p)}),s.watch(()=>n.isOpen,async x=>{var k,w;if(n.editor)if(x){const{from:C,to:E}=n.editor.state.selection;C!==E&&(o.value=n.editor.state.doc.textBetween(C,E," ")),m(),n.editor.on("transaction",p),await s.nextTick(),(k=a.value)==null||k.focus(),(w=a.value)==null||w.select()}else g()});function m(){n.editor&&(_e.setSearchQuery(n.editor,o.value),p())}s.watch(o,m);function d(){n.editor&&_e.searchNext(n.editor)}function h(){n.editor&&_e.searchPrev(n.editor)}function v(){n.editor&&_e.replaceCurrent(n.editor,l.value)}function b(){n.editor&&_e.replaceAll(n.editor,l.value)}function y(x){x.key==="Enter"&&x.shiftKey?(x.preventDefault(),h()):x.key==="Enter"?(x.preventDefault(),d()):x.key==="Escape"&&(x.preventDefault(),g())}function g(){var x;n.editor&&_e.clearSearch(n.editor),(x=n.editor)==null||x.off("transaction",p),o.value="",l.value="",c.value={query:"",matches:[],activeIndex:0},r("close")}return s.onUnmounted(()=>{var x;(x=n.editor)==null||x.off("transaction",p)}),(x,k)=>e.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"absolute right-4 top-16 z-40 w-[340px] rounded-xl border border-slate-200 bg-white p-3 shadow-2xl dark:border-slate-700 dark:bg-[#0e1525]",role:"dialog","aria-label":s.unref(i)("editor.findReplace.title")},[s.createElementVNode("div",oC,[s.withDirectives(s.createElementVNode("input",{ref_key:"findInput",ref:a,"onUpdate:modelValue":k[0]||(k[0]=w=>o.value=w),type:"text",placeholder:s.unref(i)("editor.findReplace.findPlaceholder"),class:"min-w-0 flex-1 rounded-lg border border-slate-200 bg-transparent px-2.5 py-1.5 text-sm text-slate-800 focus:border-cyan-500 focus:outline-none dark:border-slate-600 dark:text-slate-100",onKeydown:y},null,40,sC),[[s.vModelText,o.value]]),s.createElementVNode("span",lC,s.toDisplayString(f.value),1),s.createElementVNode("button",{type:"button",class:"flex h-7 w-7 items-center justify-center rounded-md text-slate-500 transition-colors hover:bg-slate-100 disabled:opacity-30 dark:text-slate-400 dark:hover:bg-slate-800",disabled:c.value.matches.length===0,title:s.unref(i)("editor.findReplace.previous"),onClick:h},[s.createVNode(s.unref(td),{class:"h-4 w-4"})],8,cC),s.createElementVNode("button",{type:"button",class:"flex h-7 w-7 items-center justify-center rounded-md text-slate-500 transition-colors hover:bg-slate-100 disabled:opacity-30 dark:text-slate-400 dark:hover:bg-slate-800",disabled:c.value.matches.length===0,title:s.unref(i)("editor.findReplace.next"),onClick:d},[s.createVNode(s.unref(ei),{class:"h-4 w-4"})],8,uC),s.createElementVNode("button",{type:"button",class:"flex h-7 w-7 items-center justify-center rounded-md text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-slate-800",title:s.unref(i)("editor.findReplace.close"),onClick:g},[s.createVNode(s.unref(Dt),{class:"h-4 w-4"})],8,fC)]),s.createElementVNode("div",pC,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":k[1]||(k[1]=w=>l.value=w),type:"text",placeholder:s.unref(i)("editor.findReplace.replacePlaceholder"),class:"min-w-0 flex-1 rounded-lg border border-slate-200 bg-transparent px-2.5 py-1.5 text-sm text-slate-800 focus:border-cyan-500 focus:outline-none dark:border-slate-600 dark:text-slate-100",onKeydown:s.withKeys(s.withModifiers(v,["prevent"]),["enter"])},null,40,dC),[[s.vModelText,l.value]]),s.createElementVNode("button",{type:"button",class:"flex-shrink-0 rounded-lg border border-slate-200 px-2.5 py-1.5 text-xs font-semibold text-slate-600 transition-colors hover:bg-slate-50 disabled:opacity-30 dark:border-slate-600 dark:text-slate-300 dark:hover:bg-white/5",disabled:c.value.matches.length===0,onClick:v},s.toDisplayString(s.unref(i)("editor.findReplace.replace")),9,mC),s.createElementVNode("button",{type:"button",class:"flex-shrink-0 rounded-lg border border-slate-200 px-2.5 py-1.5 text-xs font-semibold text-slate-600 transition-colors hover:bg-slate-50 disabled:opacity-30 dark:border-slate-600 dark:text-slate-300 dark:hover:bg-white/5",disabled:c.value.matches.length===0,onClick:b},s.toDisplayString(s.unref(i)("editor.findReplace.replaceAll")),9,hC)])],8,aC)):s.createCommentVNode("",!0)}}),gC={class:"w-full max-w-md rounded-lg border border-slate-200 bg-white p-6 shadow-xl dark:border-slate-700 dark:bg-slate-800"},vC={class:"mb-4 flex items-center justify-between"},yC={class:"flex items-center gap-2 text-base font-semibold text-slate-900 dark:text-slate-100"},xC={class:"mb-4"},kC={class:"mb-1 block text-xs font-medium text-slate-600 dark:text-slate-400"},wC=["placeholder"],_C={class:"mb-2"},SC={class:"mb-1 block text-xs font-medium text-slate-600 dark:text-slate-400"},CC=["placeholder"],EC={key:0,class:"mt-1 text-[11px] text-red-600 dark:text-red-400"},NC={class:"flex items-center justify-end gap-2 pt-2"},AC=s.defineComponent({__name:"LinkDialog",props:{isOpen:{type:Boolean},initialText:{},initialUrl:{},isEditing:{type:Boolean}},emits:["apply","remove","close"],setup(e,{emit:t}){const{t:i}=rt(),n=e,r=t,a=s.ref(""),o=s.ref(""),l=s.ref("");s.watch(()=>n.isOpen,v=>{v&&(a.value=n.initialText??"",o.value=n.initialUrl??"https://",l.value="")});function c(){const v=o.value.trim();if(!v)return l.value=i("editor.linkDialog.urlRequired"),!1;if(/^(\/|#|mailto:|tel:)/.test(v))return l.value="",!0;try{return new URL(v),l.value="",!0}catch{return l.value=i("editor.linkDialog.urlInvalid"),!1}}function f(v){const b=v.trim();return/^(\/|#|mailto:|tel:)/.test(b)||/^https?:\/\//i.test(b)?b:`https://${b}`}function p(){c()&&r("apply",{text:a.value.trim(),url:f(o.value)})}function m(){r("remove")}function d(){r("close")}function h(v){v.key==="Escape"&&d()}return(v,b)=>e.isOpen?(s.openBlock(),s.createElementBlock("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:s.withModifiers(d,["self"]),onKeydown:h},[s.createElementVNode("div",gC,[s.createElementVNode("div",vC,[s.createElementVNode("h3",yC,[s.createVNode(s.unref(Zc),{class:"h-5 w-5 text-slate-500 dark:text-slate-400"}),s.createTextVNode(" "+s.toDisplayString(e.isEditing?s.unref(i)("editor.linkDialog.editTitle"):s.unref(i)("editor.linkDialog.insertTitle")),1)]),s.createElementVNode("button",{type:"button",class:"rounded-md p-1 text-sm text-slate-400 transition-all hover:bg-slate-100 hover:text-slate-600 dark:hover:bg-slate-700 dark:hover:text-slate-300",onClick:d},[s.createVNode(s.unref(Dt),{class:"h-4 w-4"})])]),s.createElementVNode("div",xC,[s.createElementVNode("label",kC,s.toDisplayString(s.unref(i)("editor.linkDialog.text")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":b[0]||(b[0]=y=>a.value=y),type:"text",placeholder:s.unref(i)("editor.linkDialog.textPlaceholder"),class:"w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-xs text-slate-700 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-300",onKeydown:s.withKeys(p,["enter"])},null,40,wC),[[s.vModelText,a.value]])]),s.createElementVNode("div",_C,[s.createElementVNode("label",SC,s.toDisplayString(s.unref(i)("editor.linkDialog.url")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":b[1]||(b[1]=y=>o.value=y),type:"text",placeholder:s.unref(i)("editor.linkDialog.urlPlaceholder"),class:"w-full rounded-md border border-slate-300 bg-white px-3 py-2 text-xs text-slate-700 dark:border-slate-600 dark:bg-slate-900 dark:text-slate-300",onKeydown:s.withKeys(p,["enter"])},null,40,CC),[[s.vModelText,o.value]]),l.value?(s.openBlock(),s.createElementBlock("p",EC,s.toDisplayString(l.value),1)):s.createCommentVNode("",!0)]),s.createElementVNode("div",NC,[e.isEditing?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"mr-auto flex items-center gap-1 rounded-md px-3 py-1.5 text-xs font-semibold text-red-600 hover:bg-red-50 dark:text-red-400 dark:hover:bg-red-950/40",onClick:m},[s.createVNode(s.unref(us),{class:"h-3.5 w-3.5"}),s.createTextVNode(" "+s.toDisplayString(s.unref(i)("editor.linkDialog.remove")),1)])):s.createCommentVNode("",!0),s.createElementVNode("button",{type:"button",class:"rounded-md px-3 py-1.5 text-xs font-semibold hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-700",onClick:d},s.toDisplayString(s.unref(i)("editor.linkDialog.cancel")),1),s.createElementVNode("button",{type:"button",class:"rounded-md bg-cyan-600 px-3 py-1.5 text-xs font-semibold text-white transition-all hover:bg-cyan-700",onClick:p},s.toDisplayString(e.isEditing?s.unref(i)("editor.linkDialog.update"):s.unref(i)("editor.linkDialog.insert")),1)])])],32)):s.createCommentVNode("",!0)}});async function Mc(e,t){var i,n;if(typeof document>"u")return!1;try{if(t&&typeof ClipboardItem<"u"&&((i=navigator.clipboard)!=null&&i.write)){const r=new ClipboardItem({"text/plain":new Blob([e],{type:"text/plain"}),"text/html":new Blob([t],{type:"text/html"})});return await navigator.clipboard.write([r]),!0}if((n=navigator.clipboard)!=null&&n.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{const r=document.createElement("textarea");r.value=e,r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select();const a=document.execCommand("copy");return r.remove(),a}catch{return!1}}async function OC(){var e;if(typeof navigator>"u"||!((e=navigator.clipboard)!=null&&e.read))return null;try{const t=await navigator.clipboard.read();for(const i of t)if(i.types.includes("text/html"))return await(await i.getType("text/html")).text();for(const i of t)if(i.types.includes("text/plain"))return await(await i.getType("text/plain")).text();return null}catch{return null}}async function wo(){var e;if(typeof navigator>"u"||!((e=navigator.clipboard)!=null&&e.readText))return null;try{return await navigator.clipboard.readText()}catch{return null}}const TC={class:"docs-editor flex h-screen w-full flex-col overflow-hidden bg-slate-50 transition-colors dark:bg-[#02040a]"},MC=["title","aria-label"],zC={class:"docs-editor__body relative flex flex-1 overflow-hidden"},IC=["title"],DC={class:"flex flex-1 flex-col items-center gap-4 w-full relative"},RC=["aria-label"],LC={key:5,class:"fixed inset-0 z-50 flex items-center justify-center bg-slate-900/50 backdrop-blur-sm px-4"},BC={class:"w-full max-w-lg rounded-xl border border-slate-200 bg-white p-6 shadow-2xl dark:border-slate-800 dark:bg-[#0e1525] text-slate-800 dark:text-slate-200"},PC={class:"text-lg font-bold mb-4"},VC={class:"mb-6"},FC={class:"flex justify-between items-center mb-2"},UC={class:"text-sm font-semibold text-slate-500 dark:text-slate-400"},HC={class:"grid grid-cols-2 gap-3"},jC={class:"text-[11px] font-medium block mb-1"},qC=["placeholder"],$C={class:"text-[11px] font-medium block mb-1"},WC=["placeholder"],GC={class:"rounded-lg bg-slate-50 p-3 text-[11px] text-slate-500 dark:bg-white/5 dark:text-slate-400 mb-6"},KC={class:"flex justify-end gap-2"},XC={key:6,class:"fixed inset-0 z-50 flex items-center justify-center bg-slate-900/40 backdrop-blur-sm px-4 select-none"},JC={class:"w-full max-w-sm rounded-3xl border border-slate-100 bg-white p-7 shadow-2xl dark:border-slate-800 dark:bg-[#0e1525] text-slate-800 dark:text-slate-200"},ZC={class:"text-xl font-medium mb-6 text-slate-900 dark:text-white"},QC={class:"mb-6"},YC={class:"text-xs font-semibold text-slate-700 dark:text-slate-300 mb-3"},eE={class:"space-y-4"},tE={class:"text-xs font-medium text-slate-600 dark:text-slate-400 block mb-1.5"},iE={class:"text-xs font-medium text-slate-600 dark:text-slate-400 block mb-1.5"},nE={class:"mb-8"},rE={class:"text-xs font-semibold text-slate-700 dark:text-slate-300 mb-3"},aE={class:"space-y-3"},oE={class:"flex items-center gap-3 cursor-pointer text-xs font-medium text-slate-700 dark:text-slate-300 select-none"},sE={class:"flex items-center gap-3 cursor-pointer text-xs font-medium text-slate-700 dark:text-slate-300 select-none"},lE={class:"flex justify-end items-center gap-3"},cE={key:7,class:"fixed inset-0 z-50 flex items-center justify-center bg-slate-900/40 backdrop-blur-sm px-4 select-none"},uE={class:"w-full max-w-sm rounded-3xl border border-slate-100 bg-white p-7 shadow-2xl dark:border-slate-800 dark:bg-[#0e1525] text-slate-800 dark:text-slate-200"},fE={class:"text-xl font-medium mb-6 text-slate-900 dark:text-white"},pE={class:"mb-6"},dE={class:"text-xs font-semibold text-slate-700 dark:text-slate-300 mb-3"},mE={class:"space-y-3"},hE={class:"flex items-center gap-3 cursor-pointer text-xs font-medium text-slate-700 dark:text-slate-300 select-none"},bE={class:"flex items-center gap-3 cursor-pointer text-xs font-medium text-slate-700 dark:text-slate-300 select-none"},gE={class:"flex items-center gap-3 cursor-pointer text-xs font-medium text-slate-700 dark:text-slate-300 select-none pt-1"},vE={class:"mb-8"},yE={class:"text-xs font-semibold text-slate-700 dark:text-slate-300 mb-3"},xE={class:"space-y-3"},kE={class:"flex items-center gap-3"},wE={class:"flex items-center gap-3 cursor-pointer text-xs font-medium text-slate-700 dark:text-slate-300 select-none"},_E={class:"flex items-center gap-3 cursor-pointer text-xs font-medium text-slate-700 dark:text-slate-300 select-none"},SE={class:"flex justify-end items-center gap-3"},CE={key:8,class:"fixed inset-0 z-50 flex items-center justify-center bg-slate-900/50 backdrop-blur-sm px-4"},EE={class:"w-full max-w-md rounded-xl border border-slate-200 bg-white p-6 shadow-2xl dark:border-slate-800 dark:bg-[#0e1525] text-slate-800 dark:text-slate-200"},NE={class:"text-lg font-bold mb-4"},AE={class:"mb-4"},OE={class:"block text-xs font-semibold text-slate-600 dark:text-slate-400 mb-1.5"},TE=["value"],ME={class:"mb-4"},zE={class:"block text-xs font-semibold text-slate-600 dark:text-slate-400 mb-1.5"},IE={class:"flex gap-2"},DE={class:"mb-6"},RE={class:"block text-xs font-semibold text-slate-600 dark:text-slate-400 mb-1.5"},LE={class:"grid grid-cols-2 gap-3"},BE={class:"text-[11px] text-slate-500 dark:text-slate-400 block mb-1"},PE=["max"],VE={class:"text-[11px] text-slate-500 dark:text-slate-400 block mb-1"},FE=["max"],UE={class:"text-[11px] text-slate-500 dark:text-slate-400 block mb-1"},HE=["max"],jE={class:"text-[11px] text-slate-500 dark:text-slate-400 block mb-1"},qE=["max"],$E={class:"flex justify-end gap-2"},WE=189,Sn=37.795,_o=0,So=5,zc=.1,tn=0,GE=s.defineComponent({__name:"DocsEditor",props:{modelValue:{default:void 0},plugins:{default:()=>[]},editable:{type:Boolean,default:!0},collaboration:{default:void 0},pageSize:{default:"a4"},pageless:{type:Boolean,default:!1},virtualPages:{type:Boolean,default:!1},title:{default:"Untitled Document"},collaborators:{default:()=>[]},starred:{type:Boolean,default:!1},connectionState:{default:"connected"},userName:{default:""},userAvatar:{default:""},locale:{default:void 0},documentMeta:{default:void 0},shareUrl:{default:""},onImageUpload:{type:Function,default:void 0},citation:{default:void 0},aiStream:{type:Function,default:void 0},aiDraft:{type:Function,default:void 0},debug:{type:Boolean,default:!1},comments:{default:()=>[]},selectedTextSnippet:{default:""},selectedTextIndex:{default:void 0},snapshots:{default:()=>[]},activePreviewIndex:{default:null},orientation:{default:"portrait"},margins:{default:()=>({top:94,bottom:94,left:94,right:94})},headerMarginCm:{default:.5},footerMarginCm:{default:.5}},emits:["update:modelValue","update:title","update:pageSize","update:orientation","update:margins","update:header-footer-margins","update:pageless","update:pageCount","update:locale","citation-sources-change","update:citation-style","toggle-star","back","share","menu-click","export","ready","add-comment","add-reply","resolve-comment","delete-comment","save-snapshot","restore-snapshot","preview-snapshot"],setup(e,{emit:t}){var el,tl,il,nl,rl;const i=e,n=t,{locale:r,setLocale:a,t:o}=Fc(i.locale);s.watch(()=>i.locale,N=>{N&&N!==r.value&&a(N)}),s.watch(r,N=>{n("update:locale",N)});const l=s.ref({top:((el=i.margins)==null?void 0:el.top)??94,bottom:((tl=i.margins)==null?void 0:tl.bottom)??94,left:((il=i.margins)==null?void 0:il.left)??94,right:((nl=i.margins)==null?void 0:nl.right)??94});function c(N,A=.5){const z=typeof N=="number"?N:Number(N);if(!Number.isFinite(z))return A;const le=Math.min(So,Math.max(_o,z));return Math.round(le*10)/10}const f=s.ref(i.orientation??"portrait"),p=s.ref(i.pageSize??"a4"),m=s.ref(i.pageless??!1);s.watch(()=>i.orientation,N=>{N!==void 0&&(f.value=N)}),s.watch(()=>i.margins,N=>{N!==void 0&&(l.value={...N})}),s.watch(()=>i.headerMarginCm,N=>{typeof N=="number"&&Number.isFinite(N)&&(Wt.value=c(N))}),s.watch(()=>i.footerMarginCm,N=>{typeof N=="number"&&Number.isFinite(N)&&(Gt.value=c(N))});const d=s.computed(()=>{const N=Cn.getPageSize(p.value)??Cn.PAGE_SIZES[0];let A=N.pageWidth,z=N.pageHeight;return f.value==="landscape"&&([A,z]=[z,A]),{pageHeight:z,pageWidth:A,margins:{...l.value}}}),h=s.computed(()=>`${d.value.pageWidth}px`),{isDark:v}=Ba(),b=s.computed(()=>i.virtualPages===!0),y=s.computed(()=>({enabled:!m.value&&!b.value,pageHeight:d.value.pageHeight,pageWidth:d.value.pageWidth,marginTop:d.value.margins.top,marginBottom:d.value.margins.bottom,marginLeft:d.value.margins.left,marginRight:d.value.margins.right,contentMarginTop:0,contentMarginBottom:0,pageGap:40,pageBreakBackground:v.value?"#02040a":"#f1f5f9",headerLeft:"",headerRight:"",footerLeft:"",footerRight:"",onHeaderClick:N=>{gr(N==null?void 0:N.event)},onFooterClick:N=>{N!=null&&N.event&&N.event.detail!==2||vr()}})),x=(N=>{const A=N;return A&&typeof A=="object"&&A.type==="tabbed-doc"&&Array.isArray(A.tabs)?A:{type:"tabbed-doc",activeTabId:"tab-1",tabs:[{id:"tab-1",label:"Tab 1",content:N||{type:"doc",content:[{type:"paragraph"}]}}]}})(i.modelValue),k=s.ref(x.headerLeft||""),w=s.ref(x.headerRight||""),C=s.ref(x.footerLeft||""),E=s.ref(x.footerRight||""),B=s.ref(x.tabs.map(N=>({id:N.id,label:N.label,active:N.id===x.activeTabId}))),_=s.ref({});x.tabs.forEach(N=>{_.value[N.id]=N.content});const S=s.ref(x.activeTabId),T=s.computed(()=>_.value[S.value]),D=s.ref(!1),H=s.ref(null),V=s.ref(null),M=s.ref(localStorage.getItem("docflow:view:showRuler")!=="false"),$=s.ref(!1);s.watch(M,N=>{localStorage.setItem("docflow:view:showRuler",N?"true":"false")});const P=s.ref(0),W=s.ref(0),L=s.ref("saved"),Q=s.ref(Date.now()),j=s.ref(null),O=s.ref(new Set);let R=null;const U=s.ref(!1);function oe(){if(!G.value||!we.value)return;const N=G.value.state.doc;if(i.collaboration&&!U.value&&N.content.size<=2)return;U.value=!0;const A=new Set;N.descendants(z=>{for(const le of z.marks)le.type.name==="comment"&&le.attrs.threadId&&A.add(le.attrs.threadId);return!0}),O.value=A}function ie(){R&&clearTimeout(R),R=setTimeout(oe,200)}const ee=s.computed(()=>{if(!U.value)return[];const N=O.value;return(i.comments??[]).filter(A=>A.anchorIndex!=null&&!N.has(A.id)).map(A=>A.id)});s.onUnmounted(()=>{R&&clearTimeout(R)});const te=s.computed(()=>{const N=[];for(const A of i.plugins)for(const z of A.slashCommands||[])N.push({name:z.name,command:z.command});return N}),X=()=>{const N={type:"tabbed-doc",activeTabId:S.value,tabs:B.value.map(A=>({id:A.id,label:A.label,content:_.value[A.id]})),headerLeft:k.value,headerRight:w.value,footerLeft:C.value,footerRight:E.value};n("update:modelValue",N),L.value="saving",j.value&&clearTimeout(j.value),j.value=setTimeout(()=>{L.value="saved",Q.value=Date.now()},800)},F=s.ref((()=>{var A;const N=(A=i.citation)==null?void 0:A.sources;return Array.isArray(N)?[...N]:typeof N=="function"?[...N()]:[]})()),q=s.ref(((rl=i.citation)==null?void 0:rl.style)||"chicago-notes-bibliography");let ne=null;const se=s.ref(!1),Se=N=>{ne==null||ne(N),ne=null,se.value=!1},Ae=()=>new Promise(N=>{Se(null),ne=N,se.value=!0,V.value="references"}),fe=s.computed(()=>{const N=i.citation;if(N)return{...N,sources:()=>F.value,onSourceRequest:N.onSourceRequest??Ae}}),{editorRef:ke,editor:G,pluginActions:yt,isReady:we,docsEditor:At}=Ic({content:T,plugins:i.plugins,editable:i.editable,collaboration:i.collaboration,onImageUpload:i.onImageUpload,citation:fe.value,aiStream:i.aiStream,aiDraft:i.aiDraft,debug:i.debug,getPageMap:()=>new Map,paginationOptions:y.value,onUpdate:N=>{_.value[S.value]=N,X()}}),K=()=>{var N,A,z;return((z=(A=(N=G.value)==null?void 0:N.storage)==null?void 0:A.citation)==null?void 0:z.engine)??null},I=()=>{var N;(N=K())==null||N.updateSources(F.value),n("citation-sources-change",F.value)},J=N=>{F.value=[...F.value,N],I()},ze=N=>{F.value=F.value.map(A=>A.id===N.id?N:A),I()},Ue=N=>{F.value=F.value.filter(A=>A.id!==N),I()},qe=N=>{var A;q.value=N,(A=K())==null||A.setStyle(N),n("update:citation-style",N)},jt=N=>{var A,z;ne?(Se(N),V.value=null):(z=(A=yt.value).insertCitation)==null||z.call(A,{sourceId:N})};s.watch(V,(N,A)=>{A==="references"&&N!=="references"&&Se(null)});const pt=s.ref(!1),dt=s.ref(""),Ot=s.computed(()=>{var N,A;return!!((N=i.citation)!=null&&N.onImportDoi||(A=i.citation)!=null&&A.onImportBibliography)}),ri=async N=>{const A=i.citation;if(!(!(A!=null&&A.onImportDoi)||pt.value)){pt.value=!0,dt.value="";try{const z=await A.onImportDoi(N);if(!z){dt.value=o("sidebars.references.import.doiFailed");return}const le=F.value.some(ue=>ue.id===z.id);F.value=le?F.value.map(ue=>ue.id===z.id?z:ue):[...F.value,z],I(),dt.value=o("sidebars.references.import.doiSuccess")}catch{dt.value=o("sidebars.references.import.doiFailed")}finally{pt.value=!1}}},Xe=async N=>{const A=i.citation;if(!(!(A!=null&&A.onImportBibliography)||pt.value)){pt.value=!0,dt.value="";try{const{imported:z,failed:le}=await A.onImportBibliography(N);if(z.length>0){const ue=new Map(F.value.map(xe=>[xe.id,xe]));for(const xe of z)ue.set(xe.id,xe);F.value=[...ue.values()],I()}dt.value=le>0?o("sidebars.references.import.partial").replace("{ok}",String(z.length)).replace("{failed}",String(le)):o("sidebars.references.import.batchSuccess").replace("{count}",String(z.length))}catch{dt.value=o("sidebars.references.import.failed")}finally{pt.value=!1}}},Si=()=>{var A;const N=((A=G.value)==null?void 0:A.getText())??"";W.value=N.length,P.value=N.trim()?N.trim().split(/\s+/).length:0},dn=()=>{if(!G.value)return null;const{from:N,to:A,head:z}=G.value.state.selection;if(N===A)return null;const le=G.value.view.coordsAtPos(z);if(!le)return null;const ue=12,xe=180,Oe=le.top-48,Ee=(le.left+le.right)/2;if(typeof window>"u")return{top:Math.max(ue,Oe),left:Ee};const me=Math.min(xe,Math.max(0,window.innerWidth/2-ue)),pe=ue+me,ce=window.innerWidth-ue-me,be=Math.max(ue,window.innerHeight-48);return{top:Math.min(be,Math.max(ue,Oe)),left:Math.min(ce,Math.max(pe,Ee))}},mn=()=>{if(!G.value){D.value=!1,H.value=null;return}const{from:N,to:A}=G.value.state.selection;D.value=N!==A,H.value=N!==A?dn():null},Ci=s.ref(null);let ai=null;const Wa=()=>{G.value&&(ai&&clearTimeout(ai),ai=setTimeout(()=>{G.value&&G.value.view.dispatch(G.value.state.tr)},150))},qt=s.ref(1),mt=s.ref(1),Tt=s.computed(()=>{const N=d.value;return{pageSize:{id:p.value,name:p.value.toUpperCase(),pageWidth:N.pageWidth,pageHeight:N.pageHeight},margins:{top:N.margins.top,bottom:N.margins.bottom,left:N.margins.left,right:N.margins.right},pageGap:40,headerLeft:k.value,headerRight:w.value,footerLeft:C.value,footerRight:E.value}}),{data:hn,totalPages:Mt,isReady:Ei,refreshData:Ga}=Dp({editorRef:s.computed(()=>G.value),scrollRef:Ci,config:Tt.value,bufferPages:2});s.watch([Mt,Ei],()=>{b.value&&Ei.value&&(qt.value=Mt.value)}),s.watch(b,N=>{N&&Ga()});const $t=()=>{if(!G.value||!we.value){qt.value=1,mt.value=1;return}const N=G.value.view.dom,A=N.querySelector("[data-rm-pagination]");A?qt.value=A.children.length||1:qt.value=1;try{const{selection:z}=G.value.state,le=G.value.view.coordsAtPos(z.head);if(le&&A){const ue=Array.from(A.querySelectorAll(".rm-page-break")),xe=N.getBoundingClientRect(),Oe=le.top-xe.top+N.scrollTop;let Ee=1,me=!1;for(let pe=0;pe<ue.length;pe++){const ce=ue[pe].querySelector(".breaker");if(ce instanceof HTMLElement&&Oe<ce.offsetTop){mt.value=Ee,me=!0;break}Ee++}me||(mt.value=Ee)}else mt.value=1}catch{mt.value=1}};s.watch(d,N=>{G.value&&(G.value.commands.updatePageHeight(N.pageHeight),G.value.commands.updatePageWidth(N.pageWidth),G.value.commands.updateMargins({top:N.margins.top,bottom:N.margins.bottom,left:N.margins.left,right:N.margins.right}),$t())});const oi=N=>{N!==m.value&&(m.value=N,n("update:pageless",N),G.value&&(N?G.value.commands.disablePagination():G.value.commands.enablePagination(),setTimeout(()=>{$t(),Oi()},60)))};s.watch(()=>i.pageless,N=>oi(N??!1));const zt=s.ref(!1),si=s.ref(!1),st=s.ref(""),lt=s.ref(""),li=s.ref(""),Yn=s.ref(""),Wt=s.ref(c(i.headerMarginCm)),Gt=s.ref(c(i.footerMarginCm)),er=s.ref(!1),bn=s.ref(Wt.value),gn=s.ref(Gt.value),tr=s.ref(!1),ir=s.ref(!1),nr=s.ref(!1),rr=s.ref("header"),ar=s.ref(!0),or=s.ref("startAt"),sr=s.ref(1),Gi=s.ref("header"),lr=s.ref(!0),Ki=s.ref("startAt"),cr=s.ref(1),Ka=N=>{if(!ar.value&&N===0)return"";let A=N+1;return or.value==="startAt"&&(A=N+sr.value),String(A)},It=()=>{if(!G.value||!we.value)return;const N=String(qt.value),A=G.value.view.dom,z=k.value.replace(/{total}/g,N),le=w.value.replace(/{total}/g,N),ue=C.value.replace(/{total}/g,N),xe=E.value.replace(/{total}/g,N);G.value.commands.updateHeaderContent(z,le),G.value.commands.updateFooterContent(ue,xe);const Oe=`${Math.max(0,Wt.value)*Sn}px`,Ee=`${Math.max(0,Gt.value)*Sn}px`;A.style.setProperty("--rm-header-margin-top",Oe),A.style.setProperty("--rm-footer-margin-bottom",Ee),G.value.view.dispatch(G.value.state.tr),setTimeout(()=>{requestAnimationFrame(()=>{if(!G.value||G.value.view.dom!==A)return;const me=(be,Ne)=>{let Ce=z,Me=le;return Ne&&zt.value?(Ce=st.value.replace(/{total}/g,N),Me=lt.value.replace(/{total}/g,N)):si.value&&be%2===0&&(Ce=li.value.replace(/{total}/g,N),Me=Yn.value.replace(/{total}/g,N)),{left:Ce.replace(/{page}/g,Ka(be-1)),right:Me.replace(/{page}/g,Ka(be-1))}},pe=(be,Ne,Ce)=>{const Me=me(Ne,Ce),Te=be.querySelector(".rm-page-header-left"),Le=be.querySelector(".rm-page-header-right");Te&&(Te.innerHTML=Me.left),Le&&(Le.innerHTML=Me.right)},ce=A.querySelector(".rm-first-page-header");ce&&pe(ce,1,!0),Array.from(A.querySelectorAll(".rm-page-break .rm-page-header")).forEach((be,Ne)=>{pe(be,Ne+2,!1)}),Array.from(A.querySelectorAll(".rm-page-break .rm-page-footer")).forEach((be,Ne)=>{const Ce=Ne+1,Me=Ka(Ce-1),Te=be.querySelector(".rm-page-footer-left"),Le=be.querySelector(".rm-page-footer-right");Te&&(Te.innerHTML=ue.replace(/{page}/g,Me)),Le&&(Le.innerHTML=xe.replace(/{page}/g,Me))})})},50)};s.watch(zt,()=>{It()}),s.watch([si,Wt,Gt,rr,ar,or,sr],()=>{It()}),s.watch(qt,N=>{It(),n("update:pageCount",N)}),s.watch(v,N=>{G.value&&(G.value.commands.updatePageBreakBackground(N?"#02040a":"#f1f5f9"),G.value.view.dispatch(G.value.state.tr))}),s.watch(y,N=>{if(!G.value||!we.value)return;const A=G.value.storage.PaginationPlus;!A||!(A.pageHeight!==N.pageHeight||A.pageWidth!==N.pageWidth||A.marginTop!==N.marginTop||A.marginBottom!==N.marginBottom||A.marginLeft!==N.marginLeft||A.marginRight!==N.marginRight||A.pageGap!==N.pageGap||A.contentMarginTop!==N.contentMarginTop||A.contentMarginBottom!==N.contentMarginBottom||A.pageBreakBackground!==N.pageBreakBackground||A.enabled!==N.enabled)||(A.pageHeight=N.pageHeight,A.pageWidth=N.pageWidth,A.marginTop=N.marginTop,A.marginBottom=N.marginBottom,A.marginLeft=N.marginLeft,A.marginRight=N.marginRight,A.pageGap=N.pageGap,A.contentMarginTop=N.contentMarginTop,A.contentMarginBottom=N.contentMarginBottom,A.pageBreakBackground=N.pageBreakBackground,A.enabled=N.enabled,G.value.view.dispatch(G.value.state.tr))},{deep:!0}),s.watch(we,N=>{var A,z,le,ue,xe,Oe,Ee,me;N&&G.value&&(!k.value&&!w.value&&!C.value&&!E.value&&(k.value=((z=(A=G.value.storage.PaginationPlus)==null?void 0:A.appliedConfig)==null?void 0:z.headerLeft)||"",w.value=((ue=(le=G.value.storage.PaginationPlus)==null?void 0:le.appliedConfig)==null?void 0:ue.headerRight)||"",C.value=((Oe=(xe=G.value.storage.PaginationPlus)==null?void 0:xe.appliedConfig)==null?void 0:Oe.footerLeft)||"",E.value=((me=(Ee=G.value.storage.PaginationPlus)==null?void 0:Ee.appliedConfig)==null?void 0:me.footerRight)||""),It(),At.value&&n("ready",At.value),G.value.on("selectionUpdate",()=>{mn(),$t()}),G.value.on("transaction",()=>{$t(),Si(),ie()}),mn(),Si(),$t(),ie(),setTimeout(()=>{var ce;return(ce=G.value)==null?void 0:ce.commands.focus("start")},50),[100,300,600,1200,2500].forEach(ce=>{setTimeout(()=>{G.value&&G.value.view.dispatch(G.value.state.tr)},ce)}),G.value.view.dom.addEventListener("keydown",ce=>{(ce.metaKey||ce.ctrlKey)&&ce.key.toLowerCase()==="k"&&(ce.preventDefault(),Ws())}),G.value.view.dom.addEventListener("click",ce=>{const be=ce.target;if(!be||be.closest('.rm-google-docs-header-bar, .rm-options-dropdown, [contenteditable="true"]'))return;if(be.closest(".rm-page-header, .rm-first-page-header")){gr(ce);return}const Ce=be.closest(".rm-with-pagination, .rm-page-break, .page, .docs-editor-page");if(Ce){const Me=Ce.getBoundingClientRect(),Te=ce.clientY-Me.top,Le=Wt.value*37.795;if(Te>=0&&Te<=Math.max(Le,40)+15){let Je=null;Ce.classList.contains("rm-page-break")&&(Je=Ce.querySelector(".rm-page-header")),Je||(Je=document.querySelector(".rm-page-header, .rm-first-page-header")),Je&&gr(ce)}}}),G.value.view.dom.addEventListener("dblclick",ce=>{const be=ce.target;if(!be)return;if(be.closest(".rm-page-footer")){vr();return}const Ce=be.closest(".rm-with-pagination, .rm-page-break, .page, .docs-editor-page");if(Ce){const Te=Ce.getBoundingClientRect().bottom-ce.clientY,Le=Gt.value*37.795;Te>=0&&Te<=Math.max(Le,40)+15&&vr()}}))}),s.watch(()=>i.collaboration,()=>{},{deep:!0}),s.onUnmounted(()=>{ui(!1),j.value&&clearTimeout(j.value),ai&&clearTimeout(ai)});const ur=s.ref(!1),vn=s.ref(""),yn=s.ref(""),fr=s.ref(!1),Xa=s.ref(!1),Ja=s.ref(!1),pr=s.ref(!1),xn=s.ref(!1),dr=s.ref(""),Za=s.ref(""),mr=s.ref(!1);function Ws(){if(!G.value)return;const{state:N}=G.value,{from:A,to:z,empty:le}=N.selection,ue=G.value.getAttributes("link");ue.href?(mr.value=!0,Za.value=ue.href,le?dr.value="":dr.value=N.doc.textBetween(A,z," ")):(mr.value=!1,Za.value="https://",dr.value=le?"":N.doc.textBetween(A,z," ")),xn.value=!0}function fp(N){if(!G.value)return;const{state:A}=G.value,{from:z,to:le,empty:ue}=A.selection,xe=N.text.trim(),Oe=G.value.chain().focus();mr.value||G.value.isActive("link")?(Oe.setLink({href:N.url,target:"_blank"}).run(),xe&&!ue&&Oe.insertContentAt({from:z,to:le},xe).run()):xe?Oe.insertContentAt({from:z,to:le},{type:"text",text:xe,marks:[{type:"link",attrs:{href:N.url,target:"_blank"}}]}).run():ue?Oe.insertContent({type:"text",text:N.url,marks:[{type:"link",attrs:{href:N.url,target:"_blank"}}]}).run():Oe.setLink({href:N.url,target:"_blank"}).run(),xn.value=!1}function pp(){if(!G.value)return;G.value.chain().focus().unsetLink().run(),xn.value=!1}const hr=s.ref(p.value),Ni=s.ref(f.value),$e=s.ref({top:ci(l.value.top),bottom:ci(l.value.bottom),left:ci(l.value.left),right:ci(l.value.right)}),kn=Number((WE/Sn).toFixed(1));function ci(N){return Math.round(N/Sn*10)/10}function br(N){return Math.round(N*Sn)}const dp=()=>{hr.value=p.value,Ni.value=f.value,$e.value={top:ci(l.value.top),bottom:ci(l.value.bottom),left:ci(l.value.left),right:ci(l.value.right)},fr.value=!0},mp=()=>{const N=A=>{const z=typeof A=="number"?A:Number(A);return Number.isFinite(z)?Math.min(kn,Math.max(tn,z)):tn};p.value=hr.value,f.value=Ni.value,$e.value={top:N($e.value.top),bottom:N($e.value.bottom),left:N($e.value.left),right:N($e.value.right)},l.value={top:br($e.value.top),bottom:br($e.value.bottom),left:br($e.value.left),right:br($e.value.right)},n("update:pageSize",p.value),n("update:orientation",Ni.value),n("update:margins",{...l.value}),fr.value=!1},Qa=s.ref(!1),Ai={value:null},hp=()=>{bn.value=Wt.value,gn.value=Gt.value,tr.value=zt.value,ir.value=si.value,er.value=!0},bp=()=>{Wt.value=c(bn.value),Gt.value=c(gn.value),bn.value=Wt.value,gn.value=Gt.value,zt.value=tr.value,si.value=ir.value,er.value=!1,It(),n("update:header-footer-margins",{headerMarginCm:Wt.value,footerMarginCm:Gt.value}),X()},gp=()=>{Gi.value=rr.value,lr.value=ar.value,Ki.value=or.value,cr.value=sr.value,nr.value=!0},vp=()=>{rr.value=Gi.value,ar.value=lr.value,or.value=Ki.value,sr.value=cr.value,nr.value=!1;const N="{page}";rr.value==="footer"?(w.value.includes(N)&&(w.value=w.value.replace(/{page}/g,"").trim()),E.value=N):(E.value.includes(N)&&(E.value=E.value.replace(/{page}/g,"").trim()),w.value=N),It(),X()},yp=()=>{k.value="",w.value="",It(),X(),Qa.value=!1},xp=N=>{const A=N===1,z=N%2===0;return zt.value&&A?st.value:si.value&&z?li.value:k.value},ui=(N=!0)=>{var le;const A=Ai.value;if(!A)return;const z=A.input.innerHTML.trim();document.removeEventListener("mousedown",A.onOutsideMouseDown),window.removeEventListener("resize",A.onResize),window.removeEventListener("scroll",A.onWindowScroll),(le=Ci.value)==null||le.removeEventListener("scroll",A.onScroll),A.overlay.remove(),A.generatedContent&&(A.generatedContent.style.visibility=""),A.targetHeader.classList.remove("rm-header-active"),Ai.value=null,Qa.value=!1,N&&(zt.value&&A.isFirstPage?st.value=z:si.value&&A.pageIndex%2===0?li.value=z:k.value=z,It(),X())},Gs=N=>{if(!N.targetHeader.parentNode||!G.value)return;const A=G.value.view.dom,z=N.targetHeader.getBoundingClientRect(),le=A.getBoundingClientRect(),ue=getComputedStyle(A),xe=parseFloat(ue.getPropertyValue("--rm-margin-left"))||0,Oe=parseFloat(ue.getPropertyValue("--rm-margin-right"))||0,Ee=N.targetHeader.querySelector(".rm-page-header-content"),me=(Ee==null?void 0:Ee.getBoundingClientRect())??z,pe=N.isFirstPage?z.left:z.left+xe,ce=N.isFirstPage?z.right:z.right-Oe,be=Math.max(0,pe-le.left),Ne=Math.max(0,le.right-ce);N.overlay.style.left=`${pe}px`,N.overlay.style.top=`${me.top}px`,N.overlay.style.width=`${Math.max(ce-pe,1)}px`,N.overlay.style.height=`${Math.max(me.height,24)}px`,N.activeBar.style.setProperty("--rm-header-bar-left",`${-be}px`),N.activeBar.style.setProperty("--rm-header-bar-width",`${le.width}px`),N.activeBar.style.setProperty("--rm-header-bar-padding-left",`${be}px`),N.activeBar.style.setProperty("--rm-header-bar-padding-right",`${Ne}px`)},gr=N=>{var al,ol;const A=Ai.value;if(A){const ge=N==null?void 0:N.target;if(!ge||ge instanceof Node&&A.targetHeader.contains(ge))return;ui(!1)}let z=null;if(N){const ge=N.target;z=ge==null?void 0:ge.closest(".rm-page-header, .rm-first-page-header")}if(z||(z=(al=G.value)==null?void 0:al.view.dom.querySelector(".rm-first-page-header, .rm-page-header")),!z||!G.value)return;const le=G.value.view.dom,ue=z.classList.contains("rm-first-page-header"),xe=Array.from(le.querySelectorAll(".rm-page-break .rm-page-header")),Oe=ue?1:xe.indexOf(z)+2;if(!ue&&Oe<2)return;const Ee=z.querySelector(".rm-page-header-content");Ee&&(Ee.style.visibility="hidden");const me=document.createElement("div");me.className="rm-header-edit-input",me.contentEditable="true",me.setAttribute("role","textbox"),me.setAttribute("aria-label",o("editor.headerFooter.header")||"Header"),me.dataset.placeholder=o("editor.headerFooter.headerPlaceholder")||"Header",me.innerHTML=xp(Oe);const pe=document.createElement("div");pe.className="rm-header-edit-overlay",pe.appendChild(me);const ce=document.createElement("div");ce.className="rm-google-docs-header-bar",ce.innerHTML=`
15057
15057
  <span class="rm-header-label">${o("editor.headerFooter.header")||"Header"}</span>
15058
15058
  <div class="rm-header-right-tools">
15059
15059
  <label class="rm-diff-label">
@@ -15072,6 +15072,6 @@
15072
15072
  </div>
15073
15073
  </div>
15074
15074
  </div>
15075
- `,pe.appendChild(ce),document.body.appendChild(pe),z.classList.add("rm-header-active");const be=()=>{const ge=Ai.value;ge&&Gs(ge)},Ne=be,Ce=be,Me=ge=>{const Kt=ge.target;Kt instanceof Node&&pe.contains(Kt)||Kt instanceof Element&&Kt.closest(".fixed.z-50")||ui(!0)},Te=()=>{requestAnimationFrame(()=>{const ge=Ai.value;ge&&!ge.overlay.contains(document.activeElement)&&ui(!0)})},Le={targetHeader:z,overlay:pe,input:me,activeBar:ce,generatedContent:Ee,isFirstPage:ue,pageIndex:Oe,onOutsideMouseDown:Me,onInputBlur:Te,onResize:be,onScroll:Ne,onWindowScroll:Ce};Ai.value=Le,Qa.value=!0;const Je=ce.querySelector(".rm-diff-cb");Je==null||Je.addEventListener("mousedown",ge=>{ge.stopPropagation()}),Je==null||Je.addEventListener("change",ge=>{ge.stopPropagation();const Kt=ge.target.checked;ui(!0),Kt&&(st.value="",lt.value=""),zt.value=Kt,It()});const St=ce.querySelector(".rm-options-btn"),Ti=ce.querySelector(".rm-options-dropdown"),xr=ce.querySelector(".rm-arrow-icon");St==null||St.addEventListener("mousedown",ge=>{ge.stopPropagation(),ge.preventDefault()}),St==null||St.addEventListener("click",ge=>{ge.stopPropagation(),ge.preventDefault();const Kt=(Ti==null?void 0:Ti.classList.toggle("is-open"))??!1;xr&&(xr.textContent=Kt?"▲":"▼")});const Xi=ce.querySelector(".rm-opt-format");Xi==null||Xi.addEventListener("mousedown",ge=>{ge.stopPropagation(),ge.preventDefault()}),Xi==null||Xi.addEventListener("click",ge=>{ge.stopPropagation(),ui(!0),hp()});const Ji=ce.querySelector(".rm-opt-page-num");Ji==null||Ji.addEventListener("mousedown",ge=>{ge.stopPropagation(),ge.preventDefault()}),Ji==null||Ji.addEventListener("click",ge=>{ge.stopPropagation(),ui(!0),gp()});const Zi=ce.querySelector(".rm-opt-remove");Zi==null||Zi.addEventListener("mousedown",ge=>{ge.stopPropagation(),ge.preventDefault()}),Zi==null||Zi.addEventListener("click",ge=>{ge.stopPropagation(),ui(!1),yp()}),me.addEventListener("blur",Te),document.addEventListener("mousedown",Me),window.addEventListener("resize",be),window.addEventListener("scroll",Ce),(ol=Ci.value)==null||ol.addEventListener("scroll",Ne),requestAnimationFrame(()=>{Ai.value===Le&&Gs(Le)}),me.focus();const Qi=window.getSelection(),Ya=document.createRange();Ya.selectNodeContents(me),Ya.collapse(!1),Qi==null||Qi.removeAllRanges(),Qi==null||Qi.addRange(Ya)},vr=()=>{var N,A,z,le;G.value&&(vn.value=C.value||((A=(N=G.value.storage.PaginationPlus)==null?void 0:N.appliedConfig)==null?void 0:A.footerLeft)||"",yn.value=E.value||((le=(z=G.value.storage.PaginationPlus)==null?void 0:z.appliedConfig)==null?void 0:le.footerRight)||"",ur.value=!0)},kp=()=>{G.value&&(C.value=vn.value,E.value=yn.value,It(),X(),ur.value=!1)},ht=(N,...A)=>{if(!G.value)return;const z=G.value.commands[N];typeof z=="function"&&z(...A),G.value.commands.focus()},Gt=(N,...A)=>{if(!G.value)return;const z=yt.value[N];if(typeof z=="function")z(...A);else{ht(N,...A);return}G.value.commands.focus()},Ks=N=>{const A=N==="header"?w:E;A.value.includes("{page}")||(A.value=A.value?`${A.value} {page}`:"{page}"),It(),X()},Xs=()=>{if(!G.value)return null;const{state:N}=G.value;if(N.selection.empty)return null;const A=N.selection.content(),z=document.createElement("div");return z.appendChild(Kn.fromSchema(N.schema).serializeFragment(A.content)),{html:z.innerHTML,text:A.content.textBetween(0,A.content.size,`
15075
+ `,pe.appendChild(ce),document.body.appendChild(pe),z.classList.add("rm-header-active");const be=()=>{const ge=Ai.value;ge&&Gs(ge)},Ne=be,Ce=be,Me=ge=>{const Kt=ge.target;Kt instanceof Node&&pe.contains(Kt)||Kt instanceof Element&&Kt.closest(".fixed.z-50")||ui(!0)},Te=()=>{requestAnimationFrame(()=>{const ge=Ai.value;ge&&!ge.overlay.contains(document.activeElement)&&ui(!0)})},Le={targetHeader:z,overlay:pe,input:me,activeBar:ce,generatedContent:Ee,isFirstPage:ue,pageIndex:Oe,onOutsideMouseDown:Me,onInputBlur:Te,onResize:be,onScroll:Ne,onWindowScroll:Ce};Ai.value=Le,Qa.value=!0;const Je=ce.querySelector(".rm-diff-cb");Je==null||Je.addEventListener("mousedown",ge=>{ge.stopPropagation()}),Je==null||Je.addEventListener("change",ge=>{ge.stopPropagation();const Kt=ge.target.checked;ui(!0),Kt&&(st.value="",lt.value=""),zt.value=Kt,It()});const St=ce.querySelector(".rm-options-btn"),Ti=ce.querySelector(".rm-options-dropdown"),xr=ce.querySelector(".rm-arrow-icon");St==null||St.addEventListener("mousedown",ge=>{ge.stopPropagation(),ge.preventDefault()}),St==null||St.addEventListener("click",ge=>{ge.stopPropagation(),ge.preventDefault();const Kt=(Ti==null?void 0:Ti.classList.toggle("is-open"))??!1;xr&&(xr.textContent=Kt?"▲":"▼")});const Xi=ce.querySelector(".rm-opt-format");Xi==null||Xi.addEventListener("mousedown",ge=>{ge.stopPropagation(),ge.preventDefault()}),Xi==null||Xi.addEventListener("click",ge=>{ge.stopPropagation(),ui(!0),hp()});const Ji=ce.querySelector(".rm-opt-page-num");Ji==null||Ji.addEventListener("mousedown",ge=>{ge.stopPropagation(),ge.preventDefault()}),Ji==null||Ji.addEventListener("click",ge=>{ge.stopPropagation(),ui(!0),gp()});const Zi=ce.querySelector(".rm-opt-remove");Zi==null||Zi.addEventListener("mousedown",ge=>{ge.stopPropagation(),ge.preventDefault()}),Zi==null||Zi.addEventListener("click",ge=>{ge.stopPropagation(),ui(!1),yp()}),me.addEventListener("blur",Te),document.addEventListener("mousedown",Me),window.addEventListener("resize",be),window.addEventListener("scroll",Ce),(ol=Ci.value)==null||ol.addEventListener("scroll",Ne),requestAnimationFrame(()=>{Ai.value===Le&&Gs(Le)}),me.focus();const Qi=window.getSelection(),Ya=document.createRange();Ya.selectNodeContents(me),Ya.collapse(!1),Qi==null||Qi.removeAllRanges(),Qi==null||Qi.addRange(Ya)},vr=()=>{var N,A,z,le;G.value&&(vn.value=C.value||((A=(N=G.value.storage.PaginationPlus)==null?void 0:N.appliedConfig)==null?void 0:A.footerLeft)||"",yn.value=E.value||((le=(z=G.value.storage.PaginationPlus)==null?void 0:z.appliedConfig)==null?void 0:le.footerRight)||"",ur.value=!0)},kp=()=>{G.value&&(C.value=vn.value,E.value=yn.value,It(),X(),ur.value=!1)},ht=(N,...A)=>{if(!G.value)return;const z=G.value.commands[N];typeof z=="function"&&z(...A),G.value.commands.focus()},Bt=(N,...A)=>{if(!G.value)return;const z=yt.value[N];if(typeof z=="function")z(...A);else{ht(N,...A);return}G.value.commands.focus()},Ks=N=>{const A=N==="header"?w:E;A.value.includes("{page}")||(A.value=A.value?`${A.value} {page}`:"{page}"),It(),X()},Xs=()=>{if(!G.value)return null;const{state:N}=G.value;if(N.selection.empty)return null;const A=N.selection.content(),z=document.createElement("div");return z.appendChild(Kn.fromSchema(N.schema).serializeFragment(A.content)),{html:z.innerHTML,text:A.content.textBetween(0,A.content.size,`
15076
15076
 
15077
- `," ")}},wp=async()=>{const N=Xs();if(!N||!G.value)return;await Mc(N.text,N.html)&&G.value.chain().focus().deleteSelection().run()},_p=async()=>{var A;const N=Xs();N&&(await Mc(N.text,N.html),(A=G.value)==null||A.commands.focus())},Sp=async()=>{if(!G.value)return;const N=await OC();if(N){const z=_e.sanitizePastedHTML(N);try{G.value.chain().focus().insertContent(z).run()}catch(le){console.error("[DocsEditor] paste HTML failed, falling back to plain text:",le);const ue=await wo();if(ue)try{G.value.chain().focus().insertContent(ue).run()}catch(xe){console.error("[DocsEditor] paste plain text also failed:",xe)}}return}const A=await wo();if(A)try{G.value.chain().focus().insertContent(A).run()}catch(z){console.error("[DocsEditor] paste plain text failed:",z)}},Js=async()=>{if(!G.value)return;const N=await wo();N&&G.value.chain().focus().insertContent(N).run()},Cp=()=>{if(!G.value)return;const{state:N}=G.value;if(N.selection.empty){const{from:A,to:z}=N.selection;z<N.doc.content.size&&G.value.chain().focus().deleteRange({from:A,to:z+1}).run()}else G.value.chain().focus().deleteSelection().run()},Zs=N=>{var A;if(N.key==="Escape"&&$.value){$.value=!1;return}!(N.metaKey||N.ctrlKey)||!N.shiftKey||(A=G.value)!=null&&A.view.dom.contains(N.target)&&(N.key.toLowerCase()==="v"?(N.preventDefault(),Js()):N.key.toLowerCase()==="h"&&(N.preventDefault(),pr.value=!0))};s.onMounted(()=>document.addEventListener("keydown",Zs)),s.onUnmounted(()=>document.removeEventListener("keydown",Zs));const Qs={undo:()=>ht("undo"),redo:()=>ht("redo"),"select-all":()=>ht("selectAll"),cut:()=>{wp()},copy:()=>{_p()},paste:()=>{Sp()},"paste-without-formatting":()=>{Js()},delete:()=>Cp(),bold:()=>ht("toggleBold"),italic:()=>ht("toggleItalic"),underline:()=>ht("toggleUnderline"),heading1:()=>ht("toggleHeading",{level:1}),heading2:()=>ht("toggleHeading",{level:2}),heading3:()=>ht("toggleHeading",{level:3}),"align-left":()=>Gt("alignLeft"),"align-center":()=>Gt("alignCenter"),"align-right":()=>Gt("alignRight"),"align-justify":()=>Gt("alignJustify"),"bullet-list":()=>ht("toggleBulletList"),"numbered-list":()=>ht("toggleOrderedList"),"task-list":()=>Gt("toggleTaskList"),"horizontal-line":()=>ht("setHorizontalRule"),"page-numbers-header":()=>Ks("header"),"page-numbers-footer":()=>Ks("footer"),"clear-formatting":()=>{G.value&&(G.value.chain().unsetAllMarks().clearNodes().run(),ht("setTextAlign","left"))},"insert-image":()=>Gt("insertImage"),"insert-table":()=>Gt("insertTable",{rows:3,cols:3,withHeaderRow:!0}),"insert-code":()=>Gt("toggleCodeBlock"),"insert-toc":()=>Gt("insertToc")};let Ep=N=>{if(N==="page-setup")dp();else if(N==="print")Ys();else if(N==="version-history")yr("history");else if(N==="details")Xa.value=!0;else if(N==="email")Ja.value=!0;else if(N==="find-replace")pr.value=!0;else if(N==="insert-link")Ws();else if(N==="security")n("share");else if(N==="insert-header")gr();else if(N==="insert-footer")vr();else if(N==="toggle-pageless")oi(!m.value);else if(N==="toggle-left-sidebar")yr("toc");else if(N==="toggle-ruler")M.value=!M.value;else if(N==="toggle-focus-mode")$.value=!$.value,$.value&&(V.value=null);else if(N==="insert-footnote"){if(!G.value)return;const{state:A,view:z}=G.value,le=A.schema.nodes.footnote;if(!le){console.error("[DocsEditor] footnote node type not registered in schema");return}const ue=A.selection.head,xe=le.create({content:""}),Oe=A.tr.insert(ue,xe);z.dispatch(Oe),z.focus(),setTimeout(()=>{Oi();const Ee=document.querySelectorAll(".docs-footnote-item-text"),me=Ee[Ee.length-1];me&&(me.scrollIntoView({behavior:"smooth",block:"nearest"}),me.focus())},160)}else Qs[N]?Qs[N]():n("menu-click",N)},yr=N=>{V.value=V.value===N?null:N},Ys=()=>window.print();const Np=(N,A)=>{if(!G.value)return;const z=G.value.view;z.state.doc.descendants((le,ue)=>{if(le.type.name==="footnote"&&z.nodeDOM(ue)===N)return z.dispatch(z.state.tr.setNodeMarkup(ue,void 0,{content:A})),!1})},Oi=()=>{var Ee;if(!G.value||!we.value)return;const N=G.value.view.dom,A=N.querySelector("[data-rm-pagination]");if(!A)return;const z=me=>{var be,Ne,Ce;const pe=document.createElement("div");if(pe.className="docs-footnote-item-text",me.hasAttribute("data-footnote-source-id")){const Me=me.getAttribute("data-citation-id")??"",Te=(Ne=(be=G.value)==null?void 0:be.storage)==null?void 0:Ne.citation,Le=((Ce=Te==null?void 0:Te.engine)==null?void 0:Ce.renderCluster(Me))??"";return pe.classList.add("docs-footnote-item-text--citation"),Le?pe.innerHTML=Le:pe.setAttribute("data-empty","true"),pe}const ce=me.getAttribute("data-footnote-content")??"";return pe.contentEditable="true",pe.textContent=ce,ce||pe.setAttribute("data-empty","true"),pe.addEventListener("input",()=>{pe.removeAttribute("data-empty"),pe.textContent||pe.setAttribute("data-empty","true")}),pe.addEventListener("blur",()=>{var Te;const Me=((Te=pe.textContent)==null?void 0:Te.trim())??"";Np(me,Me)}),pe},le=Array.from(A.querySelectorAll(".rm-page-break")),ue=Array.from(N.querySelectorAll(".docs-footnote-ref"));if(le.length===0){ue.forEach((Ne,Ce)=>{Ne.textContent=String(Ce+1)});const me=ke.value;if(!me||((Ee=me.querySelector(".docs-pageless-footnotes"))==null||Ee.remove(),ue.length===0))return;const pe=me.querySelector(".docs-pageless-footnotes");if(pe!=null&&pe.querySelector(".docs-footnote-item-text:focus"))return;const ce=document.createElement("div");ce.className="docs-page-footnotes docs-pageless-footnotes";const be=document.createElement("div");be.className="docs-footnotes-sep",ce.appendChild(be),ue.forEach((Ne,Ce)=>{const Me=document.createElement("div");Me.className="docs-footnote-item";const Te=document.createElement("sup");Te.className="docs-footnote-item-num",Te.textContent=String(Ce+1);const Le=z(Ne);Ne.dataset.footnoteItemId=`fn-pageless-${Ce}`,Me.id=`fn-pageless-${Ce}`,Me.appendChild(Te),Me.appendChild(Le),ce.appendChild(Me)}),me.appendChild(ce);return}const xe=new Map;le.forEach((me,pe)=>xe.set(pe,[])),ue.forEach(me=>{const pe=me.getBoundingClientRect().top;let ce=le.length-1;for(let be=0;be<le.length-1;be++){const Ne=le[be].querySelector(".breaker");if(Ne&&pe<Ne.getBoundingClientRect().top){ce=be;break}}xe.get(ce).push(me)});let Oe=1;le.forEach((me,pe)=>{const ce=xe.get(pe)??[],be=Oe;Oe+=ce.length,ce.forEach((Le,Je)=>{Le.textContent=String(be+Je)});const Ne=me.querySelector(".docs-page-footnotes");if(Ne!=null&&Ne.querySelector(".docs-footnote-item-text:focus")||(Ne==null||Ne.remove(),ce.length===0))return;const Ce=document.createElement("div");Ce.className="docs-page-footnotes";const Me=document.createElement("div");Me.className="docs-footnotes-sep",Ce.appendChild(Me),ce.forEach((Le,Je)=>{const St=document.createElement("div");St.className="docs-footnote-item";const Ti=document.createElement("sup");Ti.className="docs-footnote-item-num",Ti.textContent=String(be+Je);const xr=z(Le);Le.dataset.footnoteItemId=`fn-${pe}-${Je}`,St.id=`fn-${pe}-${Je}`,St.appendChild(Ti),St.appendChild(xr),Ce.appendChild(St)});const Te=me.querySelector(".breaker");Te?Te.insertBefore(Ce,Te.firstChild):me.appendChild(Ce)})};return s.watch(we,N=>{!N||!G.value||G.value.view.dom.addEventListener("click",A=>{const z=A.target.closest(".docs-footnote-ref");if(!z)return;A.preventDefault(),A.stopPropagation();const le=z.dataset.footnoteItemId;if(!le)return;const ue=document.getElementById(le),xe=ue==null?void 0:ue.querySelector(".docs-footnote-item-text");if(xe){xe.scrollIntoView({behavior:"smooth",block:"nearest"}),xe.focus();const Oe=document.createRange();Oe.selectNodeContents(xe),Oe.collapse(!1);const Ee=window.getSelection();Ee==null||Ee.removeAllRanges(),Ee==null||Ee.addRange(Oe)}})}),s.watch(we,N=>{var z;if(!N||!G.value)return;setTimeout(Oi,150),G.value.on("update",()=>{setTimeout(Oi,60)}),G.value.on("selectionUpdate",()=>{setTimeout(Oi,100)});const A=G.value.storage.citation;(z=A==null?void 0:A.engine)==null||z.onChange(()=>{setTimeout(Oi,30)}),window.addEventListener("resize",Oi)}),(N,A)=>(s.openBlock(),s.createElementBlock("div",TC,[$.value?s.createCommentVNode("",!0):(s.openBlock(),s.createBlock(iu,{key:0,title:e.title,editable:e.editable,collaborators:e.collaborators,starred:e.starred,"user-name":e.userName,"user-avatar":e.userAvatar,pageless:m.value,"outline-open":V.value==="toc","show-ruler":M.value,"focus-mode":$.value,onMenuClick:s.unref(Ep),onBack:A[0]||(A[0]=z=>N.$emit("back")),"onUpdate:title":A[1]||(A[1]=z=>N.$emit("update:title",z)),onToggleStar:A[2]||(A[2]=z=>N.$emit("toggle-star")),onExport:A[3]||(A[3]=z=>N.$emit("export",z)),onShare:A[4]||(A[4]=z=>N.$emit("share"))},{actions:s.withCtx(()=>[s.renderSlot(N.$slots,"header-actions",{},void 0,!0)]),"overflow-actions":s.withCtx(z=>[s.renderSlot(N.$slots,"overflow-actions",s.normalizeProps(s.guardReactiveProps(z)),void 0,!0)]),"user-menu":s.withCtx(z=>[s.renderSlot(N.$slots,"user-menu",s.normalizeProps(s.guardReactiveProps(z)),void 0,!0)]),_:3},8,["title","editable","collaborators","starred","user-name","user-avatar","pageless","outline-open","show-ruler","focus-mode","onMenuClick"])),$.value?s.createCommentVNode("",!0):(s.openBlock(),s.createBlock(nu,{key:1,actions:s.unref(yt),plugins:e.plugins,editor:s.unref(G),"active-sidebar":V.value,onToggleSidebar:s.unref(yr),onPrint:s.unref(Ys)},null,8,["actions","plugins","editor","active-sidebar","onToggleSidebar","onPrint"])),M.value&&!$.value?(s.openBlock(),s.createBlock(bb,{key:2,"layout-options":d.value},null,8,["layout-options"])):s.createCommentVNode("",!0),$.value?(s.openBlock(),s.createElementBlock("button",{key:3,type:"button",class:"fixed right-4 top-4 z-50 flex h-11 w-11 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-600 shadow-md transition-colors hover:bg-slate-100 dark:border-white/10 dark:bg-[#0e1525] dark:text-slate-300 dark:hover:bg-white/5",title:s.unref(o)("header.focusMode"),"aria-label":s.unref(o)("header.focusMode"),onClick:A[5]||(A[5]=z=>$.value=!1)},[s.createVNode(s.unref(wd),{class:"h-5 w-5"})],8,MC)):s.createCommentVNode("",!0),s.createVNode(ru,{visible:D.value,actions:s.unref(yt),position:H.value,editor:s.unref(G)},null,8,["visible","actions","position","editor"]),s.createVNode(jc,{editor:s.unref(G),commands:te.value},null,8,["editor","commands"]),s.createElementVNode("div",zC,[s.createVNode(bC,{"is-open":pr.value,editor:s.unref(G),onClose:A[6]||(A[6]=z=>pr.value=!1)},null,8,["is-open","editor"]),V.value==="toc"?(s.openBlock(),s.createBlock(ou,{key:0,editor:s.unref(G),onClose:A[7]||(A[7]=z=>V.value=null)},null,8,["editor"])):(s.openBlock(),s.createElementBlock("button",{key:1,type:"button",class:"absolute left-4 top-4 z-20 flex h-11 w-11 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-600 shadow-md transition-colors hover:bg-slate-100 dark:border-white/10 dark:bg-[#0e1525] dark:text-slate-300 dark:hover:bg-white/5",title:s.unref(o)("editor.showOutline"),onClick:A[8]||(A[8]=z=>s.unref(yr)("toc"))},[s.createVNode(s.unref(xd),{class:"h-5 w-5"})],8,IC)),s.createElementVNode("div",{ref_key:"scrollContainerRef",ref:Ci,class:"docs-editor-scroll relative flex flex-1 overflow-auto px-4 py-6 bg-slate-100 dark:bg-[#02040a]",onScroll:Wa},[M.value&&!$.value?(s.openBlock(),s.createBlock(yb,{key:0,"layout-options":d.value},null,8,["layout-options"])):s.createCommentVNode("",!0),s.createElementVNode("div",DC,[s.createElementVNode("div",{class:"relative w-full",style:s.normalizeStyle({maxWidth:h.value})},[b.value?(s.openBlock(),s.createBlock(Up,{key:0,data:s.unref(hn),"is-ready":s.unref(Ei)},null,8,["data","is-ready"])):s.createCommentVNode("",!0),s.unref(we)?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",{key:1,class:"absolute inset-0 z-10 flex flex-col items-center justify-center bg-white dark:bg-[#0e1525]/60 backdrop-blur-[2px] gap-3 rounded-lg","aria-label":s.unref(o)("editor.loadingDocument")},null,8,RC)),s.createElementVNode("div",{ref_key:"editorRef",ref:ke,class:s.normalizeClass(["docs-editor__paper outline-none text-slate-800 dark:text-[#e2e8f0]",{"opacity-40":!s.unref(we)}])},null,2)],4)])],544),V.value==="references"?(s.openBlock(),s.createBlock(sv,{key:2,sources:F.value,"active-style":q.value,"picker-mode":se.value,"can-import":Ot.value,importing:pt.value,"import-message":dt.value,onClose:A[9]||(A[9]=z=>V.value=null),onInsert:Ht,onCreate:J,onUpdate:ze,onRemove:Ue,"onUpdate:style":qe,onImportDoi:ri,onImportBibliography:Xe},null,8,["sources","active-style","picker-mode","can-import","importing","import-message"])):s.createCommentVNode("",!0),V.value==="comments"?(s.openBlock(),s.createBlock(sp,{key:3,comments:i.comments,"selected-text-snippet":i.selectedTextSnippet,"selected-text-index":i.selectedTextIndex,"orphaned-ids":ee.value,onClose:A[10]||(A[10]=z=>V.value=null),onAddComment:A[11]||(A[11]=(z,le,ue)=>N.$emit("add-comment",z,le,ue)),onAddReply:A[12]||(A[12]=(z,le)=>N.$emit("add-reply",z,le)),onResolveComment:A[13]||(A[13]=z=>N.$emit("resolve-comment",z)),onDeleteComment:A[14]||(A[14]=z=>N.$emit("delete-comment",z))},null,8,["comments","selected-text-snippet","selected-text-index","orphaned-ids"])):s.createCommentVNode("",!0),V.value==="history"?(s.openBlock(),s.createBlock(lp,{key:4,snapshots:i.snapshots,"active-preview-index":i.activePreviewIndex,onSaveSnapshot:A[15]||(A[15]=z=>N.$emit("save-snapshot",z)),onRestoreSnapshot:A[16]||(A[16]=z=>N.$emit("restore-snapshot",z)),onPreviewSnapshot:A[17]||(A[17]=z=>N.$emit("preview-snapshot",z))},null,8,["snapshots","active-preview-index"])):s.createCommentVNode("",!0),V.value==="ai"?(s.openBlock(),s.createBlock(op,{key:5,editor:s.unref(G),"ai-stream":i.aiStream,"ai-draft":i.aiDraft,onClose:A[18]||(A[18]=z=>V.value=null)},null,8,["editor","ai-stream","ai-draft"])):s.createCommentVNode("",!0)]),$.value?s.createCommentVNode("",!0):(s.openBlock(),s.createBlock(au,{key:4,"connection-state":e.connectionState,"saving-status":L.value,"last-saved":Q.value,"word-count":P.value,"char-count":W.value,"page-count":jt.value,"current-page":mt.value,"page-size":p.value,"page-sizes":s.unref(Cn.PAGE_SIZES),pageless:m.value,"onUpdate:pageSize":A[19]||(A[19]=z=>{p.value=z,n("update:pageSize",z)})},null,8,["connection-state","saving-status","last-saved","word-count","char-count","page-count","current-page","page-size","page-sizes","pageless"])),ur.value?(s.openBlock(),s.createElementBlock("div",LC,[s.createElementVNode("div",BC,[s.createElementVNode("h2",PC,s.toDisplayString(s.unref(o)("editor.headerFooter.footer")),1),s.createElementVNode("div",VC,[s.createElementVNode("div",FC,[s.createElementVNode("h3",UC,s.toDisplayString(s.unref(o)("editor.headerFooter.footer")),1),s.createElementVNode("button",{type:"button",class:"text-[11px] text-red-500 hover:text-red-600 font-medium transition-colors",onClick:A[20]||(A[20]=z=>{vn.value="",yn.value=""})},s.toDisplayString(s.unref(o)("editor.headerFooter.clear")),1)]),s.createElementVNode("div",HC,[s.createElementVNode("div",null,[s.createElementVNode("label",jC,s.toDisplayString(s.unref(o)("editor.headerFooter.left")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[21]||(A[21]=z=>vn.value=z),type:"text",class:"w-full rounded-md border border-slate-200 bg-transparent px-3 py-1.5 text-xs focus:outline-none dark:border-slate-700",placeholder:s.unref(o)("editor.headerFooter.footerLeftPlaceholder")},null,8,qC),[[s.vModelText,vn.value]])]),s.createElementVNode("div",null,[s.createElementVNode("label",$C,s.toDisplayString(s.unref(o)("editor.headerFooter.right")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[22]||(A[22]=z=>yn.value=z),type:"text",class:"w-full rounded-md border border-slate-200 bg-transparent px-3 py-1.5 text-xs focus:outline-none dark:border-slate-700",placeholder:s.unref(o)("editor.headerFooter.footerRightPlaceholder")},null,8,WC),[[s.vModelText,yn.value]])])])]),s.createElementVNode("div",GC,s.toDisplayString(s.unref(o)("editor.headerFooter.variableInfo")),1),s.createElementVNode("div",KC,[s.createElementVNode("button",{type:"button",class:"rounded-md px-3 py-1.5 text-xs font-semibold hover:bg-slate-100 dark:hover:bg-white/5",onClick:A[23]||(A[23]=z=>ur.value=!1)},s.toDisplayString(s.unref(o)("editor.headerFooter.cancel")),1),s.createElementVNode("button",{type:"button",class:"rounded-md bg-blue-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-blue-700",onClick:kp},s.toDisplayString(s.unref(o)("editor.headerFooter.save")),1)])])])):s.createCommentVNode("",!0),er.value?(s.openBlock(),s.createElementBlock("div",XC,[s.createElementVNode("div",JC,[s.createElementVNode("h2",ZC,s.toDisplayString(s.unref(o)("editor.headerFooter.headerFooterFormatTitle")),1),s.createElementVNode("div",QC,[s.createElementVNode("h3",YC,s.toDisplayString(s.unref(o)("editor.headerFooter.marginSection")),1),s.createElementVNode("div",eE,[s.createElementVNode("div",null,[s.createElementVNode("label",tE,s.toDisplayString(s.unref(o)("editor.headerFooter.headerTopMargin"))+" (cm) ",1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[24]||(A[24]=z=>bn.value=z),type:"number",min:_o,max:So,step:zc,class:"w-full rounded-lg border border-slate-300 dark:border-slate-700 bg-white dark:bg-[#1a2332] px-3.5 py-2 text-sm text-slate-800 dark:text-slate-100 focus:border-blue-600 focus:ring-2 focus:ring-blue-500/20 focus:outline-none transition-all"},null,512),[[s.vModelText,bn.value,void 0,{number:!0}]])]),s.createElementVNode("div",null,[s.createElementVNode("label",iE,s.toDisplayString(s.unref(o)("editor.headerFooter.footerBottomMargin"))+" (cm) ",1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[25]||(A[25]=z=>gn.value=z),type:"number",min:_o,max:So,step:zc,class:"w-full rounded-lg border border-slate-300 dark:border-slate-700 bg-white dark:bg-[#1a2332] px-3.5 py-2 text-sm text-slate-800 dark:text-slate-100 focus:border-blue-600 focus:ring-2 focus:ring-blue-500/20 focus:outline-none transition-all"},null,512),[[s.vModelText,gn.value,void 0,{number:!0}]])])])]),s.createElementVNode("div",nE,[s.createElementVNode("h3",rE,s.toDisplayString(s.unref(o)("editor.headerFooter.layoutSection")),1),s.createElementVNode("div",aE,[s.createElementVNode("label",oE,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[26]||(A[26]=z=>tr.value=z),type:"checkbox",class:"w-4 h-4 rounded border-slate-300 text-blue-600 focus:ring-blue-500"},null,512),[[s.vModelCheckbox,tr.value]]),s.createElementVNode("span",null,s.toDisplayString(s.unref(o)("editor.headerFooter.differentFirstPage")),1)]),s.createElementVNode("label",sE,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[27]||(A[27]=z=>ir.value=z),type:"checkbox",class:"w-4 h-4 rounded border-slate-300 text-blue-600 focus:ring-blue-500"},null,512),[[s.vModelCheckbox,ir.value]]),s.createElementVNode("span",null,s.toDisplayString(s.unref(o)("editor.headerFooter.differentOddEven")),1)])])]),s.createElementVNode("div",lE,[s.createElementVNode("button",{type:"button",class:"rounded-full px-5 py-2 text-xs font-semibold text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-950/40 transition-colors",onClick:A[28]||(A[28]=z=>er.value=!1)},s.toDisplayString(s.unref(o)("editor.headerFooter.cancel")),1),s.createElementVNode("button",{type:"button",class:"rounded-full bg-blue-600 hover:bg-blue-700 px-6 py-2 text-xs font-semibold text-white shadow-md transition-colors",onClick:bp},s.toDisplayString(s.unref(o)("editor.headerFooter.apply")),1)])])])):s.createCommentVNode("",!0),nr.value?(s.openBlock(),s.createElementBlock("div",cE,[s.createElementVNode("div",uE,[s.createElementVNode("h2",fE,s.toDisplayString(s.unref(o)("editor.headerFooter.pageNumberTitle")),1),s.createElementVNode("div",pE,[s.createElementVNode("h3",dE,s.toDisplayString(s.unref(o)("editor.headerFooter.positionSection")),1),s.createElementVNode("div",mE,[s.createElementVNode("label",hE,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[29]||(A[29]=z=>Gi.value=z),type:"radio",value:"header",class:"w-4 h-4 text-blue-600 focus:ring-blue-500"},null,512),[[s.vModelRadio,Gi.value]]),s.createElementVNode("span",null,s.toDisplayString(s.unref(o)("editor.headerFooter.positionHeader")),1)]),s.createElementVNode("label",bE,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[30]||(A[30]=z=>Gi.value=z),type:"radio",value:"footer",class:"w-4 h-4 text-blue-600 focus:ring-blue-500"},null,512),[[s.vModelRadio,Gi.value]]),s.createElementVNode("span",null,s.toDisplayString(s.unref(o)("editor.headerFooter.positionFooter")),1)]),s.createElementVNode("label",gE,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[31]||(A[31]=z=>lr.value=z),type:"checkbox",class:"w-4 h-4 rounded border-slate-300 text-blue-600 focus:ring-blue-500"},null,512),[[s.vModelCheckbox,lr.value]]),s.createElementVNode("span",null,s.toDisplayString(s.unref(o)("editor.headerFooter.showOnFirstPage")),1)])])]),s.createElementVNode("div",vE,[s.createElementVNode("h3",yE,s.toDisplayString(s.unref(o)("editor.headerFooter.numberingSection")),1),s.createElementVNode("div",xE,[s.createElementVNode("div",kE,[s.createElementVNode("label",wE,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[32]||(A[32]=z=>Ki.value=z),type:"radio",value:"startAt",class:"w-4 h-4 text-blue-600 focus:ring-blue-500"},null,512),[[s.vModelRadio,Ki.value]]),s.createElementVNode("span",null,s.toDisplayString(s.unref(o)("editor.headerFooter.startAt")),1)]),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[33]||(A[33]=z=>cr.value=z),type:"number",min:"1",class:"w-16 rounded-md border border-slate-300 dark:border-slate-700 bg-white dark:bg-[#1a2332] px-2.5 py-1 text-xs text-slate-800 dark:text-slate-100 focus:border-blue-600 focus:outline-none"},null,512),[[s.vModelText,cr.value]])]),s.createElementVNode("label",_E,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[34]||(A[34]=z=>Ki.value=z),type:"radio",value:"continue",class:"w-4 h-4 text-blue-600 focus:ring-blue-500"},null,512),[[s.vModelRadio,Ki.value]]),s.createElementVNode("span",null,s.toDisplayString(s.unref(o)("editor.headerFooter.continueFromPrevious")),1)])])]),s.createElementVNode("div",SE,[s.createElementVNode("button",{type:"button",class:"rounded-full px-5 py-2 text-xs font-semibold text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-950/40 transition-colors",onClick:A[35]||(A[35]=z=>nr.value=!1)},s.toDisplayString(s.unref(o)("editor.headerFooter.cancel")),1),s.createElementVNode("button",{type:"button",class:"rounded-full bg-blue-600 hover:bg-blue-700 px-6 py-2 text-xs font-semibold text-white shadow-md transition-colors",onClick:vp},s.toDisplayString(s.unref(o)("editor.headerFooter.apply")),1)])])])):s.createCommentVNode("",!0),s.createVNode(up,{"is-open":Ja.value,"document-title":i.title,"share-url":i.shareUrl,onClose:A[36]||(A[36]=z=>Ja.value=!1),onCopyLink:A[37]||(A[37]=z=>n("share"))},null,8,["is-open","document-title","share-url"]),s.createVNode(cp,{"is-open":Xa.value,meta:i.documentMeta,onClose:A[38]||(A[38]=z=>Xa.value=!1)},null,8,["is-open","meta"]),s.createVNode(AC,{"is-open":xn.value,"initial-text":dr.value,"initial-url":Za.value,"is-editing":mr.value,onApply:fp,onRemove:pp,onClose:A[39]||(A[39]=z=>xn.value=!1)},null,8,["is-open","initial-text","initial-url","is-editing"]),fr.value?(s.openBlock(),s.createElementBlock("div",CE,[s.createElementVNode("div",EE,[s.createElementVNode("h2",NE,s.toDisplayString(s.unref(o)("editor.pageSetup.title")),1),s.createElementVNode("div",AE,[s.createElementVNode("label",OE,s.toDisplayString(s.unref(o)("editor.pageSetup.paperSize")),1),s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":A[40]||(A[40]=z=>hr.value=z),class:"w-full rounded-md border border-slate-200 bg-transparent px-3 py-2 text-xs focus:outline-none dark:border-slate-700"},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(Cn.PAGE_SIZES),z=>(s.openBlock(),s.createElementBlock("option",{key:z.id,value:z.id},s.toDisplayString(z.name),9,TE))),128))],512),[[s.vModelSelect,hr.value]])]),s.createElementVNode("div",ME,[s.createElementVNode("label",zE,s.toDisplayString(s.unref(o)("editor.pageSetup.orientation")),1),s.createElementVNode("div",IE,[s.createElementVNode("button",{type:"button",class:s.normalizeClass(["flex-1 rounded-md border px-3 py-2 text-xs font-medium transition-colors",Ni.value==="portrait"?"border-cyan-500 bg-cyan-50 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300":"border-slate-200 hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-white/5"]),onClick:A[41]||(A[41]=z=>Ni.value="portrait")},s.toDisplayString(s.unref(o)("editor.pageSetup.portrait")),3),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["flex-1 rounded-md border px-3 py-2 text-xs font-medium transition-colors",Ni.value==="landscape"?"border-cyan-500 bg-cyan-50 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300":"border-slate-200 hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-white/5"]),onClick:A[42]||(A[42]=z=>Ni.value="landscape")},s.toDisplayString(s.unref(o)("editor.pageSetup.landscape")),3)])]),s.createElementVNode("div",DE,[s.createElementVNode("label",RE,s.toDisplayString(s.unref(o)("editor.pageSetup.margins"))+" (cm)",1),s.createElementVNode("div",LE,[s.createElementVNode("div",null,[s.createElementVNode("label",BE,s.toDisplayString(s.unref(o)("editor.pageSetup.top")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[43]||(A[43]=z=>$e.value.top=z),type:"number",min:tn,max:s.unref(kn),step:"0.1",class:"w-full rounded-md border border-slate-200 bg-transparent px-3 py-1.5 text-xs focus:outline-none dark:border-slate-700"},null,8,PE),[[s.vModelText,$e.value.top,void 0,{number:!0}]])]),s.createElementVNode("div",null,[s.createElementVNode("label",VE,s.toDisplayString(s.unref(o)("editor.pageSetup.bottom")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[44]||(A[44]=z=>$e.value.bottom=z),type:"number",min:tn,max:s.unref(kn),step:"0.1",class:"w-full rounded-md border border-slate-200 bg-transparent px-3 py-1.5 text-xs focus:outline-none dark:border-slate-700"},null,8,FE),[[s.vModelText,$e.value.bottom,void 0,{number:!0}]])]),s.createElementVNode("div",null,[s.createElementVNode("label",UE,s.toDisplayString(s.unref(o)("editor.pageSetup.left")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[45]||(A[45]=z=>$e.value.left=z),type:"number",min:tn,max:s.unref(kn),step:"0.1",class:"w-full rounded-md border border-slate-200 bg-transparent px-3 py-1.5 text-xs focus:outline-none dark:border-slate-700"},null,8,HE),[[s.vModelText,$e.value.left,void 0,{number:!0}]])]),s.createElementVNode("div",null,[s.createElementVNode("label",jE,s.toDisplayString(s.unref(o)("editor.pageSetup.right")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[46]||(A[46]=z=>$e.value.right=z),type:"number",min:tn,max:s.unref(kn),step:"0.1",class:"w-full rounded-md border border-slate-200 bg-transparent px-3 py-1.5 text-xs focus:outline-none dark:border-slate-700"},null,8,qE),[[s.vModelText,$e.value.right,void 0,{number:!0}]])])])]),s.createElementVNode("div",$E,[s.createElementVNode("button",{type:"button",class:"rounded-md px-3 py-1.5 text-xs font-semibold hover:bg-slate-100 dark:hover:bg-white/5",onClick:A[47]||(A[47]=z=>fr.value=!1)},s.toDisplayString(s.unref(o)("editor.pageSetup.cancel")),1),s.createElementVNode("button",{type:"button",class:"rounded-md bg-blue-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-blue-700",onClick:mp},s.toDisplayString(s.unref(o)("editor.pageSetup.apply")),1)])])])):s.createCommentVNode("",!0)]))}}),KE=cs(GE,[["__scopeId","data-v-2fa3cf60"]]),XE={class:"docs-editor-pages flex flex-col items-center gap-10"},JE=["data-page-index"],ZE=["data-node-type","data-from","data-to"],QE=["innerHTML"],YE={key:1,class:"docs-editor-page__block-fallback flex justify-between text-sm text-slate-700"},e2={class:"docs-editor-page__block-type font-medium"},t2={class:"docs-editor-page__block-range text-slate-500"},i2=s.defineComponent({__name:"PageView",props:{pages:{},editor:{default:null},layoutOptions:{default:()=>({pageWidth:794,pageHeight:1123,margins:{top:96,bottom:96,left:96,right:96}})},isPageless:{type:Boolean,default:!1},pageColor:{default:"#ffffff"}},setup(e){const t=e,i=s.ref(0),n=()=>{i.value++};s.watch(()=>t.editor,(d,h)=>{h&&typeof h.off=="function"&&h.off("update",n),d&&typeof d.on=="function"&&d.on("update",n)},{immediate:!0}),s.onUnmounted(()=>{t.editor&&typeof t.editor.off=="function"&&t.editor.off("update",n)});const r=s.computed(()=>{var d,h;return((h=(d=t.editor)==null?void 0:d.view)==null?void 0:h.dom)??null}),a=s.computed(()=>{var d,h,v;return{pageHeight:((d=t.layoutOptions)==null?void 0:d.pageHeight)??1123,pageWidth:((h=t.layoutOptions)==null?void 0:h.pageWidth)??794,margins:((v=t.layoutOptions)==null?void 0:v.margins)??{top:96,bottom:96,left:96,right:96},maxCharsPerPage:0}}),o=s.computed(()=>{const{pageWidth:d,pageHeight:h,margins:v}=a.value;return t.isPageless?{width:`${d}px`,minHeight:"auto",height:"auto",paddingTop:`${v.top}px`,paddingBottom:`${v.bottom}px`,paddingLeft:`${v.left}px`,paddingRight:`${v.right}px`,backgroundColor:t.pageColor,boxShadow:"none",border:"none",borderRadius:"0"}:{width:`${d}px`,height:`${h}px`,paddingTop:`${v.top}px`,paddingBottom:`${v.bottom}px`,paddingLeft:`${v.left}px`,paddingRight:`${v.right}px`}}),l=()=>r.value?Array.from(r.value.children).filter(d=>d instanceof HTMLElement):[],c=d=>l().find(v=>{const b=parseInt(v.getAttribute("data-from")??"-1",10),y=parseInt(v.getAttribute("data-to")??"-1",10);return b>=0&&y>=b&&b<=d.from&&y>=d.to})??null,f=d=>{if(!t.editor||!r.value||!c(d))return null;try{const v=t.editor.view,b=v.domAtPos(d.from),y=v.domAtPos(d.to);if(!b||!y)return null;const g=document.createRange();g.setStart(b.node,b.offset),g.setEnd(y.node,y.offset);const x=g.cloneContents(),k=document.createElement("div");return k.appendChild(x),k.innerHTML}catch{return null}},p=s.computed(()=>{i.value;const d=new Map;if(!t.editor||!r.value)return d;for(const h of t.pages)for(const v of h.blocks){const b=`${v.from}-${v.to}-${v.nodeType}`;if(d.has(b))continue;const y=f(v);y!==null&&d.set(b,y)}return d}),m=d=>p.value.get(`${d.from}-${d.to}-${d.nodeType}`)??null;return(d,h)=>(s.openBlock(),s.createElementBlock("div",XE,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.pages,(v,b)=>(s.openBlock(),s.createElementBlock("div",{key:`${b}-${v.from}-${v.to}`,class:s.normalizeClass(["docs-editor-page tiptap ProseMirror relative box-border overflow-hidden text-slate-800 dark:text-[#e2e8f0]",e.isPageless?"":"editor-page-shadow rounded-lg border border-slate-200/70 bg-white dark:border-white/5 dark:bg-[#0a0f1e]"]),"data-page-index":b,style:s.normalizeStyle(o.value)},[s.createElementVNode("div",{class:"docs-editor-page__blocks flex flex-col",style:s.normalizeStyle(e.isPageless?{}:{height:"100%",overflow:"hidden"})},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(v.blocks,y=>(s.openBlock(),s.createElementBlock("div",{key:`${y.from}-${y.to}`,class:"docs-editor-page__block","data-node-type":y.nodeType,"data-from":y.from,"data-to":y.to},[m(y)!==null?(s.openBlock(),s.createElementBlock("div",{key:0,class:"docs-editor-page__block-content",innerHTML:m(y)},null,8,QE)):(s.openBlock(),s.createElementBlock("div",YE,[s.createElementVNode("span",e2,s.toDisplayString(y.nodeType),1),s.createElementVNode("span",t2,s.toDisplayString(y.from)+"–"+s.toDisplayString(y.to),1)]))],8,ZE))),128))],4)],14,JE))),128))]))}}),n2={class:"docs-editor-left-sidebar flex w-14 flex-shrink-0 flex-col items-center border-r border-slate-200 bg-slate-50/50 py-3 dark:border-slate-800 dark:bg-[#080d1a] md:w-64 md:items-stretch md:px-3"},r2={class:"mb-4 flex items-center justify-between px-1"},a2=["title"],o2={class:"hidden flex-col gap-4 md:flex"},s2={class:"flex items-center justify-between px-2"},l2={class:"text-xs font-semibold text-slate-500 dark:text-slate-400 uppercase tracking-wide"},c2=["title"],u2={class:"flex flex-col gap-1 pr-1"},f2=["onClick"],p2={class:"truncate"},d2={key:1,class:"flex flex-1 items-center gap-2 pr-6"},m2=["onBlur","onKeydown"],h2={class:"relative flex items-center"},b2=["onClick"],g2={key:1,class:"absolute right-0 top-6 z-50 w-28 rounded-lg border border-slate-200/80 bg-white py-1 shadow-lg dark:border-slate-700 dark:bg-slate-800 text-slate-700 dark:text-slate-200"},v2=["onClick"],y2=["disabled","onClick"],x2={class:"flex flex-col gap-1.5 px-2"},k2={class:"text-xs font-semibold text-slate-500 dark:text-slate-400 uppercase tracking-wide"},w2={key:0,class:"flex flex-col gap-1 mt-1"},_2=["onClick"],S2={key:1,class:"text-xs leading-relaxed text-slate-400 dark:text-slate-500 italic mt-1 font-sans"},C2={class:"flex flex-col gap-2 md:hidden"},E2=["title","onClick"],N2=s.defineComponent({__name:"DocumentTabsSidebar",props:{tabs:{default:()=>[{id:"tab-1",label:"Tab 1",active:!0}]},editor:{default:null},backTitle:{default:""}},emits:["collapse","add-tab","select-tab","delete-tab","rename-tab"],setup(e,{emit:t}){const{t:i}=rt(),n=e,r=s.computed(()=>n.backTitle||i("common.cancel")),a=t,o=s.ref(null),l=s.ref(null),c=s.ref(""),f=x=>{l.value=x.id,c.value=x.label,o.value=null},p=x=>{c.value.trim()&&a("rename-tab",{id:x,label:c.value.trim()}),l.value=null},m=()=>{l.value=null},d=x=>{a("delete-tab",x),o.value=null},h=x=>{o.value=o.value===x?null:x},v=s.ref([]),b=()=>{if(!n.editor)return;const x=[];n.editor.state.doc.descendants((k,w)=>{if(k.type.name==="heading"){const C=k.attrs.level;(C===1||C===2||C===3)&&x.push({id:`heading-${w}`,text:k.textContent.trim()||i("documentTabs.untitledHeading").replace("{level}",String(C)),level:C,pos:w})}return!0}),v.value=x};let y=null;s.watch(()=>n.editor,x=>{if(y&&(y(),y=null),!x){v.value=[];return}b();const k=()=>{b()};x.on("update",k),y=()=>{x.off("update",k)}},{immediate:!0});const g=x=>{n.editor&&(n.editor.chain().focus().setTextSelection(x.pos).run(),setTimeout(()=>{var C;const k=document.querySelector(".docs-editor-scroll");if(!k)return;const w=k.querySelectorAll(".ProseMirror h1, .ProseMirror h2, .ProseMirror h3");for(const E of Array.from(w))if(((C=E.textContent)==null?void 0:C.trim())===x.text){E.scrollIntoView({behavior:"smooth",block:"center"});return}},50))};return(x,k)=>(s.openBlock(),s.createElementBlock("aside",n2,[s.createElementVNode("div",r2,[s.createElementVNode("button",{type:"button",class:"flex h-8 w-8 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-200/80 dark:text-slate-400 dark:hover:bg-slate-800/80",title:r.value,onClick:k[0]||(k[0]=w=>a("collapse"))},[s.createVNode(s.unref(Zp),{class:"h-[18px] w-[18px]"})],8,a2)]),s.createElementVNode("div",o2,[s.createElementVNode("div",s2,[s.createElementVNode("span",l2,s.toDisplayString(s.unref(i)("documentTabs.documentTabs")),1),s.createElementVNode("button",{type:"button",class:"flex h-6 w-6 items-center justify-center rounded-full text-slate-600 hover:bg-slate-200 dark:text-slate-400 dark:hover:bg-slate-800 transition-colors",title:s.unref(i)("documentTabs.addTab"),onClick:k[1]||(k[1]=w=>a("add-tab"))},[s.createVNode(s.unref(gi),{class:"h-4 w-4"})],8,c2)]),s.createElementVNode("div",u2,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.tabs,w=>(s.openBlock(),s.createElementBlock("div",{key:w.id,class:s.normalizeClass(["group relative flex w-full items-center justify-between rounded-r-full py-1.5 pl-3 pr-2 text-left text-sm transition-all",[w.active?"bg-[#c2e7ff]/70 text-[#001d35] dark:bg-blue-950/40 dark:text-blue-200 font-medium":"text-slate-700 hover:bg-slate-200/40 dark:text-slate-300 dark:hover:bg-slate-800/30"]])},[l.value!==w.id?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"flex flex-1 items-center gap-2 truncate pr-6 text-left",onClick:C=>a("select-tab",w.id)},[s.createVNode(s.unref(sn),{class:"h-4 w-4 flex-shrink-0 opacity-70"}),s.createElementVNode("span",p2,s.toDisplayString(w.label),1)],8,f2)):s.createCommentVNode("",!0),l.value===w.id?(s.openBlock(),s.createElementBlock("div",d2,[s.createVNode(s.unref(sn),{class:"h-4 w-4 flex-shrink-0 opacity-70"}),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":k[2]||(k[2]=C=>c.value=C),type:"text",class:"flex-1 rounded border border-blue-400 bg-white px-1.5 py-0.5 text-xs text-slate-800 outline-none focus:ring-1 focus:ring-blue-400/50 dark:bg-slate-900 dark:text-slate-100",onBlur:C=>p(w.id),onKeydown:[s.withKeys(C=>p(w.id),["enter"]),s.withKeys(m,["esc"])],onClick:k[3]||(k[3]=s.withModifiers(()=>{},["stop"]))},null,40,m2),[[s.vModelText,c.value]])])):s.createCommentVNode("",!0),s.createElementVNode("div",h2,[l.value!==w.id?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:s.normalizeClass(["rounded-full p-1 text-slate-500 opacity-0 transition-opacity hover:bg-slate-200/70 group-hover:opacity-100 dark:hover:bg-slate-700/70",{"opacity-100":o.value===w.id}]),onClick:s.withModifiers(C=>h(w.id),["stop"])},[s.createVNode(s.unref(Wc),{class:"h-3.5 w-3.5"})],10,b2)):s.createCommentVNode("",!0),o.value===w.id?(s.openBlock(),s.createElementBlock("div",g2,[s.createElementVNode("button",{type:"button",class:"flex w-full items-center px-3 py-1.5 text-xs hover:bg-slate-50 dark:hover:bg-slate-700/50",onClick:s.withModifiers(C=>f(w),["stop"])},s.toDisplayString(s.unref(i)("documentTabs.rename")),9,v2),s.createElementVNode("button",{type:"button",class:"flex w-full items-center px-3 py-1.5 text-xs text-red-600 dark:text-red-400 hover:bg-slate-50 dark:hover:bg-slate-700/50 disabled:opacity-40",disabled:e.tabs.length<=1,onClick:s.withModifiers(C=>d(w.id),["stop"])},s.toDisplayString(s.unref(i)("documentTabs.delete")),9,y2)])):s.createCommentVNode("",!0)])],2))),128))]),k[4]||(k[4]=s.createElementVNode("div",{class:"h-px bg-slate-200/80 dark:bg-slate-800 mx-2"},null,-1)),s.createElementVNode("div",x2,[s.createElementVNode("span",k2,s.toDisplayString(s.unref(i)("documentTabs.outline")),1),v.value.length>0?(s.openBlock(),s.createElementBlock("div",w2,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(v.value,w=>(s.openBlock(),s.createElementBlock("button",{key:w.id,type:"button",class:s.normalizeClass(["w-full text-left text-xs text-slate-500 dark:text-slate-400 hover:text-slate-800 dark:hover:text-slate-200 py-1 transition-colors truncate",[w.level===2?"pl-3":"",w.level===3?"pl-6":""]]),onClick:C=>g(w)},s.toDisplayString(w.text),11,_2))),128))])):(s.openBlock(),s.createElementBlock("p",S2,s.toDisplayString(s.unref(i)("documentTabs.placeholder")),1))])]),s.createElementVNode("div",C2,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n.tabs,w=>(s.openBlock(),s.createElementBlock("button",{key:w.id,type:"button",class:s.normalizeClass(["flex h-8 w-8 items-center justify-center rounded-lg transition-colors",[w.active?"bg-blue-100 text-blue-600 dark:bg-blue-950/40 dark:text-blue-300":"text-slate-500 hover:bg-slate-200 dark:text-slate-400 dark:hover:bg-slate-800"]]),title:w.label,onClick:C=>a("select-tab",w.id)},[s.createVNode(s.unref(sn),{class:"h-4 w-4"})],10,E2))),128))])]))}});Object.defineProperty(exports,"httpKeyStorage",{enumerable:!0,get:()=>_e.httpKeyStorage});Object.defineProperty(exports,"localStorageKeyStorage",{enumerable:!0,get:()=>_e.localStorageKeyStorage});Object.defineProperty(exports,"memoryKeyStorage",{enumerable:!0,get:()=>_e.memoryKeyStorage});Object.defineProperty(exports,"openaiCompatibleProvider",{enumerable:!0,get:()=>_e.openaiCompatibleProvider});Object.defineProperty(exports,"toAIStreamFn",{enumerable:!0,get:()=>_e.toAIStreamFn});exports.AISidebar=op;exports.BubbleMenu=ru;exports.CommentsSidebar=sp;exports.DetailsDialog=cp;exports.DocsEditor=KE;exports.DocumentTabsSidebar=N2;exports.EditorToolbar=nu;exports.EmailDialog=up;exports.HeaderBar=iu;exports.HistorySidebar=lp;exports.PageView=i2;exports.SlashMenu=jc;exports.StatusBar=au;exports.TOCSidebar=ou;exports.ThemeToggle=Ao;exports.defaultLocale=ls;exports.getLocaleMessages=Lc;exports.getLocaleName=Uc;exports.getSupportedLocales=Hc;exports.isLocale=$r;exports.messages=qr;exports.provideLocale=Fc;exports.useAIProvider=Tp;exports.useEditor=Ic;exports.useLocale=rt;exports.useTheme=Ba;
15077
+ `," ")}},wp=async()=>{const N=Xs();if(!N||!G.value)return;await Mc(N.text,N.html)&&G.value.chain().focus().deleteSelection().run()},_p=async()=>{var A;const N=Xs();N&&(await Mc(N.text,N.html),(A=G.value)==null||A.commands.focus())},Sp=async()=>{if(!G.value)return;const N=await OC();if(N){const z=_e.sanitizePastedHTML(N);try{G.value.chain().focus().insertContent(z).run()}catch(le){console.error("[DocsEditor] paste HTML failed, falling back to plain text:",le);const ue=await wo();if(ue)try{G.value.chain().focus().insertContent(ue).run()}catch(xe){console.error("[DocsEditor] paste plain text also failed:",xe)}}return}const A=await wo();if(A)try{G.value.chain().focus().insertContent(A).run()}catch(z){console.error("[DocsEditor] paste plain text failed:",z)}},Js=async()=>{if(!G.value)return;const N=await wo();N&&G.value.chain().focus().insertContent(N).run()},Cp=()=>{if(!G.value)return;const{state:N}=G.value;if(N.selection.empty){const{from:A,to:z}=N.selection;z<N.doc.content.size&&G.value.chain().focus().deleteRange({from:A,to:z+1}).run()}else G.value.chain().focus().deleteSelection().run()},Zs=N=>{var A;if(N.key==="Escape"&&$.value){$.value=!1;return}!(N.metaKey||N.ctrlKey)||!N.shiftKey||(A=G.value)!=null&&A.view.dom.contains(N.target)&&(N.key.toLowerCase()==="v"?(N.preventDefault(),Js()):N.key.toLowerCase()==="h"&&(N.preventDefault(),pr.value=!0))};s.onMounted(()=>document.addEventListener("keydown",Zs)),s.onUnmounted(()=>document.removeEventListener("keydown",Zs));const Qs={undo:()=>ht("undo"),redo:()=>ht("redo"),"select-all":()=>ht("selectAll"),cut:()=>{wp()},copy:()=>{_p()},paste:()=>{Sp()},"paste-without-formatting":()=>{Js()},delete:()=>Cp(),bold:()=>ht("toggleBold"),italic:()=>ht("toggleItalic"),underline:()=>ht("toggleUnderline"),heading1:()=>ht("toggleHeading",{level:1}),heading2:()=>ht("toggleHeading",{level:2}),heading3:()=>ht("toggleHeading",{level:3}),"align-left":()=>Bt("alignLeft"),"align-center":()=>Bt("alignCenter"),"align-right":()=>Bt("alignRight"),"align-justify":()=>Bt("alignJustify"),"bullet-list":()=>ht("toggleBulletList"),"numbered-list":()=>ht("toggleOrderedList"),"task-list":()=>Bt("toggleTaskList"),"horizontal-line":()=>ht("setHorizontalRule"),"page-numbers-header":()=>Ks("header"),"page-numbers-footer":()=>Ks("footer"),"clear-formatting":()=>{G.value&&(G.value.chain().unsetAllMarks().clearNodes().run(),ht("setTextAlign","left"))},"insert-image":()=>Bt("insertImage"),"insert-table":()=>Bt("insertTable",{rows:3,cols:3,withHeaderRow:!0}),"insert-code":()=>Bt("toggleCodeBlock"),"insert-page-break":()=>Bt("insertPageBreak"),"insert-toc":()=>Bt("insertToc")};let Ep=N=>{if(N==="page-setup")dp();else if(N==="print")Ys();else if(N==="version-history")yr("history");else if(N==="details")Xa.value=!0;else if(N==="email")Ja.value=!0;else if(N==="find-replace")pr.value=!0;else if(N==="insert-link")Ws();else if(N==="security")n("share");else if(N==="insert-header")gr();else if(N==="insert-footer")vr();else if(N==="toggle-pageless")oi(!m.value);else if(N==="toggle-left-sidebar")yr("toc");else if(N==="toggle-ruler")M.value=!M.value;else if(N==="toggle-focus-mode")$.value=!$.value,$.value&&(V.value=null);else if(N==="insert-footnote"){if(!G.value)return;const{state:A,view:z}=G.value,le=A.schema.nodes.footnote;if(!le){console.error("[DocsEditor] footnote node type not registered in schema");return}const ue=A.selection.head,xe=le.create({content:""}),Oe=A.tr.insert(ue,xe);z.dispatch(Oe),z.focus(),setTimeout(()=>{Oi();const Ee=document.querySelectorAll(".docs-footnote-item-text"),me=Ee[Ee.length-1];me&&(me.scrollIntoView({behavior:"smooth",block:"nearest"}),me.focus())},160)}else Qs[N]?Qs[N]():n("menu-click",N)},yr=N=>{V.value=V.value===N?null:N},Ys=()=>window.print();const Np=(N,A)=>{if(!G.value)return;const z=G.value.view;z.state.doc.descendants((le,ue)=>{if(le.type.name==="footnote"&&z.nodeDOM(ue)===N)return z.dispatch(z.state.tr.setNodeMarkup(ue,void 0,{content:A})),!1})},Oi=()=>{var Ee;if(!G.value||!we.value)return;const N=G.value.view.dom,A=N.querySelector("[data-rm-pagination]");if(!A)return;const z=me=>{var be,Ne,Ce;const pe=document.createElement("div");if(pe.className="docs-footnote-item-text",me.hasAttribute("data-footnote-source-id")){const Me=me.getAttribute("data-citation-id")??"",Te=(Ne=(be=G.value)==null?void 0:be.storage)==null?void 0:Ne.citation,Le=((Ce=Te==null?void 0:Te.engine)==null?void 0:Ce.renderCluster(Me))??"";return pe.classList.add("docs-footnote-item-text--citation"),Le?pe.innerHTML=Le:pe.setAttribute("data-empty","true"),pe}const ce=me.getAttribute("data-footnote-content")??"";return pe.contentEditable="true",pe.textContent=ce,ce||pe.setAttribute("data-empty","true"),pe.addEventListener("input",()=>{pe.removeAttribute("data-empty"),pe.textContent||pe.setAttribute("data-empty","true")}),pe.addEventListener("blur",()=>{var Te;const Me=((Te=pe.textContent)==null?void 0:Te.trim())??"";Np(me,Me)}),pe},le=Array.from(A.querySelectorAll(".rm-page-break")),ue=Array.from(N.querySelectorAll(".docs-footnote-ref"));if(le.length===0){ue.forEach((Ne,Ce)=>{Ne.textContent=String(Ce+1)});const me=ke.value;if(!me||((Ee=me.querySelector(".docs-pageless-footnotes"))==null||Ee.remove(),ue.length===0))return;const pe=me.querySelector(".docs-pageless-footnotes");if(pe!=null&&pe.querySelector(".docs-footnote-item-text:focus"))return;const ce=document.createElement("div");ce.className="docs-page-footnotes docs-pageless-footnotes";const be=document.createElement("div");be.className="docs-footnotes-sep",ce.appendChild(be),ue.forEach((Ne,Ce)=>{const Me=document.createElement("div");Me.className="docs-footnote-item";const Te=document.createElement("sup");Te.className="docs-footnote-item-num",Te.textContent=String(Ce+1);const Le=z(Ne);Ne.dataset.footnoteItemId=`fn-pageless-${Ce}`,Me.id=`fn-pageless-${Ce}`,Me.appendChild(Te),Me.appendChild(Le),ce.appendChild(Me)}),me.appendChild(ce);return}const xe=new Map;le.forEach((me,pe)=>xe.set(pe,[])),ue.forEach(me=>{const pe=me.getBoundingClientRect().top;let ce=le.length-1;for(let be=0;be<le.length-1;be++){const Ne=le[be].querySelector(".breaker");if(Ne&&pe<Ne.getBoundingClientRect().top){ce=be;break}}xe.get(ce).push(me)});let Oe=1;le.forEach((me,pe)=>{const ce=xe.get(pe)??[],be=Oe;Oe+=ce.length,ce.forEach((Le,Je)=>{Le.textContent=String(be+Je)});const Ne=me.querySelector(".docs-page-footnotes");if(Ne!=null&&Ne.querySelector(".docs-footnote-item-text:focus")||(Ne==null||Ne.remove(),ce.length===0))return;const Ce=document.createElement("div");Ce.className="docs-page-footnotes";const Me=document.createElement("div");Me.className="docs-footnotes-sep",Ce.appendChild(Me),ce.forEach((Le,Je)=>{const St=document.createElement("div");St.className="docs-footnote-item";const Ti=document.createElement("sup");Ti.className="docs-footnote-item-num",Ti.textContent=String(be+Je);const xr=z(Le);Le.dataset.footnoteItemId=`fn-${pe}-${Je}`,St.id=`fn-${pe}-${Je}`,St.appendChild(Ti),St.appendChild(xr),Ce.appendChild(St)});const Te=me.querySelector(".breaker");Te?Te.insertBefore(Ce,Te.firstChild):me.appendChild(Ce)})};return s.watch(we,N=>{!N||!G.value||G.value.view.dom.addEventListener("click",A=>{const z=A.target.closest(".docs-footnote-ref");if(!z)return;A.preventDefault(),A.stopPropagation();const le=z.dataset.footnoteItemId;if(!le)return;const ue=document.getElementById(le),xe=ue==null?void 0:ue.querySelector(".docs-footnote-item-text");if(xe){xe.scrollIntoView({behavior:"smooth",block:"nearest"}),xe.focus();const Oe=document.createRange();Oe.selectNodeContents(xe),Oe.collapse(!1);const Ee=window.getSelection();Ee==null||Ee.removeAllRanges(),Ee==null||Ee.addRange(Oe)}})}),s.watch(we,N=>{var z;if(!N||!G.value)return;setTimeout(Oi,150),G.value.on("update",()=>{setTimeout(Oi,60)}),G.value.on("selectionUpdate",()=>{setTimeout(Oi,100)});const A=G.value.storage.citation;(z=A==null?void 0:A.engine)==null||z.onChange(()=>{setTimeout(Oi,30)}),window.addEventListener("resize",Oi)}),(N,A)=>(s.openBlock(),s.createElementBlock("div",TC,[$.value?s.createCommentVNode("",!0):(s.openBlock(),s.createBlock(iu,{key:0,title:e.title,editable:e.editable,collaborators:e.collaborators,starred:e.starred,"user-name":e.userName,"user-avatar":e.userAvatar,pageless:m.value,"outline-open":V.value==="toc","show-ruler":M.value,"focus-mode":$.value,onMenuClick:s.unref(Ep),onBack:A[0]||(A[0]=z=>N.$emit("back")),"onUpdate:title":A[1]||(A[1]=z=>N.$emit("update:title",z)),onToggleStar:A[2]||(A[2]=z=>N.$emit("toggle-star")),onExport:A[3]||(A[3]=z=>N.$emit("export",z)),onShare:A[4]||(A[4]=z=>N.$emit("share"))},{actions:s.withCtx(()=>[s.renderSlot(N.$slots,"header-actions",{},void 0,!0)]),"overflow-actions":s.withCtx(z=>[s.renderSlot(N.$slots,"overflow-actions",s.normalizeProps(s.guardReactiveProps(z)),void 0,!0)]),"user-menu":s.withCtx(z=>[s.renderSlot(N.$slots,"user-menu",s.normalizeProps(s.guardReactiveProps(z)),void 0,!0)]),_:3},8,["title","editable","collaborators","starred","user-name","user-avatar","pageless","outline-open","show-ruler","focus-mode","onMenuClick"])),$.value?s.createCommentVNode("",!0):(s.openBlock(),s.createBlock(nu,{key:1,actions:s.unref(yt),plugins:e.plugins,editor:s.unref(G),"active-sidebar":V.value,onToggleSidebar:s.unref(yr),onPrint:s.unref(Ys)},null,8,["actions","plugins","editor","active-sidebar","onToggleSidebar","onPrint"])),M.value&&!$.value?(s.openBlock(),s.createBlock(bb,{key:2,"layout-options":d.value},null,8,["layout-options"])):s.createCommentVNode("",!0),$.value?(s.openBlock(),s.createElementBlock("button",{key:3,type:"button",class:"fixed right-4 top-4 z-50 flex h-11 w-11 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-600 shadow-md transition-colors hover:bg-slate-100 dark:border-white/10 dark:bg-[#0e1525] dark:text-slate-300 dark:hover:bg-white/5",title:s.unref(o)("header.focusMode"),"aria-label":s.unref(o)("header.focusMode"),onClick:A[5]||(A[5]=z=>$.value=!1)},[s.createVNode(s.unref(wd),{class:"h-5 w-5"})],8,MC)):s.createCommentVNode("",!0),s.createVNode(ru,{visible:D.value,actions:s.unref(yt),position:H.value,editor:s.unref(G)},null,8,["visible","actions","position","editor"]),s.createVNode(jc,{editor:s.unref(G),commands:te.value},null,8,["editor","commands"]),s.createElementVNode("div",zC,[s.createVNode(bC,{"is-open":pr.value,editor:s.unref(G),onClose:A[6]||(A[6]=z=>pr.value=!1)},null,8,["is-open","editor"]),V.value==="toc"?(s.openBlock(),s.createBlock(ou,{key:0,editor:s.unref(G),onClose:A[7]||(A[7]=z=>V.value=null)},null,8,["editor"])):(s.openBlock(),s.createElementBlock("button",{key:1,type:"button",class:"absolute left-4 top-4 z-20 flex h-11 w-11 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-600 shadow-md transition-colors hover:bg-slate-100 dark:border-white/10 dark:bg-[#0e1525] dark:text-slate-300 dark:hover:bg-white/5",title:s.unref(o)("editor.showOutline"),onClick:A[8]||(A[8]=z=>s.unref(yr)("toc"))},[s.createVNode(s.unref(xd),{class:"h-5 w-5"})],8,IC)),s.createElementVNode("div",{ref_key:"scrollContainerRef",ref:Ci,class:"docs-editor-scroll relative flex flex-1 overflow-auto px-4 py-6 bg-slate-100 dark:bg-[#02040a]",onScroll:Wa},[M.value&&!$.value?(s.openBlock(),s.createBlock(yb,{key:0,"layout-options":d.value},null,8,["layout-options"])):s.createCommentVNode("",!0),s.createElementVNode("div",DC,[s.createElementVNode("div",{class:"relative w-full",style:s.normalizeStyle({maxWidth:h.value})},[b.value?(s.openBlock(),s.createBlock(Up,{key:0,data:s.unref(hn),"is-ready":s.unref(Ei)},null,8,["data","is-ready"])):s.createCommentVNode("",!0),s.unref(we)?s.createCommentVNode("",!0):(s.openBlock(),s.createElementBlock("div",{key:1,class:"absolute inset-0 z-10 flex flex-col items-center justify-center bg-white dark:bg-[#0e1525]/60 backdrop-blur-[2px] gap-3 rounded-lg","aria-label":s.unref(o)("editor.loadingDocument")},null,8,RC)),s.createElementVNode("div",{ref_key:"editorRef",ref:ke,class:s.normalizeClass(["docs-editor__paper outline-none text-slate-800 dark:text-[#e2e8f0]",{"opacity-40":!s.unref(we)}])},null,2)],4)])],544),V.value==="references"?(s.openBlock(),s.createBlock(sv,{key:2,sources:F.value,"active-style":q.value,"picker-mode":se.value,"can-import":Ot.value,importing:pt.value,"import-message":dt.value,onClose:A[9]||(A[9]=z=>V.value=null),onInsert:jt,onCreate:J,onUpdate:ze,onRemove:Ue,"onUpdate:style":qe,onImportDoi:ri,onImportBibliography:Xe},null,8,["sources","active-style","picker-mode","can-import","importing","import-message"])):s.createCommentVNode("",!0),V.value==="comments"?(s.openBlock(),s.createBlock(sp,{key:3,comments:i.comments,"selected-text-snippet":i.selectedTextSnippet,"selected-text-index":i.selectedTextIndex,"orphaned-ids":ee.value,onClose:A[10]||(A[10]=z=>V.value=null),onAddComment:A[11]||(A[11]=(z,le,ue)=>N.$emit("add-comment",z,le,ue)),onAddReply:A[12]||(A[12]=(z,le)=>N.$emit("add-reply",z,le)),onResolveComment:A[13]||(A[13]=z=>N.$emit("resolve-comment",z)),onDeleteComment:A[14]||(A[14]=z=>N.$emit("delete-comment",z))},null,8,["comments","selected-text-snippet","selected-text-index","orphaned-ids"])):s.createCommentVNode("",!0),V.value==="history"?(s.openBlock(),s.createBlock(lp,{key:4,snapshots:i.snapshots,"active-preview-index":i.activePreviewIndex,onSaveSnapshot:A[15]||(A[15]=z=>N.$emit("save-snapshot",z)),onRestoreSnapshot:A[16]||(A[16]=z=>N.$emit("restore-snapshot",z)),onPreviewSnapshot:A[17]||(A[17]=z=>N.$emit("preview-snapshot",z))},null,8,["snapshots","active-preview-index"])):s.createCommentVNode("",!0),V.value==="ai"?(s.openBlock(),s.createBlock(op,{key:5,editor:s.unref(G),"ai-stream":i.aiStream,"ai-draft":i.aiDraft,onClose:A[18]||(A[18]=z=>V.value=null)},null,8,["editor","ai-stream","ai-draft"])):s.createCommentVNode("",!0)]),$.value?s.createCommentVNode("",!0):(s.openBlock(),s.createBlock(au,{key:4,"connection-state":e.connectionState,"saving-status":L.value,"last-saved":Q.value,"word-count":P.value,"char-count":W.value,"page-count":qt.value,"current-page":mt.value,"page-size":p.value,"page-sizes":s.unref(Cn.PAGE_SIZES),pageless:m.value,"onUpdate:pageSize":A[19]||(A[19]=z=>{p.value=z,n("update:pageSize",z)})},null,8,["connection-state","saving-status","last-saved","word-count","char-count","page-count","current-page","page-size","page-sizes","pageless"])),ur.value?(s.openBlock(),s.createElementBlock("div",LC,[s.createElementVNode("div",BC,[s.createElementVNode("h2",PC,s.toDisplayString(s.unref(o)("editor.headerFooter.footer")),1),s.createElementVNode("div",VC,[s.createElementVNode("div",FC,[s.createElementVNode("h3",UC,s.toDisplayString(s.unref(o)("editor.headerFooter.footer")),1),s.createElementVNode("button",{type:"button",class:"text-[11px] text-red-500 hover:text-red-600 font-medium transition-colors",onClick:A[20]||(A[20]=z=>{vn.value="",yn.value=""})},s.toDisplayString(s.unref(o)("editor.headerFooter.clear")),1)]),s.createElementVNode("div",HC,[s.createElementVNode("div",null,[s.createElementVNode("label",jC,s.toDisplayString(s.unref(o)("editor.headerFooter.left")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[21]||(A[21]=z=>vn.value=z),type:"text",class:"w-full rounded-md border border-slate-200 bg-transparent px-3 py-1.5 text-xs focus:outline-none dark:border-slate-700",placeholder:s.unref(o)("editor.headerFooter.footerLeftPlaceholder")},null,8,qC),[[s.vModelText,vn.value]])]),s.createElementVNode("div",null,[s.createElementVNode("label",$C,s.toDisplayString(s.unref(o)("editor.headerFooter.right")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[22]||(A[22]=z=>yn.value=z),type:"text",class:"w-full rounded-md border border-slate-200 bg-transparent px-3 py-1.5 text-xs focus:outline-none dark:border-slate-700",placeholder:s.unref(o)("editor.headerFooter.footerRightPlaceholder")},null,8,WC),[[s.vModelText,yn.value]])])])]),s.createElementVNode("div",GC,s.toDisplayString(s.unref(o)("editor.headerFooter.variableInfo")),1),s.createElementVNode("div",KC,[s.createElementVNode("button",{type:"button",class:"rounded-md px-3 py-1.5 text-xs font-semibold hover:bg-slate-100 dark:hover:bg-white/5",onClick:A[23]||(A[23]=z=>ur.value=!1)},s.toDisplayString(s.unref(o)("editor.headerFooter.cancel")),1),s.createElementVNode("button",{type:"button",class:"rounded-md bg-blue-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-blue-700",onClick:kp},s.toDisplayString(s.unref(o)("editor.headerFooter.save")),1)])])])):s.createCommentVNode("",!0),er.value?(s.openBlock(),s.createElementBlock("div",XC,[s.createElementVNode("div",JC,[s.createElementVNode("h2",ZC,s.toDisplayString(s.unref(o)("editor.headerFooter.headerFooterFormatTitle")),1),s.createElementVNode("div",QC,[s.createElementVNode("h3",YC,s.toDisplayString(s.unref(o)("editor.headerFooter.marginSection")),1),s.createElementVNode("div",eE,[s.createElementVNode("div",null,[s.createElementVNode("label",tE,s.toDisplayString(s.unref(o)("editor.headerFooter.headerTopMargin"))+" (cm) ",1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[24]||(A[24]=z=>bn.value=z),type:"number",min:_o,max:So,step:zc,class:"w-full rounded-lg border border-slate-300 dark:border-slate-700 bg-white dark:bg-[#1a2332] px-3.5 py-2 text-sm text-slate-800 dark:text-slate-100 focus:border-blue-600 focus:ring-2 focus:ring-blue-500/20 focus:outline-none transition-all"},null,512),[[s.vModelText,bn.value,void 0,{number:!0}]])]),s.createElementVNode("div",null,[s.createElementVNode("label",iE,s.toDisplayString(s.unref(o)("editor.headerFooter.footerBottomMargin"))+" (cm) ",1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[25]||(A[25]=z=>gn.value=z),type:"number",min:_o,max:So,step:zc,class:"w-full rounded-lg border border-slate-300 dark:border-slate-700 bg-white dark:bg-[#1a2332] px-3.5 py-2 text-sm text-slate-800 dark:text-slate-100 focus:border-blue-600 focus:ring-2 focus:ring-blue-500/20 focus:outline-none transition-all"},null,512),[[s.vModelText,gn.value,void 0,{number:!0}]])])])]),s.createElementVNode("div",nE,[s.createElementVNode("h3",rE,s.toDisplayString(s.unref(o)("editor.headerFooter.layoutSection")),1),s.createElementVNode("div",aE,[s.createElementVNode("label",oE,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[26]||(A[26]=z=>tr.value=z),type:"checkbox",class:"w-4 h-4 rounded border-slate-300 text-blue-600 focus:ring-blue-500"},null,512),[[s.vModelCheckbox,tr.value]]),s.createElementVNode("span",null,s.toDisplayString(s.unref(o)("editor.headerFooter.differentFirstPage")),1)]),s.createElementVNode("label",sE,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[27]||(A[27]=z=>ir.value=z),type:"checkbox",class:"w-4 h-4 rounded border-slate-300 text-blue-600 focus:ring-blue-500"},null,512),[[s.vModelCheckbox,ir.value]]),s.createElementVNode("span",null,s.toDisplayString(s.unref(o)("editor.headerFooter.differentOddEven")),1)])])]),s.createElementVNode("div",lE,[s.createElementVNode("button",{type:"button",class:"rounded-full px-5 py-2 text-xs font-semibold text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-950/40 transition-colors",onClick:A[28]||(A[28]=z=>er.value=!1)},s.toDisplayString(s.unref(o)("editor.headerFooter.cancel")),1),s.createElementVNode("button",{type:"button",class:"rounded-full bg-blue-600 hover:bg-blue-700 px-6 py-2 text-xs font-semibold text-white shadow-md transition-colors",onClick:bp},s.toDisplayString(s.unref(o)("editor.headerFooter.apply")),1)])])])):s.createCommentVNode("",!0),nr.value?(s.openBlock(),s.createElementBlock("div",cE,[s.createElementVNode("div",uE,[s.createElementVNode("h2",fE,s.toDisplayString(s.unref(o)("editor.headerFooter.pageNumberTitle")),1),s.createElementVNode("div",pE,[s.createElementVNode("h3",dE,s.toDisplayString(s.unref(o)("editor.headerFooter.positionSection")),1),s.createElementVNode("div",mE,[s.createElementVNode("label",hE,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[29]||(A[29]=z=>Gi.value=z),type:"radio",value:"header",class:"w-4 h-4 text-blue-600 focus:ring-blue-500"},null,512),[[s.vModelRadio,Gi.value]]),s.createElementVNode("span",null,s.toDisplayString(s.unref(o)("editor.headerFooter.positionHeader")),1)]),s.createElementVNode("label",bE,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[30]||(A[30]=z=>Gi.value=z),type:"radio",value:"footer",class:"w-4 h-4 text-blue-600 focus:ring-blue-500"},null,512),[[s.vModelRadio,Gi.value]]),s.createElementVNode("span",null,s.toDisplayString(s.unref(o)("editor.headerFooter.positionFooter")),1)]),s.createElementVNode("label",gE,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[31]||(A[31]=z=>lr.value=z),type:"checkbox",class:"w-4 h-4 rounded border-slate-300 text-blue-600 focus:ring-blue-500"},null,512),[[s.vModelCheckbox,lr.value]]),s.createElementVNode("span",null,s.toDisplayString(s.unref(o)("editor.headerFooter.showOnFirstPage")),1)])])]),s.createElementVNode("div",vE,[s.createElementVNode("h3",yE,s.toDisplayString(s.unref(o)("editor.headerFooter.numberingSection")),1),s.createElementVNode("div",xE,[s.createElementVNode("div",kE,[s.createElementVNode("label",wE,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[32]||(A[32]=z=>Ki.value=z),type:"radio",value:"startAt",class:"w-4 h-4 text-blue-600 focus:ring-blue-500"},null,512),[[s.vModelRadio,Ki.value]]),s.createElementVNode("span",null,s.toDisplayString(s.unref(o)("editor.headerFooter.startAt")),1)]),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[33]||(A[33]=z=>cr.value=z),type:"number",min:"1",class:"w-16 rounded-md border border-slate-300 dark:border-slate-700 bg-white dark:bg-[#1a2332] px-2.5 py-1 text-xs text-slate-800 dark:text-slate-100 focus:border-blue-600 focus:outline-none"},null,512),[[s.vModelText,cr.value]])]),s.createElementVNode("label",_E,[s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[34]||(A[34]=z=>Ki.value=z),type:"radio",value:"continue",class:"w-4 h-4 text-blue-600 focus:ring-blue-500"},null,512),[[s.vModelRadio,Ki.value]]),s.createElementVNode("span",null,s.toDisplayString(s.unref(o)("editor.headerFooter.continueFromPrevious")),1)])])]),s.createElementVNode("div",SE,[s.createElementVNode("button",{type:"button",class:"rounded-full px-5 py-2 text-xs font-semibold text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-950/40 transition-colors",onClick:A[35]||(A[35]=z=>nr.value=!1)},s.toDisplayString(s.unref(o)("editor.headerFooter.cancel")),1),s.createElementVNode("button",{type:"button",class:"rounded-full bg-blue-600 hover:bg-blue-700 px-6 py-2 text-xs font-semibold text-white shadow-md transition-colors",onClick:vp},s.toDisplayString(s.unref(o)("editor.headerFooter.apply")),1)])])])):s.createCommentVNode("",!0),s.createVNode(up,{"is-open":Ja.value,"document-title":i.title,"share-url":i.shareUrl,onClose:A[36]||(A[36]=z=>Ja.value=!1),onCopyLink:A[37]||(A[37]=z=>n("share"))},null,8,["is-open","document-title","share-url"]),s.createVNode(cp,{"is-open":Xa.value,meta:i.documentMeta,onClose:A[38]||(A[38]=z=>Xa.value=!1)},null,8,["is-open","meta"]),s.createVNode(AC,{"is-open":xn.value,"initial-text":dr.value,"initial-url":Za.value,"is-editing":mr.value,onApply:fp,onRemove:pp,onClose:A[39]||(A[39]=z=>xn.value=!1)},null,8,["is-open","initial-text","initial-url","is-editing"]),fr.value?(s.openBlock(),s.createElementBlock("div",CE,[s.createElementVNode("div",EE,[s.createElementVNode("h2",NE,s.toDisplayString(s.unref(o)("editor.pageSetup.title")),1),s.createElementVNode("div",AE,[s.createElementVNode("label",OE,s.toDisplayString(s.unref(o)("editor.pageSetup.paperSize")),1),s.withDirectives(s.createElementVNode("select",{"onUpdate:modelValue":A[40]||(A[40]=z=>hr.value=z),class:"w-full rounded-md border border-slate-200 bg-transparent px-3 py-2 text-xs focus:outline-none dark:border-slate-700"},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(s.unref(Cn.PAGE_SIZES),z=>(s.openBlock(),s.createElementBlock("option",{key:z.id,value:z.id},s.toDisplayString(z.name),9,TE))),128))],512),[[s.vModelSelect,hr.value]])]),s.createElementVNode("div",ME,[s.createElementVNode("label",zE,s.toDisplayString(s.unref(o)("editor.pageSetup.orientation")),1),s.createElementVNode("div",IE,[s.createElementVNode("button",{type:"button",class:s.normalizeClass(["flex-1 rounded-md border px-3 py-2 text-xs font-medium transition-colors",Ni.value==="portrait"?"border-cyan-500 bg-cyan-50 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300":"border-slate-200 hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-white/5"]),onClick:A[41]||(A[41]=z=>Ni.value="portrait")},s.toDisplayString(s.unref(o)("editor.pageSetup.portrait")),3),s.createElementVNode("button",{type:"button",class:s.normalizeClass(["flex-1 rounded-md border px-3 py-2 text-xs font-medium transition-colors",Ni.value==="landscape"?"border-cyan-500 bg-cyan-50 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300":"border-slate-200 hover:bg-slate-50 dark:border-slate-700 dark:hover:bg-white/5"]),onClick:A[42]||(A[42]=z=>Ni.value="landscape")},s.toDisplayString(s.unref(o)("editor.pageSetup.landscape")),3)])]),s.createElementVNode("div",DE,[s.createElementVNode("label",RE,s.toDisplayString(s.unref(o)("editor.pageSetup.margins"))+" (cm)",1),s.createElementVNode("div",LE,[s.createElementVNode("div",null,[s.createElementVNode("label",BE,s.toDisplayString(s.unref(o)("editor.pageSetup.top")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[43]||(A[43]=z=>$e.value.top=z),type:"number",min:tn,max:s.unref(kn),step:"0.1",class:"w-full rounded-md border border-slate-200 bg-transparent px-3 py-1.5 text-xs focus:outline-none dark:border-slate-700"},null,8,PE),[[s.vModelText,$e.value.top,void 0,{number:!0}]])]),s.createElementVNode("div",null,[s.createElementVNode("label",VE,s.toDisplayString(s.unref(o)("editor.pageSetup.bottom")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[44]||(A[44]=z=>$e.value.bottom=z),type:"number",min:tn,max:s.unref(kn),step:"0.1",class:"w-full rounded-md border border-slate-200 bg-transparent px-3 py-1.5 text-xs focus:outline-none dark:border-slate-700"},null,8,FE),[[s.vModelText,$e.value.bottom,void 0,{number:!0}]])]),s.createElementVNode("div",null,[s.createElementVNode("label",UE,s.toDisplayString(s.unref(o)("editor.pageSetup.left")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[45]||(A[45]=z=>$e.value.left=z),type:"number",min:tn,max:s.unref(kn),step:"0.1",class:"w-full rounded-md border border-slate-200 bg-transparent px-3 py-1.5 text-xs focus:outline-none dark:border-slate-700"},null,8,HE),[[s.vModelText,$e.value.left,void 0,{number:!0}]])]),s.createElementVNode("div",null,[s.createElementVNode("label",jE,s.toDisplayString(s.unref(o)("editor.pageSetup.right")),1),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":A[46]||(A[46]=z=>$e.value.right=z),type:"number",min:tn,max:s.unref(kn),step:"0.1",class:"w-full rounded-md border border-slate-200 bg-transparent px-3 py-1.5 text-xs focus:outline-none dark:border-slate-700"},null,8,qE),[[s.vModelText,$e.value.right,void 0,{number:!0}]])])])]),s.createElementVNode("div",$E,[s.createElementVNode("button",{type:"button",class:"rounded-md px-3 py-1.5 text-xs font-semibold hover:bg-slate-100 dark:hover:bg-white/5",onClick:A[47]||(A[47]=z=>fr.value=!1)},s.toDisplayString(s.unref(o)("editor.pageSetup.cancel")),1),s.createElementVNode("button",{type:"button",class:"rounded-md bg-blue-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-blue-700",onClick:mp},s.toDisplayString(s.unref(o)("editor.pageSetup.apply")),1)])])])):s.createCommentVNode("",!0)]))}}),KE=cs(GE,[["__scopeId","data-v-b1a21a3e"]]),XE={class:"docs-editor-pages flex flex-col items-center gap-10"},JE=["data-page-index"],ZE=["data-node-type","data-from","data-to"],QE=["innerHTML"],YE={key:1,class:"docs-editor-page__block-fallback flex justify-between text-sm text-slate-700"},e2={class:"docs-editor-page__block-type font-medium"},t2={class:"docs-editor-page__block-range text-slate-500"},i2=s.defineComponent({__name:"PageView",props:{pages:{},editor:{default:null},layoutOptions:{default:()=>({pageWidth:794,pageHeight:1123,margins:{top:96,bottom:96,left:96,right:96}})},isPageless:{type:Boolean,default:!1},pageColor:{default:"#ffffff"}},setup(e){const t=e,i=s.ref(0),n=()=>{i.value++};s.watch(()=>t.editor,(d,h)=>{h&&typeof h.off=="function"&&h.off("update",n),d&&typeof d.on=="function"&&d.on("update",n)},{immediate:!0}),s.onUnmounted(()=>{t.editor&&typeof t.editor.off=="function"&&t.editor.off("update",n)});const r=s.computed(()=>{var d,h;return((h=(d=t.editor)==null?void 0:d.view)==null?void 0:h.dom)??null}),a=s.computed(()=>{var d,h,v;return{pageHeight:((d=t.layoutOptions)==null?void 0:d.pageHeight)??1123,pageWidth:((h=t.layoutOptions)==null?void 0:h.pageWidth)??794,margins:((v=t.layoutOptions)==null?void 0:v.margins)??{top:96,bottom:96,left:96,right:96},maxCharsPerPage:0}}),o=s.computed(()=>{const{pageWidth:d,pageHeight:h,margins:v}=a.value;return t.isPageless?{width:`${d}px`,minHeight:"auto",height:"auto",paddingTop:`${v.top}px`,paddingBottom:`${v.bottom}px`,paddingLeft:`${v.left}px`,paddingRight:`${v.right}px`,backgroundColor:t.pageColor,boxShadow:"none",border:"none",borderRadius:"0"}:{width:`${d}px`,height:`${h}px`,paddingTop:`${v.top}px`,paddingBottom:`${v.bottom}px`,paddingLeft:`${v.left}px`,paddingRight:`${v.right}px`}}),l=()=>r.value?Array.from(r.value.children).filter(d=>d instanceof HTMLElement):[],c=d=>l().find(v=>{const b=parseInt(v.getAttribute("data-from")??"-1",10),y=parseInt(v.getAttribute("data-to")??"-1",10);return b>=0&&y>=b&&b<=d.from&&y>=d.to})??null,f=d=>{if(!t.editor||!r.value||!c(d))return null;try{const v=t.editor.view,b=v.domAtPos(d.from),y=v.domAtPos(d.to);if(!b||!y)return null;const g=document.createRange();g.setStart(b.node,b.offset),g.setEnd(y.node,y.offset);const x=g.cloneContents(),k=document.createElement("div");return k.appendChild(x),k.innerHTML}catch{return null}},p=s.computed(()=>{i.value;const d=new Map;if(!t.editor||!r.value)return d;for(const h of t.pages)for(const v of h.blocks){const b=`${v.from}-${v.to}-${v.nodeType}`;if(d.has(b))continue;const y=f(v);y!==null&&d.set(b,y)}return d}),m=d=>p.value.get(`${d.from}-${d.to}-${d.nodeType}`)??null;return(d,h)=>(s.openBlock(),s.createElementBlock("div",XE,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.pages,(v,b)=>(s.openBlock(),s.createElementBlock("div",{key:`${b}-${v.from}-${v.to}`,class:s.normalizeClass(["docs-editor-page tiptap ProseMirror relative box-border overflow-hidden text-slate-800 dark:text-[#e2e8f0]",e.isPageless?"":"editor-page-shadow rounded-lg border border-slate-200/70 bg-white dark:border-white/5 dark:bg-[#0a0f1e]"]),"data-page-index":b,style:s.normalizeStyle(o.value)},[s.createElementVNode("div",{class:"docs-editor-page__blocks flex flex-col",style:s.normalizeStyle(e.isPageless?{}:{height:"100%",overflow:"hidden"})},[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(v.blocks,y=>(s.openBlock(),s.createElementBlock("div",{key:`${y.from}-${y.to}`,class:"docs-editor-page__block","data-node-type":y.nodeType,"data-from":y.from,"data-to":y.to},[m(y)!==null?(s.openBlock(),s.createElementBlock("div",{key:0,class:"docs-editor-page__block-content",innerHTML:m(y)},null,8,QE)):(s.openBlock(),s.createElementBlock("div",YE,[s.createElementVNode("span",e2,s.toDisplayString(y.nodeType),1),s.createElementVNode("span",t2,s.toDisplayString(y.from)+"–"+s.toDisplayString(y.to),1)]))],8,ZE))),128))],4)],14,JE))),128))]))}}),n2={class:"docs-editor-left-sidebar flex w-14 flex-shrink-0 flex-col items-center border-r border-slate-200 bg-slate-50/50 py-3 dark:border-slate-800 dark:bg-[#080d1a] md:w-64 md:items-stretch md:px-3"},r2={class:"mb-4 flex items-center justify-between px-1"},a2=["title"],o2={class:"hidden flex-col gap-4 md:flex"},s2={class:"flex items-center justify-between px-2"},l2={class:"text-xs font-semibold text-slate-500 dark:text-slate-400 uppercase tracking-wide"},c2=["title"],u2={class:"flex flex-col gap-1 pr-1"},f2=["onClick"],p2={class:"truncate"},d2={key:1,class:"flex flex-1 items-center gap-2 pr-6"},m2=["onBlur","onKeydown"],h2={class:"relative flex items-center"},b2=["onClick"],g2={key:1,class:"absolute right-0 top-6 z-50 w-28 rounded-lg border border-slate-200/80 bg-white py-1 shadow-lg dark:border-slate-700 dark:bg-slate-800 text-slate-700 dark:text-slate-200"},v2=["onClick"],y2=["disabled","onClick"],x2={class:"flex flex-col gap-1.5 px-2"},k2={class:"text-xs font-semibold text-slate-500 dark:text-slate-400 uppercase tracking-wide"},w2={key:0,class:"flex flex-col gap-1 mt-1"},_2=["onClick"],S2={key:1,class:"text-xs leading-relaxed text-slate-400 dark:text-slate-500 italic mt-1 font-sans"},C2={class:"flex flex-col gap-2 md:hidden"},E2=["title","onClick"],N2=s.defineComponent({__name:"DocumentTabsSidebar",props:{tabs:{default:()=>[{id:"tab-1",label:"Tab 1",active:!0}]},editor:{default:null},backTitle:{default:""}},emits:["collapse","add-tab","select-tab","delete-tab","rename-tab"],setup(e,{emit:t}){const{t:i}=rt(),n=e,r=s.computed(()=>n.backTitle||i("common.cancel")),a=t,o=s.ref(null),l=s.ref(null),c=s.ref(""),f=x=>{l.value=x.id,c.value=x.label,o.value=null},p=x=>{c.value.trim()&&a("rename-tab",{id:x,label:c.value.trim()}),l.value=null},m=()=>{l.value=null},d=x=>{a("delete-tab",x),o.value=null},h=x=>{o.value=o.value===x?null:x},v=s.ref([]),b=()=>{if(!n.editor)return;const x=[];n.editor.state.doc.descendants((k,w)=>{if(k.type.name==="heading"){const C=k.attrs.level;(C===1||C===2||C===3)&&x.push({id:`heading-${w}`,text:k.textContent.trim()||i("documentTabs.untitledHeading").replace("{level}",String(C)),level:C,pos:w})}return!0}),v.value=x};let y=null;s.watch(()=>n.editor,x=>{if(y&&(y(),y=null),!x){v.value=[];return}b();const k=()=>{b()};x.on("update",k),y=()=>{x.off("update",k)}},{immediate:!0});const g=x=>{n.editor&&(n.editor.chain().focus().setTextSelection(x.pos).run(),setTimeout(()=>{var C;const k=document.querySelector(".docs-editor-scroll");if(!k)return;const w=k.querySelectorAll(".ProseMirror h1, .ProseMirror h2, .ProseMirror h3");for(const E of Array.from(w))if(((C=E.textContent)==null?void 0:C.trim())===x.text){E.scrollIntoView({behavior:"smooth",block:"center"});return}},50))};return(x,k)=>(s.openBlock(),s.createElementBlock("aside",n2,[s.createElementVNode("div",r2,[s.createElementVNode("button",{type:"button",class:"flex h-8 w-8 items-center justify-center rounded-full text-slate-500 transition-colors hover:bg-slate-200/80 dark:text-slate-400 dark:hover:bg-slate-800/80",title:r.value,onClick:k[0]||(k[0]=w=>a("collapse"))},[s.createVNode(s.unref(Zp),{class:"h-[18px] w-[18px]"})],8,a2)]),s.createElementVNode("div",o2,[s.createElementVNode("div",s2,[s.createElementVNode("span",l2,s.toDisplayString(s.unref(i)("documentTabs.documentTabs")),1),s.createElementVNode("button",{type:"button",class:"flex h-6 w-6 items-center justify-center rounded-full text-slate-600 hover:bg-slate-200 dark:text-slate-400 dark:hover:bg-slate-800 transition-colors",title:s.unref(i)("documentTabs.addTab"),onClick:k[1]||(k[1]=w=>a("add-tab"))},[s.createVNode(s.unref(gi),{class:"h-4 w-4"})],8,c2)]),s.createElementVNode("div",u2,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(e.tabs,w=>(s.openBlock(),s.createElementBlock("div",{key:w.id,class:s.normalizeClass(["group relative flex w-full items-center justify-between rounded-r-full py-1.5 pl-3 pr-2 text-left text-sm transition-all",[w.active?"bg-[#c2e7ff]/70 text-[#001d35] dark:bg-blue-950/40 dark:text-blue-200 font-medium":"text-slate-700 hover:bg-slate-200/40 dark:text-slate-300 dark:hover:bg-slate-800/30"]])},[l.value!==w.id?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:"flex flex-1 items-center gap-2 truncate pr-6 text-left",onClick:C=>a("select-tab",w.id)},[s.createVNode(s.unref(sn),{class:"h-4 w-4 flex-shrink-0 opacity-70"}),s.createElementVNode("span",p2,s.toDisplayString(w.label),1)],8,f2)):s.createCommentVNode("",!0),l.value===w.id?(s.openBlock(),s.createElementBlock("div",d2,[s.createVNode(s.unref(sn),{class:"h-4 w-4 flex-shrink-0 opacity-70"}),s.withDirectives(s.createElementVNode("input",{"onUpdate:modelValue":k[2]||(k[2]=C=>c.value=C),type:"text",class:"flex-1 rounded border border-blue-400 bg-white px-1.5 py-0.5 text-xs text-slate-800 outline-none focus:ring-1 focus:ring-blue-400/50 dark:bg-slate-900 dark:text-slate-100",onBlur:C=>p(w.id),onKeydown:[s.withKeys(C=>p(w.id),["enter"]),s.withKeys(m,["esc"])],onClick:k[3]||(k[3]=s.withModifiers(()=>{},["stop"]))},null,40,m2),[[s.vModelText,c.value]])])):s.createCommentVNode("",!0),s.createElementVNode("div",h2,[l.value!==w.id?(s.openBlock(),s.createElementBlock("button",{key:0,type:"button",class:s.normalizeClass(["rounded-full p-1 text-slate-500 opacity-0 transition-opacity hover:bg-slate-200/70 group-hover:opacity-100 dark:hover:bg-slate-700/70",{"opacity-100":o.value===w.id}]),onClick:s.withModifiers(C=>h(w.id),["stop"])},[s.createVNode(s.unref(Wc),{class:"h-3.5 w-3.5"})],10,b2)):s.createCommentVNode("",!0),o.value===w.id?(s.openBlock(),s.createElementBlock("div",g2,[s.createElementVNode("button",{type:"button",class:"flex w-full items-center px-3 py-1.5 text-xs hover:bg-slate-50 dark:hover:bg-slate-700/50",onClick:s.withModifiers(C=>f(w),["stop"])},s.toDisplayString(s.unref(i)("documentTabs.rename")),9,v2),s.createElementVNode("button",{type:"button",class:"flex w-full items-center px-3 py-1.5 text-xs text-red-600 dark:text-red-400 hover:bg-slate-50 dark:hover:bg-slate-700/50 disabled:opacity-40",disabled:e.tabs.length<=1,onClick:s.withModifiers(C=>d(w.id),["stop"])},s.toDisplayString(s.unref(i)("documentTabs.delete")),9,y2)])):s.createCommentVNode("",!0)])],2))),128))]),k[4]||(k[4]=s.createElementVNode("div",{class:"h-px bg-slate-200/80 dark:bg-slate-800 mx-2"},null,-1)),s.createElementVNode("div",x2,[s.createElementVNode("span",k2,s.toDisplayString(s.unref(i)("documentTabs.outline")),1),v.value.length>0?(s.openBlock(),s.createElementBlock("div",w2,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(v.value,w=>(s.openBlock(),s.createElementBlock("button",{key:w.id,type:"button",class:s.normalizeClass(["w-full text-left text-xs text-slate-500 dark:text-slate-400 hover:text-slate-800 dark:hover:text-slate-200 py-1 transition-colors truncate",[w.level===2?"pl-3":"",w.level===3?"pl-6":""]]),onClick:C=>g(w)},s.toDisplayString(w.text),11,_2))),128))])):(s.openBlock(),s.createElementBlock("p",S2,s.toDisplayString(s.unref(i)("documentTabs.placeholder")),1))])]),s.createElementVNode("div",C2,[(s.openBlock(!0),s.createElementBlock(s.Fragment,null,s.renderList(n.tabs,w=>(s.openBlock(),s.createElementBlock("button",{key:w.id,type:"button",class:s.normalizeClass(["flex h-8 w-8 items-center justify-center rounded-lg transition-colors",[w.active?"bg-blue-100 text-blue-600 dark:bg-blue-950/40 dark:text-blue-300":"text-slate-500 hover:bg-slate-200 dark:text-slate-400 dark:hover:bg-slate-800"]]),title:w.label,onClick:C=>a("select-tab",w.id)},[s.createVNode(s.unref(sn),{class:"h-4 w-4"})],10,E2))),128))])]))}});Object.defineProperty(exports,"httpKeyStorage",{enumerable:!0,get:()=>_e.httpKeyStorage});Object.defineProperty(exports,"localStorageKeyStorage",{enumerable:!0,get:()=>_e.localStorageKeyStorage});Object.defineProperty(exports,"memoryKeyStorage",{enumerable:!0,get:()=>_e.memoryKeyStorage});Object.defineProperty(exports,"openaiCompatibleProvider",{enumerable:!0,get:()=>_e.openaiCompatibleProvider});Object.defineProperty(exports,"toAIStreamFn",{enumerable:!0,get:()=>_e.toAIStreamFn});exports.AISidebar=op;exports.BubbleMenu=ru;exports.CommentsSidebar=sp;exports.DetailsDialog=cp;exports.DocsEditor=KE;exports.DocumentTabsSidebar=N2;exports.EditorToolbar=nu;exports.EmailDialog=up;exports.HeaderBar=iu;exports.HistorySidebar=lp;exports.PageView=i2;exports.SlashMenu=jc;exports.StatusBar=au;exports.TOCSidebar=ou;exports.ThemeToggle=Ao;exports.defaultLocale=ls;exports.getLocaleMessages=Lc;exports.getLocaleName=Uc;exports.getSupportedLocales=Hc;exports.isLocale=$r;exports.messages=qr;exports.provideLocale=Fc;exports.useAIProvider=Tp;exports.useEditor=Ic;exports.useLocale=rt;exports.useTheme=Ba;