eyecite-ts 0.11.2 → 0.12.0
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/annotate/index.d.cts +1 -1
- package/dist/annotate/index.d.mts +1 -1
- package/dist/{citation-QWV-tQTp.d.mts → citation-C-GPQmt3.d.mts} +30 -2
- package/dist/citation-C-GPQmt3.d.mts.map +1 -0
- package/dist/{citation-czEmctrl.d.cts → citation-ChDj3ZlY.d.cts} +30 -2
- package/dist/citation-ChDj3ZlY.d.cts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/{types-C0rWllk3.d.mts → types-C7IqHYnj.d.cts} +2 -2
- package/dist/{types-C0rWllk3.d.mts.map → types-C7IqHYnj.d.cts.map} +1 -1
- package/dist/{types-CV5ypq6q.d.cts → types-lHL_1ON_.d.mts} +2 -2
- package/dist/{types-CV5ypq6q.d.cts.map → types-lHL_1ON_.d.mts.map} +1 -1
- package/dist/utils/index.d.cts +2 -2
- package/dist/utils/index.d.mts +2 -2
- package/package.json +1 -1
- package/dist/citation-QWV-tQTp.d.mts.map +0 -1
- package/dist/citation-czEmctrl.d.cts.map +0 -1
|
@@ -7,8 +7,11 @@ interface PinciteInfo {
|
|
|
7
7
|
page: number;
|
|
8
8
|
/** End page for ranges: "570-75" → 575 */
|
|
9
9
|
endPage?: number;
|
|
10
|
-
/** Footnote number: "570 n.3" → 3
|
|
10
|
+
/** Footnote number: "570 n.3" → 3. For multi-footnote refs ("nn.3-5"), the
|
|
11
|
+
* first note; see `footnoteEnd` for the range end. */
|
|
11
12
|
footnote?: number;
|
|
13
|
+
/** End footnote for multi-note refs: "570 nn.3-5" → 5 */
|
|
14
|
+
footnoteEnd?: number;
|
|
12
15
|
/** True if this is a page range */
|
|
13
16
|
isRange: boolean;
|
|
14
17
|
/** True when the pincite uses star-pagination (e.g., "*2"), denoting a
|
|
@@ -198,9 +201,28 @@ interface NeutralComponentSpans {
|
|
|
198
201
|
year?: Span;
|
|
199
202
|
court?: Span;
|
|
200
203
|
documentNumber?: Span;
|
|
204
|
+
pincite?: Span;
|
|
201
205
|
signal?: Span;
|
|
202
206
|
}
|
|
203
207
|
/**
|
|
208
|
+
* Component spans for Id./Ibid. citations (type: "id").
|
|
209
|
+
*/
|
|
210
|
+
interface IdComponentSpans {
|
|
211
|
+
pincite?: Span;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Component spans for supra citations (type: "supra").
|
|
215
|
+
*/
|
|
216
|
+
interface SupraComponentSpans {
|
|
217
|
+
pincite?: Span;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Component spans for short-form case citations (type: "shortFormCase").
|
|
221
|
+
*/
|
|
222
|
+
interface ShortFormCaseComponentSpans {
|
|
223
|
+
pincite?: Span;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
204
226
|
* Component spans for public law citations (type: "publicLaw").
|
|
205
227
|
*
|
|
206
228
|
* Note: `signal` is included for future extensibility but is currently only
|
|
@@ -677,6 +699,8 @@ interface IdCitation extends CitationBase {
|
|
|
677
699
|
pincite?: number;
|
|
678
700
|
/** Structured pincite information (page, range, footnote, star-pagination). */
|
|
679
701
|
pinciteInfo?: PinciteInfo;
|
|
702
|
+
/** Component-level spans (currently just `pincite`; extend when needed). */
|
|
703
|
+
spans?: IdComponentSpans;
|
|
680
704
|
}
|
|
681
705
|
/**
|
|
682
706
|
* Supra citation (refers to earlier citation by party name).
|
|
@@ -692,6 +716,8 @@ interface SupraCitation extends CitationBase {
|
|
|
692
716
|
pincite?: number;
|
|
693
717
|
/** Structured pincite information (page, range, footnote, star-pagination). */
|
|
694
718
|
pinciteInfo?: PinciteInfo;
|
|
719
|
+
/** Component-level spans (currently just `pincite`; extend when needed). */
|
|
720
|
+
spans?: SupraComponentSpans;
|
|
695
721
|
}
|
|
696
722
|
/**
|
|
697
723
|
* Short-form case citation (abbreviated reference to earlier full citation).
|
|
@@ -707,6 +733,8 @@ interface ShortFormCaseCitation extends CitationBase {
|
|
|
707
733
|
pincite?: number;
|
|
708
734
|
/** Structured pincite information (page, range, footnote, star-pagination). */
|
|
709
735
|
pinciteInfo?: PinciteInfo;
|
|
736
|
+
/** Component-level spans (currently just `pincite`; extend when needed). */
|
|
737
|
+
spans?: ShortFormCaseComponentSpans;
|
|
710
738
|
}
|
|
711
739
|
/**
|
|
712
740
|
* Union type of all citation types.
|
|
@@ -758,4 +786,4 @@ type CitationOfType<T extends CitationType> = Extract<Citation, {
|
|
|
758
786
|
type ExtractorMap = { [K in FullCitationType]: CitationOfType<K> };
|
|
759
787
|
//#endregion
|
|
760
788
|
export { FederalRegisterComponentSpans as A, parsePincite as B, StatuteCitation as C, Warning as D, SupraCitation as E, StatutesAtLargeComponentSpans as F, Span as I, TransformationMap as L, NeutralComponentSpans as M, PublicLawComponentSpans as N, CaseComponentSpans as O, StatuteComponentSpans as P, spanFromGroupIndex as R, ShortFormCitationType as S, SubsequentHistoryEntry as T, Parenthetical as _, CitationType as a, ShortFormCaseCitation as b, ExtractorMap as c, FullCitation as d, FullCitationType as f, NeutralCitation as g, JournalCitation as h, CitationSignal as i, JournalComponentSpans as j, ConstitutionalComponentSpans as k, FederalRegisterCitation as l, IdCitation as m, CitationBase as n, ConstitutionalCitation as o, HistorySignal as p, CitationOfType as r, CourtInference as s, Citation as t, FullCaseCitation as u, ParentheticalType as v, StatutesAtLargeCitation as w, ShortFormCitation as x, PublicLawCitation as y, PinciteInfo as z };
|
|
761
|
-
//# sourceMappingURL=citation-
|
|
789
|
+
//# sourceMappingURL=citation-C-GPQmt3.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation-C-GPQmt3.d.mts","names":[],"sources":["../src/extract/pincite.ts","../src/clean/segmentMap.ts","../src/types/span.ts","../src/types/componentSpans.ts","../src/types/citation.ts"],"mappings":"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"}
|
|
@@ -7,8 +7,11 @@ interface PinciteInfo {
|
|
|
7
7
|
page: number;
|
|
8
8
|
/** End page for ranges: "570-75" → 575 */
|
|
9
9
|
endPage?: number;
|
|
10
|
-
/** Footnote number: "570 n.3" → 3
|
|
10
|
+
/** Footnote number: "570 n.3" → 3. For multi-footnote refs ("nn.3-5"), the
|
|
11
|
+
* first note; see `footnoteEnd` for the range end. */
|
|
11
12
|
footnote?: number;
|
|
13
|
+
/** End footnote for multi-note refs: "570 nn.3-5" → 5 */
|
|
14
|
+
footnoteEnd?: number;
|
|
12
15
|
/** True if this is a page range */
|
|
13
16
|
isRange: boolean;
|
|
14
17
|
/** True when the pincite uses star-pagination (e.g., "*2"), denoting a
|
|
@@ -198,9 +201,28 @@ interface NeutralComponentSpans {
|
|
|
198
201
|
year?: Span;
|
|
199
202
|
court?: Span;
|
|
200
203
|
documentNumber?: Span;
|
|
204
|
+
pincite?: Span;
|
|
201
205
|
signal?: Span;
|
|
202
206
|
}
|
|
203
207
|
/**
|
|
208
|
+
* Component spans for Id./Ibid. citations (type: "id").
|
|
209
|
+
*/
|
|
210
|
+
interface IdComponentSpans {
|
|
211
|
+
pincite?: Span;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Component spans for supra citations (type: "supra").
|
|
215
|
+
*/
|
|
216
|
+
interface SupraComponentSpans {
|
|
217
|
+
pincite?: Span;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Component spans for short-form case citations (type: "shortFormCase").
|
|
221
|
+
*/
|
|
222
|
+
interface ShortFormCaseComponentSpans {
|
|
223
|
+
pincite?: Span;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
204
226
|
* Component spans for public law citations (type: "publicLaw").
|
|
205
227
|
*
|
|
206
228
|
* Note: `signal` is included for future extensibility but is currently only
|
|
@@ -677,6 +699,8 @@ interface IdCitation extends CitationBase {
|
|
|
677
699
|
pincite?: number;
|
|
678
700
|
/** Structured pincite information (page, range, footnote, star-pagination). */
|
|
679
701
|
pinciteInfo?: PinciteInfo;
|
|
702
|
+
/** Component-level spans (currently just `pincite`; extend when needed). */
|
|
703
|
+
spans?: IdComponentSpans;
|
|
680
704
|
}
|
|
681
705
|
/**
|
|
682
706
|
* Supra citation (refers to earlier citation by party name).
|
|
@@ -692,6 +716,8 @@ interface SupraCitation extends CitationBase {
|
|
|
692
716
|
pincite?: number;
|
|
693
717
|
/** Structured pincite information (page, range, footnote, star-pagination). */
|
|
694
718
|
pinciteInfo?: PinciteInfo;
|
|
719
|
+
/** Component-level spans (currently just `pincite`; extend when needed). */
|
|
720
|
+
spans?: SupraComponentSpans;
|
|
695
721
|
}
|
|
696
722
|
/**
|
|
697
723
|
* Short-form case citation (abbreviated reference to earlier full citation).
|
|
@@ -707,6 +733,8 @@ interface ShortFormCaseCitation extends CitationBase {
|
|
|
707
733
|
pincite?: number;
|
|
708
734
|
/** Structured pincite information (page, range, footnote, star-pagination). */
|
|
709
735
|
pinciteInfo?: PinciteInfo;
|
|
736
|
+
/** Component-level spans (currently just `pincite`; extend when needed). */
|
|
737
|
+
spans?: ShortFormCaseComponentSpans;
|
|
710
738
|
}
|
|
711
739
|
/**
|
|
712
740
|
* Union type of all citation types.
|
|
@@ -758,4 +786,4 @@ type CitationOfType<T extends CitationType> = Extract<Citation, {
|
|
|
758
786
|
type ExtractorMap = { [K in FullCitationType]: CitationOfType<K> };
|
|
759
787
|
//#endregion
|
|
760
788
|
export { FederalRegisterComponentSpans as A, parsePincite as B, StatuteCitation as C, Warning as D, SupraCitation as E, StatutesAtLargeComponentSpans as F, Span as I, TransformationMap as L, NeutralComponentSpans as M, PublicLawComponentSpans as N, CaseComponentSpans as O, StatuteComponentSpans as P, spanFromGroupIndex as R, ShortFormCitationType as S, SubsequentHistoryEntry as T, Parenthetical as _, CitationType as a, ShortFormCaseCitation as b, ExtractorMap as c, FullCitation as d, FullCitationType as f, NeutralCitation as g, JournalCitation as h, CitationSignal as i, JournalComponentSpans as j, ConstitutionalComponentSpans as k, FederalRegisterCitation as l, IdCitation as m, CitationBase as n, ConstitutionalCitation as o, HistorySignal as p, CitationOfType as r, CourtInference as s, Citation as t, FullCaseCitation as u, ParentheticalType as v, StatutesAtLargeCitation as w, ShortFormCitation as x, PublicLawCitation as y, PinciteInfo as z };
|
|
761
|
-
//# sourceMappingURL=citation-
|
|
789
|
+
//# sourceMappingURL=citation-ChDj3ZlY.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citation-ChDj3ZlY.d.cts","names":[],"sources":["../src/extract/pincite.ts","../src/clean/segmentMap.ts","../src/types/span.ts","../src/types/componentSpans.ts","../src/types/citation.ts"],"mappings":"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"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./knownCodes-D_EXxDqq.cjs`);function t(e){return e.type===`case`||e.type===`statute`||e.type===`journal`||e.type===`neutral`||e.type===`publicLaw`||e.type===`federalRegister`||e.type===`statutesAtLarge`||e.type===`constitutional`}function n(e){return e.type===`id`||e.type===`supra`||e.type===`shortFormCase`}function r(e){return e.type===`case`}function i(e,t){return e.type===t}function a(e){throw Error(`Unexpected value: ${e}`)}function o(e,t,n){let r=e+t[0],i=e+t[1],{originalStart:a,originalEnd:o}=s({cleanStart:r,cleanEnd:i},n);return{cleanStart:r,cleanEnd:i,originalStart:a,originalEnd:o}}function s(e,t){return t.cleanToOriginalSegments?{originalStart:t.cleanToOriginalSegments.lookup(e.cleanStart),originalEnd:t.cleanToOriginalSegments.lookup(e.cleanEnd)}:{originalStart:t.cleanToOriginal.get(e.cleanStart)??e.cleanStart,originalEnd:t.cleanToOriginal.get(e.cleanEnd)??e.cleanEnd}}function c(e){return e.replace(/<[^>]+>/g,``)}function l(e){return e.replace(/(\w)-\s*[\n\r]+\s*(\w)/g,`$1$2`)}function u(e){return e.replace(/[\t\n\r\u00A0\u2000-\u200A\u202F\u205F\u3000]/g,` `)}function d(e){return e.replace(/ {2,}/g,` `)}function f(e){return e.normalize(`NFKC`)}function p(e){return e.replace(/[\u201C\u201D]/g,`"`).replace(/[\u2018\u2019]/g,`'`)}function m(e){return e.replace(/[\u2014\u2015]/g,`---`).replace(/[\u2010\u2012\u2013]/g,`-`)}function h(e){return e.replace(/§/gi,`§`).replace(/¶/gi,`¶`).replace(/&/gi,`&`).replace(/ /gi,` `).replace(/</gi,`<`).replace(/>/gi,`>`).replace(/"/gi,`"`).replace(/'/gi,`'`).replace(/&#(\d+);/g,(e,t)=>{let n=Number.parseInt(t,10);return Number.isNaN(n)?e:String.fromCharCode(n)}).replace(/&#x([0-9a-fA-F]+);/g,(e,t)=>{let n=Number.parseInt(t,16);return Number.isNaN(n)?e:String.fromCharCode(n)})}function g(e){let t=e;return t=t.replace(/\bU\.\s+S\./g,`U.S.`),t=t.replace(/\bS\.\s+Ct\./g,`S.Ct.`),t=t.replace(/\bL\.\s+Ed\./g,`L.Ed.`),t=t.replace(/\bF\.\s+Supp\./g,`F.Supp.`),t=t.replace(/\bF\.\s+(\d+[a-z]+)/g,`F.$1`),t=t.replace(/([A-Za-z])\.\s+(\d+[a-z]+)/g,`$1.$2`),t}function _(e){return e.replace(/[\u2032\u2035]/g,`'`).replace(/\u200B|\u200C|\u200D|\u2060|\uFEFF/g,``)}var v=class e{segments;constructor(e){this.segments=e}static identity(t){return new e([{cleanPos:0,origPos:0,len:t+1}])}static fromMap(t){if(t.size===0)return new e([]);let n=[...t.entries()].sort((e,t)=>e[0]-t[0]),r=[],i=n[0][0],a=n[0][1],o=1;for(let e=1;e<n.length;e++){let[t,s]=n[e],c=i+o,l=a+o;t===c&&s===l?o++:(r.push({cleanPos:i,origPos:a,len:o}),i=t,a=s,o=1)}return r.push({cleanPos:i,origPos:a,len:o}),new e(r)}lookup(e){let t=this.segments;if(t.length===0)return e;let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>>1,a=t[i];if(e<a.cleanPos)r=i-1;else if(e>=a.cleanPos+a.len)n=i+1;else return a.origPos+(e-a.cleanPos)}let i=t[t.length-1];return i.origPos+(e-i.cleanPos)}};function y(e,t=[c,h,l,u,d,f,m,p,_,g]){let n=e,r=new Map,i=new Map;for(let t=0;t<=e.length;t++)r.set(t,t),i.set(t,t);for(let e of t){let t=n,a=e(n);if(t!==a){let{newCleanToOriginal:e,newOriginalToClean:o}=b(t,a,r,i);r=e,i=o,n=a}}let a={cleanToOriginal:r,originalToClean:i,cleanToOriginalSegments:v.fromMap(r)};return{cleaned:n,transformationMap:a,warnings:[]}}function b(e,t,n,r){let i=new Map,a=new Map,o=0,s=0;for(;o<=e.length||s<=t.length;){if(o>=e.length&&s>=t.length){let e=n.get(o)??o;i.set(s,e),a.set(e,s);break}if(o>=e.length){let e=n.get(o)??o;i.set(s,e),s++;continue}if(s>=t.length){let e=n.get(o)??o;a.set(e,s),o++;continue}if(e[o]===t[s]){let e=n.get(o)??o;i.set(s,e),a.set(e,s),o++,s++}else{if(e.length-o===t.length-s){let e=n.get(o)??o;i.set(s,e),a.set(e,s),o++,s++;continue}let r=!1,c=Math.max(40,Math.abs(e.length-t.length)+10),l=-1,u=-1;for(let n=1;n<=c;n++){if(l<0&&o+n<e.length&&e[o+n]===t[s]){let r=!0;for(let i=1;i<3;i++){let a=o+n+i,c=s+i;if(a>=e.length||c>=t.length)break;if(e[a]!==t[c]){r=!1;break}}r&&(l=n)}if(u<0&&s+n<t.length&&e[o]===t[s+n]){let r=!0;for(let i=1;i<3;i++){let a=o+i,c=s+n+i;if(a>=e.length||c>=t.length)break;if(e[a]!==t[c]){r=!1;break}}r&&(u=n)}if(l>=0&&u>=0)break}if(l>=0&&(u<0||l<=u)){for(let e=0;e<l;e++){let t=n.get(o+e)??o+e;a.set(t,s)}o+=l,r=!0}else if(u>=0){let e=n.get(o)??o;for(let t=0;t<u;t++)i.set(s+t,e);s+=u,r=!0}if(r)continue;let d=n.get(o)??o;i.set(s,d),a.set(d,s),o++,s++}}return{newCleanToOriginal:i,newOriginalToClean:a}}var x=class{parent;rank;constructor(e){this.parent=Array.from({length:e},(e,t)=>t),this.rank=Array(e).fill(0)}find(e){let t=e;for(;this.parent[t]!==t;)this.parent[t]=this.parent[this.parent[t]],t=this.parent[t];return t}union(e,t){let n=this.find(e),r=this.find(t);if(n!==r){if(n>r){let e=n;n=r,r=e}this.parent[r]=n,this.rank[n]===this.rank[r]&&this.rank[n]++}}connected(e,t){return this.find(e)===this.find(t)}components(){let e=new Map;for(let t=0;t<this.parent.length;t++){let n=this.find(t),r=e.get(n);r||(r=[],e.set(n,r)),r.push(t)}return e}};function S(e,t,n){let r=/\blabel\s*=\s*["'](\d+)["']/.exec(e);if(r)return Number.parseInt(r[1],10);let i=/\bid\s*=\s*["'](?:fn|footnote)(\d+)["']/.exec(e);if(i)return Number.parseInt(i[1],10);let a=t.replace(/<[^>]*>/g,``),o=/^\s*(\d+)[.\s):]/.exec(a);return o?Number.parseInt(o[1],10):n+1}function C(e,t,n){let r=RegExp(`<${t}\\b[^>]*>`,`gi`),i=RegExp(`</${t}\\s*>`,`gi`);r.lastIndex=n,i.lastIndex=n;let a=1;for(;a>0;){let t=r.exec(e),n=i.exec(e);if(!n)return null;if(t&&t.index<n.index)a++,i.lastIndex=t.index+t[0].length;else{if(a--,a===0)return{contentEnd:n.index,tagEnd:n.index+n[0].length};r.lastIndex=n.index+n[0].length}}return null}function w(e){let t=[],n,r=RegExp(`<(footnote|fn)\\b[^>]*>|<(div|aside|section|p|span)\\b[^>]*(?:class\\s*=\\s*["'][^"']*\\bfootnote\\b[^"']*["']|id\\s*=\\s*["'](?:fn|footnote)\\d*["'])[^>]*>`,`gi`);for(;(n=r.exec(e))!==null;){let i=n[0],a=n.index+i.length,o=C(e,n[1]||n[2],a);if(!o)continue;let s=S(i,e.slice(a,o.contentEnd),t.length);t.push({start:a,end:o.contentEnd,footnoteNumber:s}),r.lastIndex=o.tagEnd}return t.sort((e,t)=>e.start-t.start)}const T=/^\s*[-_]{5,}\s*$/m;function E(e){let t=T.exec(e);if(!t)return[];let n=t.index+t[0].length,r=e.slice(n),i=RegExp(`^\\s*(?:FN\\s*(\\d+)[.\\s:)]|\\[(\\d+)\\]\\s|n\\.\\s*(\\d+)\\s|(\\d+)\\.\\s)`,`gm`),a=[],o;for(;(o=i.exec(r))!==null;){let e=o[1]||o[2]||o[3]||o[4];e&&a.push({index:o.index+n,footnoteNumber:Number.parseInt(e,10)})}if(a.length===0)return[];let s=[];for(let t=0;t<a.length;t++){let n=a[t].index,r=t+1<a.length?a[t+1].index:e.length;s.push({start:n,end:r,footnoteNumber:a[t].footnoteNumber})}return s}const D=/<[^>]+>/;function O(e){if(D.test(e)){let t=w(e);if(t.length>0)return t}return E(e)}function k(e,t,n,r=20){for(let i=1;i<=r;i++){let r=n===`forward`?e+i:e-i,a=t.get(r);if(a!==void 0)return a}}function A(e,t){return e.length===0?[]:e.map(e=>({start:t.originalToClean.get(e.start)??k(e.start,t.originalToClean,`forward`)??e.start,end:t.originalToClean.get(e.end)??k(e.end,t.originalToClean,`backward`)??e.end,footnoteNumber:e.footnoteNumber}))}function j(e,t){if(t.length!==0)for(let n of e){let e=n.span.cleanStart,r=0,i=t.length-1;for(;r<=i;){let a=r+i>>>1,o=t[a];if(e<o.start)i=a-1;else if(e>=o.end)r=a+1;else{n.inFootnote=!0,n.footnoteNumber=o.footnoteNumber;break}}}}const M={jan:1,january:1,feb:2,february:2,mar:3,march:3,apr:4,april:4,may:5,jun:6,june:6,jul:7,july:7,aug:8,august:8,sep:9,sept:9,september:9,oct:10,october:10,nov:11,november:11,dec:12,december:12};function N(e){let t=M[e.toLowerCase().replace(/\.$/,``)];if(t===void 0)throw Error(`Invalid month name: ${e}`);return t}function P(e){let{year:t,month:n,day:r}=e;return n!==void 0&&r!==void 0?`${t}-${String(n).padStart(2,`0`)}-${String(r).padStart(2,`0`)}`:n===void 0?String(t):`${t}-${String(n).padStart(2,`0`)}`}function F(e){let t=e.match(/\b(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Sept|Oct|Nov|Dec)\.?\s+(\d{1,2}),?\s+(\d{4})\b/i);if(t){let e=N(t[1]),n=Number.parseInt(t[2],10),r={year:Number.parseInt(t[3],10),month:e,day:n};return{iso:P(r),parsed:r}}let n=e.match(/\b(January|February|March|April|May|June|July|August|September|October|November|December)\s+(\d{1,2}),?\s+(\d{4})\b/i);if(n){let e=N(n[1]),t=Number.parseInt(n[2],10),r={year:Number.parseInt(n[3],10),month:e,day:t};return{iso:P(r),parsed:r}}let r=e.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);if(r){let e=Number.parseInt(r[1],10),t=Number.parseInt(r[2],10),n={year:Number.parseInt(r[3],10),month:e,day:t};return{iso:P(n),parsed:n}}let i=e.match(/\b(\d{4})\b/);if(i){let e={year:Number.parseInt(i[1],10)};return{iso:P(e),parsed:e}}}function I(e){return{level:e,jurisdiction:`federal`,confidence:1}}function L(e,t){return{level:e,jurisdiction:`state`,state:t,confidence:1}}function R(e){return{level:e,jurisdiction:`state`,confidence:.7}}const z=new Map([[`U.S.`,I(`supreme`)],[`S.Ct.`,I(`supreme`)],[`L.Ed.`,I(`supreme`)],[`L.Ed.2d`,I(`supreme`)],[`S. Ct.`,I(`supreme`)],[`L. Ed.`,I(`supreme`)],[`L. Ed. 2d`,I(`supreme`)],[`U. S.`,I(`supreme`)],[`L.Ed. 2d`,I(`supreme`)],[`L. Ed.2d`,I(`supreme`)],[`F.`,I(`appellate`)],[`F.2d`,I(`appellate`)],[`F.3d`,I(`appellate`)],[`F.4th`,I(`appellate`)],[`F. App'x`,I(`appellate`)],[`F.Supp.`,I(`trial`)],[`F.Supp.2d`,I(`trial`)],[`F.Supp.3d`,I(`trial`)],[`F.Supp.4th`,I(`trial`)],[`F. Supp.`,I(`trial`)],[`F. Supp. 2d`,I(`trial`)],[`F. Supp. 3d`,I(`trial`)],[`F. Supp. 4th`,I(`trial`)],[`F.R.D.`,I(`trial`)],[`B.R.`,I(`trial`)],[`Cal.`,L(`supreme`,`CA`)],[`Cal.2d`,L(`supreme`,`CA`)],[`Cal.3d`,L(`supreme`,`CA`)],[`Cal.4th`,L(`supreme`,`CA`)],[`Cal.5th`,L(`supreme`,`CA`)],[`Cal.App.`,L(`appellate`,`CA`)],[`Cal.App.2d`,L(`appellate`,`CA`)],[`Cal.App.3d`,L(`appellate`,`CA`)],[`Cal.App.4th`,L(`appellate`,`CA`)],[`Cal.App.5th`,L(`appellate`,`CA`)],[`Cal.Rptr.`,L(`unknown`,`CA`)],[`Cal.Rptr.2d`,L(`unknown`,`CA`)],[`Cal.Rptr.3d`,L(`unknown`,`CA`)],[`N.Y.`,L(`supreme`,`NY`)],[`N.Y.2d`,L(`supreme`,`NY`)],[`N.Y.3d`,L(`supreme`,`NY`)],[`A.D.`,L(`appellate`,`NY`)],[`A.D.2d`,L(`appellate`,`NY`)],[`A.D.3d`,L(`appellate`,`NY`)],[`Misc.`,L(`trial`,`NY`)],[`Misc.2d`,L(`trial`,`NY`)],[`Misc.3d`,L(`trial`,`NY`)],[`N.Y.S.`,L(`unknown`,`NY`)],[`N.Y.S.2d`,L(`unknown`,`NY`)],[`N.Y.S.3d`,L(`unknown`,`NY`)],[`Ill.`,L(`supreme`,`IL`)],[`Ill.2d`,L(`supreme`,`IL`)],[`Ill.App.`,L(`appellate`,`IL`)],[`Ill.App.2d`,L(`appellate`,`IL`)],[`Ill.App.3d`,L(`appellate`,`IL`)],[`Ill.Dec.`,L(`unknown`,`IL`)],[`Ohio St.`,L(`supreme`,`OH`)],[`Ohio St.2d`,L(`supreme`,`OH`)],[`Ohio St.3d`,L(`supreme`,`OH`)],[`Ohio App.3d`,L(`appellate`,`OH`)],[`Pa.`,L(`supreme`,`PA`)],[`Pa. Super.`,L(`appellate`,`PA`)],[`Tex.`,L(`supreme`,`TX`)],[`Fla.`,L(`supreme`,`FL`)],[`Mass.`,L(`supreme`,`MA`)],[`Mass. App. Ct.`,L(`appellate`,`MA`)],[`A.`,R(`unknown`)],[`A.2d`,R(`unknown`)],[`A.3d`,R(`unknown`)],[`S.E.`,R(`unknown`)],[`S.E.2d`,R(`unknown`)],[`S.E.3d`,R(`unknown`)],[`S.W.`,R(`unknown`)],[`S.W.2d`,R(`unknown`)],[`S.W.3d`,R(`unknown`)],[`N.E.`,R(`unknown`)],[`N.E.2d`,R(`unknown`)],[`N.E.3d`,R(`unknown`)],[`N.W.`,R(`unknown`)],[`N.W.2d`,R(`unknown`)],[`N.W.3d`,R(`unknown`)],[`So.`,R(`unknown`)],[`So.2d`,R(`unknown`)],[`So.3d`,R(`unknown`)],[`P.`,R(`unknown`)],[`P.2d`,R(`unknown`)],[`P.3d`,R(`unknown`)]]);function ee(e){return z.get(e)}const B=/^(?:at\s+)?(\*?)(\d+)(?:[-–—]\*?(\d+))?\s*(?:(?:n|note)\s*\.?\s*(\d+))?$/i;function V(e){let t=e.trim();if(!t)return null;let n=B.exec(t);if(!n)return null;let r=n[1],i=n[2],a=n[3],o=n[4],s=Number.parseInt(i,10),c,l=!1;if(a){l=!0;let e=Number.parseInt(a,10);if(a.length<i.length){let e=i.slice(0,i.length-a.length);c=Number.parseInt(e+a,10)}else c=e}let u=o?Number.parseInt(o,10):void 0,d={page:s,isRange:l,raw:t};return c!==void 0&&(d.endPage=c),u!==void 0&&(d.footnote=u),r===`*`&&(d.starPage=!0),d}function te(e){if(!e||!e.trim())return;let t=e.trim();return t=t.replace(/\.\s+(?=[A-Za-z])/g,`.`),/[A-Za-z]$/.test(t)&&(/\./.test(t)||/^\d+\w*\s+[A-Z]/i.test(t))&&(t+=`.`),t}const H=new Set([`see`,`see also`,`see generally`,`cf`,`but see`,`but cf`,`compare`,`accord`,`contra`]),U=(()=>{let e=[...H].sort((e,t)=>t.length-e.length).map(e=>e.replace(/\s+/g,`\\s+`).replace(/\./g,`\\.`));return RegExp(`^(${e.join(`|`)})\\s+`,`i`)})();function ne(e){let t=Number.parseInt(e,10);return String(t)===e?t:e}const re=/(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Sept|Oct|Nov|Dec|January|February|March|April|May|June|July|August|September|October|November|December)\.?/,ie=new Date().getFullYear(),ae=new Set(`F.,F.2d,F.3d,F.4th,U.S.,S. Ct.,L. Ed.,L. Ed. 2d,P.,P.2d,P.3d,A.,A.2d,A.3d,N.E.,N.E.2d,N.E.3d,N.W.,N.W.2d,S.E.,S.E.2d,S.W.,S.W.2d,S.W.3d,So.,So. 2d,So. 3d,F. Supp.,F. Supp. 2d,F. Supp. 3d,F. Supp. 4th,F. App'x`.split(`,`)),oe=/^(\d+(?:-\d+)?)\s+([A-Za-z0-9.\s']+)\s+(?:\((\d+)\s+([A-Z][A-Za-z.]+)\)\s+)?(\d+|_{3,}|-{3,})/d,se=/^[_-]{3,}$/,ce=/,\s*(?:at\s+)?(\*?\d+(?:-\d+)?)/d,le=/\(([^)]+)\)/,ue=/^(?:,\s*(?:at\s+)?\*?\d+(?:-\d+)?)*(?:\s+(?:n|note)\s*\.?\s*\d+)?\s*\(([^)]+)\)/,de=/^(?:\s+at\s+|,\s*(?:at\s+)?)(\*?\d+(?:-\d+)?)/d,W=/\d\.\s+/g,G=/[\s,]/,K=/^(?:,\s*(?:at\s+)?\*?\d+(?:[-–—]\*?\d+)?(?:\s+(?:n|note)\s*\.?\s*\d+)?)+/,fe=[[/^aff'?d\s+on\s+other\s+grounds\b/i,`affirmed`],[/^affirmed\s+on\s+other\s+grounds\b/i,`affirmed`],[/^aff'?d\b/i,`affirmed`],[/^affirmed\b/i,`affirmed`],[/^rev'?d\s+and\s+remanded\b/i,`reversed`],[/^rev'?d\s+on\s+other\s+grounds\b/i,`reversed`],[/^reversed\s+and\s+remanded\b/i,`reversed`],[/^rev'?d\b/i,`reversed`],[/^reversed\b/i,`reversed`],[/^certiorari\s+denied\b/i,`cert_denied`],[/^cert\.\s*den(ied|\.)(?=[\s,;(]|$)/i,`cert_denied`],[/^certiorari\s+granted\b/i,`cert_granted`],[/^cert\.\s*granted\b/i,`cert_granted`],[/^overruled\s+by\b/i,`overruled`],[/^overruled\s+in\b/i,`overruled`],[/^overruling\b/i,`overruled`],[/^overruled\b/i,`overruled`],[/^vacated\s+by\b/i,`vacated`],[/^vacated\b/i,`vacated`],[/^remanded\s+for\s+reconsideration\b/i,`remanded`],[/^remanded\b/i,`remanded`],[/^modified\s+by\b/i,`modified`],[/^modified\b/i,`modified`],[/^abrogated\s+by\b/i,`abrogated`],[/^abrogated\s+in\b/i,`abrogated`],[/^abrogated\b/i,`abrogated`],[/^superseded\s+by\b/i,`superseded`],[/^superseded\b/i,`superseded`],[/^disapproved\s+of\b/i,`disapproved`],[/^disapproved\b/i,`disapproved`],[/^questioned\s+by\b/i,`questioned`],[/^questioned\b/i,`questioned`],[/^distinguished\s+by\b/i,`distinguished`],[/^distinguished\b/i,`distinguished`],[/^withdrawn\b/i,`withdrawn`],[/^reinstated\b/i,`reinstated`]];function pe(e){for(let[t,n]of fe){let r=t.exec(e);if(r)return{signal:n,matchLength:r[0].length}}}const me=new Set([`holding`,`finding`,`stating`,`noting`,`explaining`,`quoting`,`citing`,`discussing`,`describing`,`recognizing`,`applying`,`rejecting`,`adopting`,`requiring`]);function he(e){return me.has(e)}const ge=/^([a-z]+)\b/i,_e=/([A-Z][A-Za-z0-9\s.,'&()/-]+?)\s+v(?:s)?\.?\s+([A-Za-z0-9\s.,'&()/-]+?)\s*,\s*$/,ve=/\b(In\s+the\s+Matter\s+of|In re|Ex parte|Matter of|Estate of|State ex rel\.|United States ex rel\.|Application of|Petition of)\s+([A-Za-z0-9\s.,'&()/-]+?)\s*,\s*$/i,ye=new Set([`of`,`the`,`and`,`for`,`in`,`on`,`by`,`a`,`an`,`to`,`at`,`as`,`de`,`la`,`el`,`del`,`von`,`van`,`ex`,`rel`,`et`,`al`,`d`,`or`]);function q(e){let t=e.split(/\s+/);for(let e of t){if(!e||e===`&`)continue;let t=e.toLowerCase().replace(/[.,']+$/,``);if(!ye.has(t)&&!/^[A-Z]/.test(e)&&!/^\d/.test(e))return!1}return!0}const be=new Set([`this`,`that`,`these`,`those`,`here`,`there`,`such`,`its`,`his`,`her`,`their`,`our`]);function xe(e){let t=e.replace(/\s*\d{1,2}\/\d{1,2}\/\d{4}\s*$/,``).trim();return t=t.replace(/\s*\d{4}\s*$/,``).trim(),t=t.replace(/\s*,?\s*\d{1,2}\s*,?\s*$/,``).trim(),t=t.replace(RegExp(`\\s*${re.source}\\s*$`,`i`),``).trim(),t=t.replace(/,\s*$/,``).trim(),t&&/[A-Za-z]/.test(t)?t:void 0}const Se=new Set(`acad.acct.accts.admin.adm.advert.advoc.aff.affs.afr.agric.all.alt.am.ann.app.arb.assoc.assocs.atl.auth.auto.ave.bankr.behav.bd.bor.brit.broad.bhd.bros.bldg.bull.bus.can.cap.cas.cath.ctr.ctrs.cent.chem.child.chron.coal.coll.com.comm.compar.comp.comput.condo.conf.cong.consol.const.constr.cont.coop.corp.corps.corr.cosm.couns.cntys.cnty.crim.def.delinq.det.dev.dig.dir.disc.disp.distrib.dist.div.econ.educ.elec.emp.eng.enter.ent.equal.equip.est.eur.exam.exch.exec.expl.exp.fac.fam.fams.fed.fid.fin.found.gen.glob.grp.guar.hist.hosp.hous.hum.immigr.imp.inc.indem.indep.indus.info.inj.inst.ins.intell.intel.int.inv.invs.jurid.just.juv.lab.law.liab.ltd.loc.mach.mag.maint.mgmt.mgt.mfr.mfrs.mfg.mar.mkt.mktg.matrim.mech.med.merch.metro.min.misc.mod.mortg.mun.mut.nat.negl.negot.nw.no.nos.off.org.orgs.pac.pat.pers.pharm.phil.plan.pol.prac.pres.priv.prob.proc.prod.pro.prop.psych.pub.rec.reg.regul.rehab.rel.rels.rep.reprod.rsch.rsrv.resol.res.resp.rest.ret.rd.sav.sch.schs.sci.sec.serv.servs.sess.soc.solic.spec.stat.subcomm.sur.surv.sys.tchr.tech.telecomm.tel.temp.twp.transcon.transp.treas.tr.trs.tpk.unemplmt.unif.univ.urb.util.veh.vehs.vill.voc.whse.whol.litig.n.s.e.w.m.ne.se.sw.is.mt.ft.pt.rt.st.blvd.sq.hwy.pkwy.hts.v.vs.ct.cir.supp.cl.jud.super.sup.magis.mil.terr.ala.ariz.ark.cal.colo.conn.del.fla.ga.haw.ida.ill.ind.kan.ky.la.me.md.mass.mich.minn.miss.mo.mont.neb.nev.okla.or.pa.tenn.tex.vt.va.wash.wis.wyo.mr.mrs.ms.dr.jr.sr.prof.rev.hon.sgt.capt.col.lt.ed.op.ad.dep.ass.ry.co.cmty.cty.envtl.gend.par.prot.ref.sol.adver.admr.admx.assn.commcn.commn.commr.contl.dept.empr.empt.engg.engr.entmt.envt.examr.exr.exx.fedn.govt.intl.invr.meml.natl.profl.pship.publg.publn.regl.secy.sholder.socy`.split(`.`));function Ce(e,t){let n=t;for(;n>0&&/[-A-Za-z.']/.test(e[n-1]);)n--;let r=e.substring(n,t);if(!r)return!1;let i=r.replace(/['.]/g,``).toLowerCase();return!!(Se.has(i)||i.length===1&&/[a-z]/i.test(i)||/\.[A-Za-z]/.test(r))}const we=/\bId\.\s+/g,Te=/\(\s*(?:quoting|citing|cited\s+in|quoted\s+in|accord|discussing|noting|explaining|describing|recognizing|applying|rejecting|adopting|requiring|overruling|overruled\s+by|abrogated\s+by)(?:,\s*e\.g\.,?)?\s+/gi,Ee=/[.)]\s+(?=[A-Z])/g;function De(e,t,n=150){let r=Math.max(0,t-n),i=e.substring(r,t),a=r,o=-1,s;for(W.lastIndex=0;(s=W.exec(i))!==null;)o=s.index+s[0].length;for(we.lastIndex=0;(s=we.exec(i))!==null;){let e=s.index+s[0].length;e>o&&(o=e)}for(Te.lastIndex=0;(s=Te.exec(i))!==null;){let e=s.index+s[0].length;e>o&&(o=e)}for(Ee.lastIndex=0;(s=Ee.exec(i))!==null;){if(i[s.index]===`.`&&Ce(i,s.index))continue;let e=s.index+s[0].length;e>o&&(o=e)}o!==-1&&(i=i.substring(o),a=r+o);let c=_e.exec(i);if(c&&!c[0].includes(`;`)){let e=c[1].trim(),t=0;if(!q(e)){let n=e.split(/\s+/),r=n[0]??``,i=r.toLowerCase().replace(/[.,']+$/,``);if(!(/^[A-Z]/.test(r)&&!ye.has(i)&&!be.has(i))&&!U.exec(e))for(let r=1;r<n.length;r++){let i=n.slice(r).join(` `);if(/^[A-Z]/.test(i)&&q(i)){t=n.slice(0,r).join(` `).length+1,e=i;break}}}return{caseName:`${e} v. ${c[2].trim()}`,nameStart:a+c.index+t}}let l=ve.exec(i);if(l&&!l[0].includes(`;`))return{caseName:`${l[1]} ${l[2].trim()}`,nameStart:a+l.index};let u=i.replace(/,\s*$/,``),d=u.length-u.trimStart().length,f=u.substring(d),p=0,m=U.exec(f);m&&(p=m[0].length,f=f.substring(p));let h=f.trim();if(h.length>0&&q(h)){let e=(h.split(/\s+/)[0]??``).toLowerCase().replace(/[.,']+$/,``);if(!be.has(e)&&!h.includes(`;`))return{caseName:h,nameStart:a+d+p}}}function Oe(e,t,n=500){let r=[],i=[],a=t,o=Math.min(e.length,t+n),s,c=e.substring(a,o),l=K.exec(c);for(l&&(a+=l[0].length);a<o;){for(;a<o&&G.test(e[a]);)a++;if(a>=o||e[a]!==`(`){let t=e.substring(a,o),n=pe(t);if(n){s={text:t.substring(0,n.matchLength).replace(/\s+$/,``),normalized:n.signal,start:a,end:a+n.matchLength},a+=n.matchLength;continue}break}let t=a,n=0,c=a+1;for(;a<o;){let o=e[a];if(o===`(`)n++;else if(o===`)`&&(n--,n===0)){a++;let n=e.substring(c,a-1).trim();n.length>0&&(r.push({text:n,start:t,end:a}),s&&=(i.push({signal:s,nextParenIndex:r.length-1}),void 0));break}a++}if(n>0)break}return s&&i.push({signal:s,nextParenIndex:-1}),{parens:r,signals:i}}function J(e){let t={},n=F(e);n&&(t.date=n,t.year=n.parsed.year);let r=xe(e);if(r){t.court=r;let n=e.indexOf(r);n!==-1&&(t.courtStart=n,t.courtEnd=n+r.length)}if(t.year){let n=String(t.year),r=e.lastIndexOf(n);r!==-1&&(t.yearStart=r,t.yearEnd=r+n.length)}return/\ben banc\b/i.test(e)?t.disposition=`en banc`:/\bper curiam\b/i.test(e)&&(t.disposition=`per curiam`),t}function ke(e){let t=ge.exec(e);if(t){let n=t[1].toLowerCase();if(he(n))return{kind:`explanatory`,text:e,type:n}}let n=J(e);return n.year||n.date||n.disposition?{kind:`metadata`,...n}:{kind:`explanatory`,text:e,type:`other`}}function Y(e){let t=e;t=t.replace(/\bet\s+al\.?/gi,``),t=t.replace(/\s+d\/b\/a\b.*/gi,``),t=t.replace(/\s+aka\b.*/gi,``);let n=``;for(;n!==t;)n=t,t=t.replace(/,?\s*(Inc|LLC|Corp|Ltd|Co|LLP|LP|P\.C)\.?$/gi,``);return t=t.replace(/^(The|A|An)\s+/i,``),t=t.replace(/\s+/g,` `),t.trim().toLowerCase()}function Ae(e){let t;for(let t of[`In the Matter of`,`In re`,`Ex parte`,`Matter of`,`State ex rel.`,`United States ex rel.`,`Application of`,`Petition of`,`Estate of`]){let n=RegExp(`^(${t})\\s+(.+)$`,`i`).exec(e);if(n){let t=n[1],r=n[2];if(/\s+v\.?\s+/i.test(r)){let t=/^(.+?)\s+v\.?\s+(.+)$/i.exec(e);if(t){let e=t[1].trim(),n=t[2].trim();return{plaintiff:e,plaintiffNormalized:Y(e),defendant:n,defendantNormalized:Y(n)}}}else return{plaintiff:e,plaintiffNormalized:Y(r),proceduralPrefix:t}}}let n=/^(.+?)\s+v\.?\s+(.+)$/i.exec(e);if(n){let e=n[1].trim(),r=n[2].trim(),i=e.match(U)??e.match(/^(Also|In(?!\s+re\b))\s+/i);if(i){let n=i[1].toLowerCase().replace(/\.$/,``);H.has(n)&&(t=n),e=e.substring(i[0].length).trim()}return{plaintiff:e||n[1].trim(),plaintiffNormalized:Y(e||n[1].trim()),defendant:r,defendantNormalized:Y(r),signal:t}}return{}}function je(t,n,r){let{text:i,span:a}=t,c=oe.exec(i);if(!c)throw Error(`Failed to parse case citation: ${i}`);let l=ne(c[1]),u=c[2].trim(),d=c[3]?Number.parseInt(c[3],10):void 0,f=c[4]||void 0,p=c[5],m=se.test(p),h=m?void 0:Number.parseInt(p,10),g=m?!0:void 0,_=ce.exec(i),v=_?V(_[1])??void 0:void 0,y=v?.page,b={};if(c.indices){if(c.indices[1]&&(b.volume=o(a.cleanStart,c.indices[1],n)),c.indices[2]){let[e,t]=c.indices[2],r=i.substring(e,t),s=r.length-r.trimStart().length,l=r.length-r.trimEnd().length;b.reporter=o(a.cleanStart,[e+s,t-l],n)}c.indices[5]&&(b.page=o(a.cleanStart,c.indices[5],n))}_?.indices?.[1]&&(b.pincite=o(a.cleanStart,_.indices[1],n));let x,S,C,w,T,E,D,O,k=le.exec(i);if(k&&!d&&(D=k[1],O=J(D),x=O.year,S=O.court,C=O.date,w=O.disposition),r&&!D){let e=r.substring(a.cleanEnd),t=ue.exec(e);if(t&&(D=t[1],O=J(D),x=O.year,S=O.court,C=O.date,w=O.disposition),y===void 0){let t=de.exec(e);t&&(v||=V(t[1])??void 0,y=v?.page,t.indices?.[1]&&(b.pincite=o(a.cleanEnd,t.indices[1],n)))}}let A,j,M;if(r){M=Oe(r,a.cleanEnd),j=M.parens;let e=D?j.slice(1):j;for(let t of e){let e=ke(t.text);if(e.kind===`metadata`)e.court&&(!S||S===w)&&(S=e.court),e.year&&!x&&(x=e.year,C=e.date),e.disposition&&!w&&(w=e.disposition);else{A??=[];let r=s({cleanStart:t.start,cleanEnd:t.end},n);A.push({text:e.text,type:e.type,span:{cleanStart:t.start,cleanEnd:t.end,originalStart:r.originalStart,originalEnd:r.originalEnd}})}}}if(j&&j.length>0&&(S||x)){let e=D?j[0]:void 0;if(e){let t=s({cleanStart:e.start,cleanEnd:e.end},n);if(b.metadataParenthetical={cleanStart:e.start,cleanEnd:e.end,originalStart:t.originalStart,originalEnd:t.originalEnd},O){let t=e.start+1;if(O.courtStart!==void 0){let e=t+O.courtStart,r=t+O.courtEnd,i=s({cleanStart:e,cleanEnd:r},n);b.court={cleanStart:e,cleanEnd:r,originalStart:i.originalStart,originalEnd:i.originalEnd}}if(O.yearStart!==void 0){let e=t+O.yearStart,r=t+O.yearEnd,i=s({cleanStart:e,cleanEnd:r},n);b.year={cleanStart:e,cleanEnd:r,originalStart:i.originalStart,originalEnd:i.originalEnd}}}}}let N;if(r&&M&&M.signals.length>0)for(let e=0;e<M.signals.length;e++){let{signal:t}=M.signals[e];N??=[];let{originalStart:r,originalEnd:i}=s({cleanStart:t.start,cleanEnd:t.end},n);N.push({signal:t.normalized,rawSignal:t.text,signalSpan:{cleanStart:t.start,cleanEnd:t.end,originalStart:r,originalEnd:i},order:e})}let P=ee(u);!S&&P?.level===`supreme`&&P?.jurisdiction===`federal`&&(S=`scotus`);let F;if(r&&(F=De(r,a.cleanStart),F)){T=F.caseName;let e=j&&j.length>0?j[j.length-1].end:a.cleanEnd,t=F.nameStart,r=e;E={cleanStart:t,cleanEnd:r,originalStart:n.cleanToOriginal.get(t)??t,originalEnd:n.cleanToOriginal.get(r)??r};let i=F.nameStart,o=i+T.length,c=s({cleanStart:i,cleanEnd:o},n);b.caseName={cleanStart:i,cleanEnd:o,originalStart:c.originalStart,originalEnd:c.originalEnd}}let I,L,R,z,B,H;if(T){let e=Ae(T);if(I=e.plaintiff,L=e.plaintiffNormalized,R=e.defendant,z=e.defendantNormalized,B=e.proceduralPrefix,H=e.signal,I&&R){let e=`${I} v. ${R}`;if(e!==T&&E&&r){T=e;let t=r.substring(E.cleanStart,a.cleanStart),i=/\s+v\.?\s+/i.exec(t);if(i){let e=t.substring(0,i.index).lastIndexOf(I);if(e!==-1){let t=E.cleanStart+e,r=n.cleanToOriginal.get(t)??t;E={...E,cleanStart:t,originalStart:r}}}if(F){let e=E.cleanStart,t=e+T.length,r=s({cleanStart:e,cleanEnd:t},n);b.caseName={cleanStart:e,cleanEnd:t,originalStart:r.originalStart,originalEnd:r.originalEnd}}}}if(I&&F&&r){let e=E?.cleanStart??F.nameStart,t=r.substring(e,a.cleanStart),i=/\s+v\.?\s+/i.exec(t);if(i){let r=t.substring(0,i.index).lastIndexOf(I);if(r!==-1){let t=e+r,i=t+I.length,a=s({cleanStart:t,cleanEnd:i},n);b.plaintiff={cleanStart:t,cleanEnd:i,originalStart:a.originalStart,originalEnd:a.originalEnd}}if(R){let r=i.index+i[0].length,a=t.substring(r).indexOf(R);if(a!==-1){let t=e+r+a,i=t+R.length,o=s({cleanStart:t,cleanEnd:i},n);b.defendant={cleanStart:t,cleanEnd:i,originalStart:o.originalStart,originalEnd:o.originalEnd}}}}else{let r=t.indexOf(I);if(r!==-1){let t=e+r,i=t+I.length,a=s({cleanStart:t,cleanEnd:i},n);b.plaintiff={cleanStart:t,cleanEnd:i,originalStart:a.originalStart,originalEnd:a.originalEnd}}}}if(H&&E&&r&&F){let e=r.substring(F.nameStart,a.cleanStart),t=U.exec(e);if(t){let e=F.nameStart,r=e+t[1].length,i=s({cleanStart:e,cleanEnd:r},n);b.signal={cleanStart:e,cleanEnd:r,originalStart:i.originalStart,originalEnd:i.originalEnd}}}}let{originalStart:re,originalEnd:W}=s(a,n),G=.2,K=e.s()?.byAbbreviation.get(u.toLowerCase());return(K&&K.length>0||ae.has(u))&&(G+=.3),x!==void 0&&x<=ie&&(G+=.2),T&&(G+=.15),S&&(G+=.1),G=Math.round(Math.min(G,1)*100)/100,g&&(G=Math.max(G,.5)),{type:`case`,text:i,span:{cleanStart:a.cleanStart,cleanEnd:a.cleanEnd,originalStart:re,originalEnd:W},confidence:G,matchedText:i,processTimeMs:0,patternsChecked:1,volume:l,reporter:u,page:h,nominativeVolume:d,nominativeReporter:f,pincite:y,pinciteInfo:v,court:S,normalizedCourt:te(S),year:x,hasBlankPage:g,date:C,fullSpan:E,caseName:T,disposition:w,parentheticals:A,subsequentHistoryEntries:N,plaintiff:I,plaintiffNormalized:L,defendant:R,defendantNormalized:z,proceduralPrefix:B,inferredCourt:P,signal:H,spans:b}}const X=`${String.raw`(?:art(?:icle)?\.?|amend(?:ment)?\.?|amdt\.?)\s+([IVX]+|\d+)`}${String.raw`(?:[,;]\s*§\s*([\w-]+))?`}${String.raw`(?:[,;]\s*cl\.?\s*(\d+))?`}`,Me=new RegExp(X,`id`),Ne=[{id:`us-constitution`,regex:new RegExp(String.raw`\b(?:United\s+States\s+Constitution|U\.?\s*S\.?\s+Const\.?),?\s+${X}`,`gi`),description:`U.S. Constitution citations (e.g., "U.S. Const. art. III, § 2", "U.S. Const. amend. XIV")`,type:`constitutional`},{id:`state-constitution`,regex:new RegExp(String.raw`\b(?:Ala|Alaska|Ariz|Ark|Cal(?:if)?|Colo|Conn|Del|Fla|Ga|Haw|Idaho|Ill|Ind|Iowa|Kan|Ky|La|Me|Md|Mass|Mich|Minn|Miss|Mo|Mont|Neb|Nev|N\.?\s*H|N\.?\s*J|N\.?\s*M|N\.?\s*Y|N\.?\s*C|N\.?\s*D|Ohio|Okla|Or(?:e)?|Pa|R\.?\s*I|S\.?\s*C|S\.?\s*D|Tenn|Tex|Utah|Vt|W\.?\s*Va|Va|Wash|Wis|Wyo)\.?\s+Const\.?,?\s+${X}`,`gi`),description:`State constitution citations (e.g., "Cal. Const. art. I, § 7", "N.Y. Const. art. VI, § 20")`,type:`constitutional`},{id:`bare-constitution`,regex:new RegExp(String.raw`(?<!\.\s)(?<![A-Z]\s)\bConst\.?,?\s+${X}`,`g`),description:`Bare constitutional citations without jurisdiction prefix (e.g., "Const. art. I, § 8, cl. 3")`,type:`constitutional`},{id:`bare-article`,regex:new RegExp(String.raw`(?<!Const\.?,?\s)\bArt\.?\s+[IVX]+[,;]\s*§\s*[\w-]+(?:[,;]\s*cl\.?\s*\d+)?`,`g`),description:`Bare article references without "Const." prefix (e.g., "Art. I, §8, cl. 3")`,type:`constitutional`}],Pe={I:1,II:2,III:3,IV:4,V:5,VI:6,VII:7,VIII:8,IX:9,X:10,XI:11,XII:12,XIII:13,XIV:14,XV:15,XVI:16,XVII:17,XVIII:18,XIX:19,XX:20,XXI:21,XXII:22,XXIII:23,XXIV:24,XXV:25,XXVI:26,XXVII:27};function Fe(e){let t=e.toUpperCase();if(t in Pe)return Pe[t];let n=Number.parseInt(e,10);return Number.isNaN(n)?void 0:n}const Ie={ala:`AL`,alaska:`AK`,ariz:`AZ`,ark:`AR`,cal:`CA`,calif:`CA`,colo:`CO`,conn:`CT`,del:`DE`,fla:`FL`,ga:`GA`,haw:`HI`,idaho:`ID`,ill:`IL`,ind:`IN`,iowa:`IA`,kan:`KS`,ky:`KY`,la:`LA`,me:`ME`,md:`MD`,mass:`MA`,mich:`MI`,minn:`MN`,miss:`MS`,mo:`MO`,mont:`MT`,neb:`NE`,nev:`NV`,"n.h":`NH`,"n.j":`NJ`,"n.m":`NM`,"n.y":`NY`,"n.c":`NC`,"n.d":`ND`,ohio:`OH`,okla:`OK`,or:`OR`,ore:`OR`,pa:`PA`,"r.i":`RI`,"s.c":`SC`,"s.d":`SD`,tenn:`TN`,tex:`TX`,utah:`UT`,vt:`VT`,va:`VA`,wash:`WA`,"w.va":`WV`,wis:`WI`,wyo:`WY`},Le=/amend|amdt/i,Re=/^([A-Za-z]+(?:\.\s*[A-Za-z]+)?(?:\.\s*[A-Za-z]+)?)\.?\s+Const/i;function ze(e){let t=Re.exec(e);if(!t)return;let n=t[1].replace(/\s+/g,``).replace(/\.$/g,``).toLowerCase();if(n in Ie)return Ie[n]}function Be(e,t){let{text:n,span:r}=e,i=Me.exec(n),a,c,l,u;if(i){let e=Fe(i[1]);Le.test(i[0])?c=e:a=e,l=i[2]||void 0,u=i[3]?Number.parseInt(i[3],10):void 0}let d;switch(e.patternId){case`us-constitution`:d=`US`;break;case`state-constitution`:d=ze(n);break;default:d=void 0;break}let{originalStart:f,originalEnd:p}=s(r,t),m;m=e.patternId===`bare-article`?.5:e.patternId===`bare-constitution`?.7:l?.95:.9;let h=n.endsWith(`.`)?n.slice(0,-1):n,g={};if(d===`US`){let e=n.indexOf(`U.S.`);e!==-1&&(g.jurisdiction=o(r.cleanStart,[e,e+4],t))}else if(d&&e.patternId===`state-constitution`){let e=Re.exec(n);if(e){let n=e[1].length+1;g.jurisdiction=o(r.cleanStart,[0,n],t)}}return i?.indices&&(Le.test(i[0])?i.indices[1]&&(g.amendment=o(r.cleanStart,i.indices[1],t)):i.indices[1]&&(g.article=o(r.cleanStart,i.indices[1],t)),i.indices[2]&&(g.section=o(r.cleanStart,i.indices[2],t)),i.indices[3]&&(g.clause=o(r.cleanStart,i.indices[3],t))),{type:`constitutional`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:f,originalEnd:p},confidence:m,matchedText:h,processTimeMs:0,patternsChecked:1,jurisdiction:d,article:a,amendment:c,section:l,clause:u,spans:g}}function Ve(e,t){let{text:n,span:r}=e,i=/^(\d+(?:-\d+)?)\s+Fed\.\s?Reg\.\s+(\d+)/d.exec(n);if(!i)throw Error(`Failed to parse Federal Register citation: ${n}`);let a=i[1],c=/^\d+$/.test(a)?Number.parseInt(a,10):a,l=Number.parseInt(i[2],10),u;i.indices&&(u={volume:o(r.cleanStart,i.indices[1],t),page:o(r.cleanStart,i.indices[2],t)});let d=/\((?:.*?\s)?(\d{4})\)/.exec(n),f=d?Number.parseInt(d[1],10):void 0,{originalStart:p,originalEnd:m}=s(r,t);return{type:`federalRegister`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:.9,matchedText:n,processTimeMs:0,patternsChecked:1,volume:c,page:l,year:f,spans:u}}function He(e,t,n){let{text:r,span:i}=e,a=/^(\d+(?:-\d+)?)\s+([A-Za-z.\s]+?)\s+(\d+)/d.exec(r);if(!a)throw Error(`Failed to parse journal citation: ${r}`);let c=a[1],l=/^\d+$/.test(c)?Number.parseInt(c,10):c,u=a[2].trim(),d=Number.parseInt(a[3],10),f,p;n===void 0?(f=r.slice(a[0].length),p=i.cleanStart+a[0].length):(f=n.slice(i.cleanEnd,i.cleanEnd+30),p=i.cleanEnd);let m=n?n.slice(i.cleanStart,i.cleanEnd+30):r,h=/^,\s*(\d+)/d.exec(f),g=h?Number.parseInt(h[1],10):void 0,_=/\((?:.*?\s)?(\d{4})\)/d.exec(m),v=_?Number.parseInt(_[1],10):void 0,y;a.indices&&(y={volume:o(i.cleanStart,a.indices[1],t),journal:o(i.cleanStart,a.indices[2],t),page:o(i.cleanStart,a.indices[3],t)},h?.indices?.[1]&&(y.pincite=o(p,h.indices[1],t)),_?.indices?.[1]&&(y.year=o(i.cleanStart,_.indices[1],t)));let{originalStart:b,originalEnd:x}=s(i,t);return{type:`journal`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:b,originalEnd:x},confidence:.6,matchedText:r,processTimeMs:0,patternsChecked:1,volume:l,journal:u,abbreviation:u,page:d,pincite:g,year:v,spans:y}}const Ue=/^(?:\s+at\s+|,\s*(?:at\s+)?)(\*?\d+(?:-\d+)?)/d;function We(e,t,n){let{text:r,span:i}=e,a=/^(\d{4})\s+(.+?)\s+(\d+)$/d.exec(r);if(!a)throw Error(`Failed to parse neutral citation: ${r}`);let c=Number.parseInt(a[1],10),l=a[2],u=a[3],d;a.indices&&(d={year:o(i.cleanStart,a.indices[1],t),court:o(i.cleanStart,a.indices[2],t),documentNumber:o(i.cleanStart,a.indices[3],t)});let f,p;if(n){let e=n.substring(i.cleanEnd),t=Ue.exec(e);t&&(p=V(t[1])??void 0,f=p?.page)}let{originalStart:m,originalEnd:h}=s(i,t);return{type:`neutral`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:m,originalEnd:h},confidence:1,matchedText:r,processTimeMs:0,patternsChecked:1,year:c,court:l,documentNumber:u,pincite:f,pinciteInfo:p,spans:d}}function Ge(e,t){let{text:n,span:r}=e,i=/Pub\.\s?L\.(?:\s?No\.)?\s?(\d+)-(\d+)/d.exec(n);if(!i)throw Error(`Failed to parse public law citation: ${n}`);let a=Number.parseInt(i[1],10),c=Number.parseInt(i[2],10),l;i.indices&&(l={congress:o(r.cleanStart,i.indices[1],t),lawNumber:o(r.cleanStart,i.indices[2],t)});let{originalStart:u,originalEnd:d}=s(r,t);return{type:`publicLaw`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:u,originalEnd:d},confidence:.9,matchedText:n,processTimeMs:0,patternsChecked:1,congress:a,lawNumber:c,spans:l}}function Ke(e,t,n){let{text:r,span:i}=e,a=/([Ii])(?:d|bid)(\.)(,?)\s*(?:at\s+(\*?\d+(?:\s*[-–]\s*\*?\d+)?))?/.exec(r);if(!a)throw Error(`Failed to parse Id. citation: ${r}`);let o=a[1],c=a[3]===`,`,l=a[4]?V(a[4])??void 0:void 0,u=l?.page,d=1;if(o===`i`&&(d=.85),c&&(d=Math.min(d,.9)),n&&i.cleanStart>0){let e=n.slice(Math.max(0,i.cleanStart-20),i.cleanStart).trimEnd();e.length>0&&(e[e.length-1],/[.;)\]—:]$/.test(e)||(d=Math.min(d,.4)))}let{originalStart:f,originalEnd:p}=s(i,t);return{type:`id`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:f,originalEnd:p},confidence:d,matchedText:r,processTimeMs:0,patternsChecked:1,pincite:u,pinciteInfo:l}}function qe(e,t){let{text:n,span:r}=e,i=/\b([A-Z][a-zA-Z''\-]+\.?(?:(?:\s+v\.?\s+|\s+)[A-Z][a-zA-Z''\-]+\.?)*)\s*,?\s+supra(?:\s+note\s+(\d+))?(?:,?\s+at\s+(\*?\d+))?/.exec(n),a=i||/supra(?:\s+note\s+(\d+)(?:,?\s+at\s+(\*?\d+))?|\s+at\s+(\*?\d+))?/.exec(n);if(!a)throw Error(`Failed to parse supra citation: ${n}`);let o,c,l;if(i)o=i[1],c=i[3]?V(i[3])??void 0:void 0,l=.9;else{o=void 0;let e=a[2],t=a[3],n=e??t;c=n?V(n)??void 0:void 0,l=.8}let u=c?.page,{originalStart:d,originalEnd:f}=s(r,t);return{type:`supra`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:d,originalEnd:f},confidence:l,matchedText:n,processTimeMs:0,patternsChecked:1,partyName:o,pincite:u,pinciteInfo:c}}function Je(e,t){let{text:n,span:r}=e,i=/(\d+(?:-\d+)?)\s+([A-Z][A-Za-z.''\s]+?(?:\d[a-z]{1,2})?)\s*,?\s+at\s+(\*?\d+)/.exec(n);if(!i)throw Error(`Failed to parse short-form case citation: ${n}`);let a=i[1],o=/^\d+$/.test(a)?Number.parseInt(a,10):a,c=i[2].trim(),l=V(i[3])??void 0,u=l?.page,{originalStart:d,originalEnd:f}=s(r,t),p=.4;return ae.has(c)&&(p+=.3),{type:`shortFormCase`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:d,originalEnd:f},confidence:p,matchedText:n,processTimeMs:0,patternsChecked:1,volume:o,reporter:c,pincite:u,pinciteInfo:l}}const Ye=/^([^(]+?)\s*((?:\([^)]*\))*)$/,Xe=/\s*et\s+seq\.?\s*$/i;function Z(e){let t=e.replace(Xe,``),n=t!==e,r=t.trim(),i=Ye.exec(r),a=i?.[2];return i!==null&&a?{section:i[1].trim(),subsection:a,hasEtSeq:n}:{section:r,hasEtSeq:n}}const Ze=/^(?:(\d+)\s+)?(.+?)\s*§?\s*(\d+[A-Za-z0-9.:/-]*(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)$/d;function Qe(t,n){let{text:r,span:i}=t,a=Ze.exec(r),c,l,u;a?(c=a[1]?Number.parseInt(a[1],10):void 0,l=a[2].trim(),u=a[3]):(l=r,u=``);let d=e.n(l),f=d?.jurisdiction,p=l,{section:m,subsection:h,hasEtSeq:g}=Z(u),{originalStart:_,originalEnd:v}=s(i,n),y;if(a?.indices&&(y={},a.indices[1]&&(y.title=o(i.cleanStart,a.indices[1],n)),a.indices[2]&&(y.code=o(i.cleanStart,a.indices[2],n)),a.indices[3]&&m)){let e=a.indices[3][0],t=m.replace(/[.,;:]\s*$/,``).length;if(y.section=o(i.cleanStart,[e,e+t],n),h){let t=e+m.length;y.subsection=o(i.cleanStart,[t,t+h.length],n)}}let b=r.includes(`§`),x;return x=d&&b?.95:d?.85:b?.6:.4,c!==void 0&&(x+=.05),h&&(x+=.05),x=Math.min(x,1),{type:`statute`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:_,originalEnd:v},confidence:x,matchedText:r,processTimeMs:0,patternsChecked:1,title:c,code:p,section:m,subsection:h,pincite:h,jurisdiction:f,hasEtSeq:g||void 0,spans:y}}const $e=/^(\d+)\s+(?:ILCS|Ill\.?\s*Comp\.?\s*Stat\.?)\s*(?:Ann\.?\s+)?(\d+)\/(.+)$/d;function et(e,t){let{text:n,span:r}=e,i=$e.exec(n),a,c,l;i?(a=Number.parseInt(i[1],10),c=i[2],l=i[3]):(c=n,l=``);let{section:u,subsection:d,hasEtSeq:f}=Z(l),{originalStart:p,originalEnd:m}=s(r,t),h=u.replace(/[.,;:]\s*$/,``).length,g;if(i?.indices&&(g={},i.indices[1]&&(g.title=o(r.cleanStart,i.indices[1],t)),i.indices[2]&&(g.code=o(r.cleanStart,i.indices[2],t)),i.indices[3]&&u)){let e=i.indices[3][0];if(g.section=o(r.cleanStart,[e,e+h],t),d){let n=e+u.length;g.subsection=o(r.cleanStart,[n,n+d.length],t)}}let _=i?.95:.3;return d&&(_+=.05),_=Math.min(_,1),{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:_,matchedText:n,processTimeMs:0,patternsChecked:1,title:a,code:c,section:u,subsection:d,pincite:d,jurisdiction:i?`IL`:void 0,hasEtSeq:f||void 0,spans:g}}const tt=/^(\d+)\s+(\S+(?:\.\S+)*)\s*§§?\s*(.+)$/d,nt=/^(\d+)\s+(\S+(?:\.\S+)*)\s+(?:Part|pt\.)\s+(.+)$/d;function rt(e,t){let{text:n,span:r}=e,i=tt.exec(n)??nt.exec(n),a,c,l;i?(a=Number.parseInt(i[1],10),c=i[2],l=i[3]):(c=e.patternId===`cfr`?`C.F.R.`:`U.S.C.`,l=n,a=void 0);let{section:u,subsection:d,hasEtSeq:f}=Z(l),{originalStart:p,originalEnd:m}=s(r,t),h;if(i?.indices&&(h={},i.indices[1]&&(h.title=o(r.cleanStart,i.indices[1],t)),i.indices[2]&&(h.code=o(r.cleanStart,i.indices[2],t)),i.indices[3]&&u)){let e=i.indices[3][0],n=u.replace(/[.,;:]\s*$/,``).length;if(h.section=o(r.cleanStart,[e,e+n],t),d){let n=e+u.length;h.subsection=o(r.cleanStart,[n,n+d.length],t)}}let g=.95;return a!==void 0&&(g+=.05),d&&(g+=.05),g=Math.min(g,1),{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:g,matchedText:n,processTimeMs:0,patternsChecked:1,title:a,code:c,section:u,subsection:d,pincite:d,jurisdiction:`US`,hasEtSeq:f||void 0,spans:h}}const it=/^(N\.?\s*Y\.?|Cal(?:ifornia)?\.?|Tex(?:as)?\.?|Md\.?|Va\.?|Ala(?:bama)?\.?)\s+(.*?)\s*§§?\s*(.+)$/ds,at=/^(.*?)\s+(?:ch\.?|c\.?)\s*(\w+),?\s*§\s*(.+)$/d,ot={"n.y.":`NY`,"n.y":`NY`,ny:`NY`,"cal.":`CA`,cal:`CA`,"california.":`CA`,california:`CA`,"tex.":`TX`,tex:`TX`,"texas.":`TX`,texas:`TX`,"md.":`MD`,md:`MD`,"va.":`VA`,va:`VA`,"ala.":`AL`,ala:`AL`,"alabama.":`AL`,alabama:`AL`};function st(e){return ot[e.toLowerCase().replace(/\s+/g,``)]}function ct(e){return e.replace(/^\s*Code\s+Ann\.\s*,\s*/i,``).replace(/^\s*Code\s*,\s*/i,``).replace(/\s+Code\s*$/i,``).replace(/\s+Ann\.?\s*$/i,``).replace(/,\s*$/,``).trim()}function lt(t,n){let{text:r,span:i}=t,a,c,l,u=null,d=null;if(t.patternId===`mass-chapter`)u=at.exec(r),u?(a=`MA`,c=u[2],l=u[3]):(c=r,l=``);else if(d=it.exec(r),d){a=st(d[1]);let t=d[2],n=ct(t);c=a&&e.r(a,n)?n:t.trim(),l=d[3]}else c=r,l=``;let{section:f,subsection:p,hasEtSeq:m}=Z(l),{originalStart:h,originalEnd:g}=s(i,n),_=f.replace(/[.,;:]\s*$/,``).length,v;if(u?.indices){if(v={},u.indices[2]&&(v.code=o(i.cleanStart,u.indices[2],n)),u.indices[3]&&f){let e=u.indices[3][0];if(v.section=o(i.cleanStart,[e,e+_],n),p){let t=e+f.length;v.subsection=o(i.cleanStart,[t,t+p.length],n)}}}else if(d?.indices&&(v={},d.indices[2]&&(v.code=o(i.cleanStart,d.indices[2],n)),d.indices[3]&&f)){let e=d.indices[3][0];if(v.section=o(i.cleanStart,[e,e+_],n),p){let t=e+f.length;v.subsection=o(i.cleanStart,[t,t+p.length],n)}}let y=a?.95:.5;return p&&(y+=.05),y=Math.min(y,1),{type:`statute`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:h,originalEnd:g},confidence:y,matchedText:r,processTimeMs:0,patternsChecked:1,code:c,section:f,subsection:p,pincite:p,jurisdiction:a,hasEtSeq:m||void 0,spans:v}}const ut=/[Ss]ection\s+(\d+[A-Za-z0-9-]*)((?:\([^)]*\))*)\s+of\s+title\s+(\d+)/d;function dt(e,t){let{text:n,span:r}=e,i=ut.exec(n),a,c,l;i?(a=i[1],c=i[2]||void 0,l=Number.parseInt(i[3],10)):a=n;let{originalStart:u,originalEnd:d}=s(r,t),f;i?.indices&&(f={},i.indices[1]&&(f.section=o(r.cleanStart,i.indices[1],t)),i.indices[3]&&(f.title=o(r.cleanStart,i.indices[3],t)),i.indices[2]&&c&&(f.subsection=o(r.cleanStart,i.indices[2],t)));let p=.85;return l!==void 0&&(p+=.05),c&&(p+=.05),p=Math.min(p,1),{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:u,originalEnd:d},confidence:p,matchedText:n,processTimeMs:0,patternsChecked:1,title:l,code:`U.S.C.`,section:a,subsection:c,pincite:c,jurisdiction:`US`,spans:f}}function ft(e,t){let{text:n,span:r}=e,i=/^(?:(\d+)\s+)?([A-Za-z.\s]+?)\s*§+\s*(\d+[A-Za-z0-9-]*)/.exec(n);if(!i){let{originalStart:e,originalEnd:i}=s(r,t);return{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:e,originalEnd:i},confidence:.3,matchedText:n,processTimeMs:0,patternsChecked:1,code:n,section:``}}let a=i[1]?Number.parseInt(i[1],10):void 0,o=i[2].trim(),c=i[3],{originalStart:l,originalEnd:u}=s(r,t),d=.5;return[`U.S.C.`,`C.F.R.`,`Cal. Civ. Code`,`Cal. Penal Code`,`N.Y. Civ. Prac. L. & R.`,`Tex. Civ. Prac. & Rem. Code`].some(e=>o.includes(e))&&(d+=.3),d=Math.min(d,1),{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:l,originalEnd:u},confidence:d,matchedText:n,processTimeMs:0,patternsChecked:1,title:a,code:o,section:c}}function pt(e,t){switch(e.patternId){case`usc`:case`cfr`:return rt(e,t);case`prose`:return dt(e,t);case`abbreviated-code`:return Qe(e,t);case`named-code`:case`mass-chapter`:return lt(e,t);case`chapter-act`:return et(e,t);default:return ft(e,t)}}function mt(e,t){let{text:n,span:r}=e,i=/^(\d+(?:-\d+)?)\s+Stat\.\s+(\d+)/d.exec(n);if(!i)throw Error(`Failed to parse Statutes at Large citation: ${n}`);let a=i[1],c=/^\d+$/.test(a)?Number.parseInt(a,10):a,l=Number.parseInt(i[2],10),u;i.indices&&(u={volume:o(r.cleanStart,i.indices[1],t),page:o(r.cleanStart,i.indices[2],t)});let d=/\((?:.*?\s)?(\d{4})\)/.exec(n),f=d?Number.parseInt(d[1],10):void 0,{originalStart:p,originalEnd:m}=s(r,t);return{type:`statutesAtLarge`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:.9,matchedText:n,processTimeMs:0,patternsChecked:1,volume:c,page:l,year:f,spans:u}}const ht=[{id:`federal-reporter`,regex:/\b(\d+(?:-\d+)?)\s+(F\.|F\.2d|F\.3d|F\.4th|F\.\s?Supp\.|F\.\s?Supp\.\s?2d|F\.\s?Supp\.\s?3d|F\.\s?Supp\.\s?4th|F\.\s?App'x)\s+(\d+|_{3,}|-{3,})(?=\s|$|\(|,|;|\.)/g,description:`Federal Reporter (F., F.2d, F.3d, F.4th, F.Supp., F.App'x, etc.)`,type:`case`},{id:`supreme-court`,regex:/\b(\d+(?:-\d+)?)\s+(U\.\s?S\.|S\.\s?Ct\.|L\.\s?Ed\.(?:\s?2d)?)\s+(?:\(\d+\s+[A-Z][A-Za-z.]+\)\s+)?(\d+|_{3,}|-{3,})(?=\s|$|\(|,|;|\.)/g,description:`U.S. Supreme Court reporters (with optional nominative reporter parenthetical)`,type:`case`},{id:`state-reporter`,regex:/\b(\d+(?:-\d+)?)\s+([A-Z](?:(?! L\.[JQR\s])(?!\s+vs?\.\s)[A-Za-z.\d\s])+?)\s+(\d+|_{3,}|-{3,})(?=\s|$|\(|,|;|\.)/g,description:`State reporters (broad pattern allowing multi-word reporters, excludes journal patterns with " L.J/Q/Rev" and phantom matches across a case-name separator " v. "/" vs. ", validated against reporters-db in Phase 3)`,type:`case`}],gt=[{id:`law-review`,regex:/\b(\d+(?:-\d+)?)\s+([A-Z](?:(?!\s+vs?\.\s)[A-Za-z.\s])+)\s+(\d+)\b/g,description:`Law review citations (e.g., "120 Harv. L. Rev. 500"), validated against journals-db in Phase 3. Negative lookahead excludes " v. "/" vs. " so party-name text isn't mis-captured as a journal name.`,type:`journal`}],_t=[{id:`state-vendor-neutral`,regex:/\b(\d{4})\s+([A-Z]{2}(?:\s+App\.?)?)\s+(\d+)\b/g,description:`State vendor-neutral citations (e.g., "2007 UT 49", "2017 WI 17", "2013 IL 112116")`,type:`neutral`},{id:`westlaw`,regex:/\b(\d{4})\s+WL\s+(\d+)\b/g,description:`WestLaw citations (e.g., "2021 WL 123456")`,type:`neutral`},{id:`lexis`,regex:/\b(\d{4})\s+U\.S\.(?:\s+(?:App|Dist)\.)?\s+LEXIS\s+(\d+)\b/g,description:`LexisNexis citations (e.g., "2021 U.S. LEXIS 5000", "2021 U.S. App. LEXIS 12345", "2021 U.S. Dist. LEXIS 67890")`,type:`neutral`},{id:`public-law`,regex:/\bPub\.\s?L\.(?:\s?No\.)?\s?(\d+-\d+)\b/g,description:`Public Law citations (e.g., "Pub. L. No. 117-58" or "Pub. L. 116-283")`,type:`publicLaw`},{id:`federal-register`,regex:/\b(\d+(?:-\d+)?)\s+Fed\.\s?Reg\.\s+(\d+)\b/g,description:`Federal Register citations (e.g., "86 Fed. Reg. 12345")`,type:`federalRegister`},{id:`statutes-at-large`,regex:/\b(\d+(?:-\d+)?)\s+Stat\.\s+(\d+)\b/g,description:`Statutes at Large citations (e.g., "124 Stat. 119")`,type:`statutesAtLarge`},{id:`compact-law-review`,regex:/\b(\d+(?:-\d+)?)\s+([A-Z][A-Za-z.]+L\.(?:Rev|J|Q)\.)\s+(\d+)\b/g,description:`Compact law review citations without spaces (e.g., "93 Harv.L.Rev. 752")`,type:`journal`}],vt=[{id:`id`,regex:/(?:^|(?<=\s)|(?<=["'(\[—]))\b[Ii]d\.(?:,?\s+at\s+(\*?\d+(?:\s*[-–]\s*\*?\d+)?))?/g,description:`Id. citations (e.g., "Id." or "Id. at 253")`,type:`case`},{id:`ibid`,regex:/(?:^|(?<=\s)|(?<=["'(\[—]))\b[Ii]bid\.(?:,?\s+at\s+(\*?\d+(?:\s*[-–]\s*\*?\d+)?))?/g,description:`Ibid. citations (e.g., "Ibid." or "Ibid. at 125")`,type:`case`},{id:`supra`,regex:/\b([A-Z][a-zA-Z''\-]+\.?(?:(?:\s+v\.?\s+|\s+)[A-Z][a-zA-Z''\-]+\.?)*)\s*,?\s+supra(?:\s+note\s+(\d+))?(?:,?\s+at\s+(\*?\d+))?/g,description:`Supra citations (e.g., "Smith, supra" or "Smith, supra, at 460")`,type:`case`},{id:`supra`,regex:/(?:^|(?<=\s)|(?<=[;.]))supra(?:\s+note\s+(\d+)(?:,?\s+at\s+(\*?\d+))?|\s+at\s+(\*?\d+)|\s+(?:§+|Part|p\.)\s*\S+)/g,description:`Standalone supra (e.g., "supra note 12" or "supra at 15")`,type:`case`},{id:`shortFormCase`,regex:/\b(\d+(?:-\d+)?)\s+([A-Z][A-Za-z.''\s]+?(?:\d[a-z]{1,2})?)\s*,?\s+at\s+(\*?\d+)\b/g,description:`Short-form case citations (e.g., "500 F.2d at 125")`,type:`case`}],yt=[{id:`usc`,regex:/\b(\d+)\s+(?:U\.S\.C\.?|USC)\s*§§?\s*(\d+[A-Za-z0-9-]*(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`U.S. Code citations with optional subsections and et seq. (e.g., "42 U.S.C. § 1983(a)(1) et seq.")`,type:`statute`},{id:`cfr`,regex:/\b(\d+)\s+C\.?F\.?R\.?\s*(?:(?:Part|pt\.)\s+|§§?\s*)(\d+(?:\.\d+)?[A-Za-z0-9-]*(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`Code of Federal Regulations with Part or §, subsections, et seq. (e.g., "12 C.F.R. Part 226", "40 C.F.R. § 122.26(b)(14)")`,type:`statute`},{id:`prose`,regex:/\b[Ss]ection\s+(\d+[A-Za-z0-9-]*(?:\([^)]*\))*)\s+of\s+title\s+(\d+)\b/g,description:`Prose-form federal citations (e.g., "section 1983 of title 42"). Note: MD-style "section X of the Y Article" deferred to PR 3.`,type:`statute`},{id:`named-code`,regex:/\b(N\.?\s*Y\.?|Cal(?:ifornia)?\.?|Tex(?:as)?\.?|Md\.?|(?<!W\.?\s?)Va\.?|Ala(?:bama)?\.?)\s+((?:[A-Za-z.&',\s]+?))\s*§§?\s*(\d+[A-Za-z0-9.:/-]*(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`Named-code state citations (NY, CA, TX, MD, VA, AL) with jurisdiction prefix + code name + §`,type:`statute`},{id:`mass-chapter`,regex:/\b(Mass\.?\s*Gen\.?\s*Laws|M\.?G\.?L\.?A?\.?|A\.?L\.?M\.?|G\.?\s*L\.?)\s+(?:ch\.?|c\.?)\s*(\w+),?\s*§\s*([\w./-]+(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`Massachusetts chapter-based citations (e.g., "Mass. Gen. Laws ch. 93A, § 2")`,type:`statute`},{id:`chapter-act`,regex:/\b(\d+)\s+(?:ILCS|Ill\.?\s*Comp\.?\s*Stat\.?)\s*(?:Ann\.?\s+)?(\d+)\/([^\s(]+(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`Illinois Compiled Statutes chapter-act citations (e.g., "735 ILCS 5/2-1001")`,type:`statute`},{id:`abbreviated-code`,regex:e.a(),description:`Abbreviated state code citations for all US jurisdictions`,type:`statute`}];function bt(e,t=[...ht,...yt,...gt,..._t,...vt]){let n=[];for(let r of t)try{let t=e.matchAll(r.regex);for(let e of t)n.push({text:e[0],span:{cleanStart:e.index,cleanEnd:e.index+e[0].length},type:r.type,patternId:r.id})}catch(e){console.warn(`Pattern ${r.id} threw error, skipping:`,e instanceof Error?e.message:String(e))}return n.sort((e,t)=>e.span.cleanStart-t.span.cleanStart),n}var xt=class{root=null;nextOrder=0;distanceFn;constructor(e){this.distanceFn=e}insert(e){let t={key:e,insertionOrder:this.nextOrder++,children:new Map};if(this.root===null){this.root=t;return}let n=this.root;for(;;){let r=this.distanceFn(e,n.key);if(r===0)return;let i=n.children.get(r);if(i)n=i;else{n.children.set(r,t);return}}}query(e,t){if(this.root===null)return[];let n=[],r=[this.root],i;for(;i=r.pop();){let a=this.distanceFn(e,i.key);a<=t&&n.push({key:i.key,distance:a,insertionOrder:i.insertionOrder});let o=a-t,s=a+t;for(let[e,t]of i.children)e>=o&&e<=s&&r.push(t)}return n.sort((e,t)=>e.distance-t.distance||e.insertionOrder-t.insertionOrder),n}};function St(e,t,n=1/0){if(e.length===0)return Math.min(t.length,n+1);if(t.length===0)return Math.min(e.length,n+1);let r=e.length<=t.length?e:t,i=e.length<=t.length?t:e,a=r.length,o=Array.from({length:a+1},(e,t)=>t),s=Array(a+1);for(let e=1;e<=i.length;e++){s[0]=e;let t=e;for(let n=1;n<=a;n++)i[e-1]===r[n-1]?s[n]=o[n-1]:s[n]=1+Math.min(o[n],s[n-1],o[n-1]),s[n]<t&&(t=s[n]);if(t>n)return n+1;let c=o;o=s,s=c}return o[a]}function Ct(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i]<=t?n=i+1:r=i}return n}function wt(e,t,n=/\n\n+/g){let r=new Map,i=[0],a;for(;(a=n.exec(e))!==null;)i.push(a.index+a[0].length);i.push(e.length);for(let e=0;e<t.length;e++){let n=t[e].span.originalStart;r.set(e,Ct(i,n)-1)}return r}function Tt(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r].span.cleanStart,a=0,o=0,s=t.length-1;for(;o<=s;){let e=o+s>>>1,n=t[e];if(i<n.start)s=e-1;else if(i>=n.end)o=e+1;else{a=n.footnoteNumber;break}}n.set(r,a)}return n}function Et(e,t,n,r,i=!1){if(r===`none`)return!0;let a=n.get(e),o=n.get(t);return!!(a===void 0||o===void 0||a===o||r===`footnote`&&i&&a===0)}var Dt=class{citations;text;options;context;partyNameTree;constructor(e,t,n={}){this.citations=e,this.text=t,this.options={scopeStrategy:n.scopeStrategy??`none`,autoDetectParagraphs:n.autoDetectParagraphs??!0,paragraphBoundaryPattern:n.paragraphBoundaryPattern??/\n\n+/g,fuzzyPartyMatching:n.fuzzyPartyMatching??!0,partyMatchThreshold:n.partyMatchThreshold??.8,reportUnresolved:n.reportUnresolved??!0,footnoteMap:n.footnoteMap},this.partyNameTree=new xt(St),this.context={citationIndex:0,allCitations:e,lastResolvedIndex:void 0,fullCitationHistory:new Map,paragraphMap:new Map},this.options.autoDetectParagraphs&&(this.context.paragraphMap=wt(t,e,this.options.paragraphBoundaryPattern)),this.options.scopeStrategy===`footnote`&&this.options.footnoteMap&&(this.context.paragraphMap=Tt(e,this.options.footnoteMap))}resolve(){let e=[];for(let n=0;n<this.citations.length;n++){this.context.citationIndex=n;let r=this.citations[n],i;switch(r.type){case`id`:i=this.resolveId(r);break;case`supra`:i=this.resolveSupra(r);break;case`shortFormCase`:i=this.resolveShortFormCase(r);break;default:t(r)&&(this.context.lastResolvedIndex=n,this.trackFullCitation(r,n));break}i?.resolvedTo!==void 0&&(this.context.lastResolvedIndex=i.resolvedTo),e.push({...r,resolution:i})}return e}resolveId(e){let t=this.context.citationIndex,n=this.context.lastResolvedIndex;return n===void 0?this.createFailureResult(`No preceding citation found`):this.isWithinScope(n,t)?{resolvedTo:n,confidence:1}:this.createFailureResult(`Antecedent citation outside scope boundary`)}resolveSupra(e){if(!e.partyName)return;let t=this.context.citationIndex,n=this.normalizePartyName(e.partyName),r=n.length,i=this.options.partyMatchThreshold,a=r===0?0:Math.ceil(r*(1-i)/i),o=this.partyNameTree.query(n,a);o.sort((e,t)=>e.insertionOrder-t.insertionOrder);let s;for(let e of o){let n=this.context.fullCitationHistory.get(e.key);if(n===void 0||!this.isWithinScope(n,t,!0))continue;let i=Math.max(r,e.key.length),a=i===0?1:1-e.distance/i;(!s||a>s.similarity)&&(s={index:n,similarity:a})}if(!s)return this.createFailureResult(`No full citation found in scope`);if(s.similarity<this.options.partyMatchThreshold)return this.createFailureResult(`Party name similarity ${s.similarity.toFixed(2)} below threshold ${this.options.partyMatchThreshold}`);let c=[];return s.similarity<1&&c.push(`Fuzzy match: similarity ${s.similarity.toFixed(2)}`),{resolvedTo:s.index,confidence:s.similarity,warnings:c.length>0?c:void 0}}resolveShortFormCase(e){let t=this.context.citationIndex;for(let n=t-1;n>=0;n--){let r=this.citations[n];if(r.type===`case`&&r.volume===e.volume&&this.normalizeReporter(r.reporter)===this.normalizeReporter(e.reporter))return this.isWithinScope(n,t,!0)?{resolvedTo:n,confidence:.95}:this.createFailureResult(`Matching citation outside scope boundary`)}return this.createFailureResult(`No matching full case citation found`)}trackFullCitation(e,t){if(e.type===`case`&&(e.defendantNormalized&&(this.context.fullCitationHistory.set(e.defendantNormalized,t),this.partyNameTree.insert(e.defendantNormalized)),e.plaintiffNormalized&&(this.context.fullCitationHistory.set(e.plaintiffNormalized,t),this.partyNameTree.insert(e.plaintiffNormalized)),!e.plaintiffNormalized&&!e.defendantNormalized)){let n=this.extractPartyName(e);if(n){let e=this.normalizePartyName(n);this.context.fullCitationHistory.set(e,t),this.partyNameTree.insert(e)}}}extractPartyName(e){let t=e.span.originalStart,n=Math.max(0,t-100),r=this.text.substring(n,t),i=r.match(/([A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*)\s+v\.?\s+[A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*,\s*$/);if(i)return this.stripSignalWords(i[1].trim());let a=r.match(/([A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*),\s*$/);if(a)return this.stripSignalWords(a[1].trim())}stripSignalWords(e){let t=e.replace(/^(?:In(?!\s+re\b)|See(?:\s+[Aa]lso)?|Compare|But(?:\s+[Ss]ee)?|Cf\.?|Also)\s+/i,``).trim();return t.length>0?t:e}normalizePartyName(e){return e.toLowerCase().replace(/\s+/g,` `).trim()}normalizeReporter(e){return e.toLowerCase().replace(/\s+/g,``).replace(/\./g,``)}isWithinScope(e,t,n=!1){return Et(e,t,this.context.paragraphMap,this.options.scopeStrategy,n)}createFailureResult(e){if(this.options.reportUnresolved)return{resolvedTo:void 0,failureReason:e,confidence:0}}};function Ot(e,t,n){return new Dt(e,t,n).resolve()}function kt(e,t=``){let n=new Map;if(e.length===0||t===``)return n;let r=new Set;for(let i=0;i<e.length;i++){let a=e[i];if(a.type!==`case`||r.has(i))continue;let o=[];for(let n=i+1;n<e.length;n++){let s=e[n];if(s.type!==`case`)break;let c=(n===i+1?a:e[n-1]).span.cleanEnd,l=s.span.cleanStart;if(l-c>20)break;let u=t.substring(c,l);if(!u.includes(`,`))break;let d=u.indexOf(`,`);if(u.length-d-1>5||t.substring(a.span.cleanEnd,s.span.cleanEnd).includes(`)`)||!At(t,s.span.cleanEnd))break;o.push(n),r.add(n)}o.length>0&&n.set(i,o)}return n}function At(e,t){let n=e.substring(t,t+200),r=n.indexOf(`(`);if(r===-1)return!1;let i=0;for(let e=r;e<n.length;e++)if(n[e]===`(`)i++;else if(n[e]===`)`&&(i--,i===0))return!0;return!1}const Q=jt();function jt(){return[{regex:/^see\s+generally\b/i,signal:`see generally`},{regex:/^see\s+also\b/i,signal:`see also`},{regex:/^but\s+see\b/i,signal:`but see`},{regex:/^but\s+cf\.?(?=\s|$)/i,signal:`but cf`},{regex:/^compare\b/i,signal:`compare`},{regex:/^accord\b/i,signal:`accord`},{regex:/^contra\b/i,signal:`contra`},{regex:/^see\b/i,signal:`see`},{regex:/^cf\.?(?=\s|$)/i,signal:`cf`}].map(({regex:e,signal:t})=>({regex:e,endRegex:RegExp(`${e.source.replace(/^\^/,`(?<![a-z])`)}\\s*$`,e.flags),signal:t}))}function Mt(e){let t=`fullSpan`in e?e.fullSpan:void 0;return t?t.cleanEnd:e.span.cleanEnd}function $(e){let t=`fullSpan`in e?e.fullSpan:void 0;return t?t.cleanStart:e.span.cleanStart}function Nt(e,t){e.signal=t}function Pt(e){let t=e.trimStart();for(let{regex:e,signal:n}of Q){let r=e.exec(t);if(r)return{signal:n,length:r[0].length}}}function Ft(e){let t=e.indexOf(`;`);if(t===-1||e.substring(0,t).trim()!==``)return{valid:!1};let n=e.substring(t+1).trim();if(n===``)return{valid:!0};let r=Pt(n);return r&&n.substring(r.length).trim()===``?{valid:!0,signal:r.signal}:{valid:!1}}function It(e,t){if(e.length<2)return;let n=[],r=[];for(let i=0;i<e.length-1;i++){let a=e[i],o=e[i+1];if(o.type===`case`&&o.subsequentHistoryOf){r.length>=2&&n.push(r),r=[];continue}if(a.type===`case`&&a.subsequentHistoryOf)continue;let s=Mt(a),c=$(o);if(c<=s){r.length>=2&&n.push(r),r=[];continue}let l=Ft(t.substring(s,c));l.valid?(r.length===0&&r.push(i),r.push(i+1),l.signal&&!o.signal&&Nt(o,l.signal)):(r.length>=2&&n.push(r),r=[])}r.length>=2&&n.push(r);for(let t=0;t<n.length;t++){let r=n[t];if(r.length<2)continue;let i=`sc-${t}`;for(let t=0;t<r.length;t++){let n=e[r[t]];n.stringCitationGroupId=i,n.stringCitationIndex=t,n.stringCitationGroupSize=r.length}}for(let r of n){if(r.length<2)continue;let n=e[r[0]];if(n.signal)continue;let i=Math.max(0,$(n)-60),a=t.substring(i,$(n)).trim();for(let{endRegex:e,signal:t}of Q)if(e.test(a)){Nt(n,t);break}}}function Lt(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r.signal&&r.stringCitationGroupId)continue;let i=n>0?Mt(e[n-1]):0,a=r.span.cleanStart;if(a<=i)continue;let o=t.substring(i,a),s=[];for(let{signal:e}of Q){let t=e.replace(/\./g,`\\.`).replace(/\s+/g,`\\s+`),n=RegExp(`(?<![a-zA-Z])(${t})(?![a-zA-Z])`,`gi`),r;for(;(r=n.exec(o))!==null;)s.push({signal:e,start:r.index,end:r.index+r[0].length})}if(s.length===0)continue;s.sort((e,t)=>{let n=t.end-e.end;return n===0?t.end-t.start-(e.end-e.start):n});let c=s[0];for(let e of s)e.start<=c.start&&e.end>=c.end&&(c=e);Nt(r,c.signal)}}const Rt=1750,zt=.1,Bt=new Set([`i.c.j.`,`u.n.t.s.`,`i.l.m.`,`i.l.r.`,`p.c.i.j.`,`a.c.`,`w.l.r.`,`all e.r.`,`q.b.`,`k.b.`,`ch.`,`co. rep.`,`e.c.r.`,`e.h.r.r.`,`c.m.l.r.`,`edw.`]);function Vt(e){if(e.type===`case`||e.type===`shortFormCase`)return e.reporter;if(e.type===`journal`)return e.abbreviation}function Ht(e){switch(e.type){case`case`:return e.year;case`journal`:return e.year;case`federalRegister`:return e.year;case`statutesAtLarge`:return e.year;default:return}}const Ut=new Set([`court`,`rule`,`section`,`chapter`,`article`,`part`,`title`,`paragraph`,`clause`,`amendment`,`dismissed`,`granted`,`denied`,`filed`,`argued`]);function Wt(e){return!!(e.toLowerCase().split(/\s+/).some(e=>Ut.has(e))||!e.includes(`.`)&&e.length>12)}const Gt=new Set(`the.a.an.in.on.at.but.and.for.by.to.with.from.as.if.so.nor.yet.not.no.then.when.where.who.what.how.that.this.these.those.he.she.it.they.we.his.her.its.their.our.was.were.is.are.has.had.been.being.did.does.do.may.shall.will.would.could.should.held.said.found.made.took.gave.see.also.january.february.march.april.june.july.august.september.october.november.december`.split(`.`)),Kt=2e3,qt=/^\d{1,2}-\d{4,}$/;function Jt(e){if(e.type!==`case`&&e.type!==`shortFormCase`)return!1;let t=e;return typeof t.volume==`number`?t.volume>Kt:!1}function Yt(e){if(e.type!==`case`&&e.type!==`shortFormCase`)return!1;let t=e,n=String(t.volume);return qt.test(n)}function Xt(t){if(t.type!==`case`&&t.type!==`shortFormCase`)return!1;let n=t,r=typeof n.volume==`number`?n.volume:Number.parseInt(String(n.volume),10);if(Number.isNaN(r)||r<1||r>20)return!1;let i=n.reporter;if(!i)return!1;let a=e.s();return a?(a.byAbbreviation.get(i.toLowerCase())??[]).length===0:i.includes(`.`)?!1:i.toLowerCase().split(/\s+/).some(e=>Gt.has(e))}function Zt(e){let t=Vt(e);if(t&&Bt.has(t.toLowerCase().trim())||t&&(e.type===`case`||e.type===`shortFormCase`)&&Wt(t)||Jt(e)||Yt(e)||Xt(e))return!0;let n=Ht(e);return n!==void 0&&n<Rt}function Qt(e){let t=[],n=Vt(e);if(n){let r=n.toLowerCase().trim();Bt.has(r)&&t.push(`Reporter "${n}" is a known non-US source`),(e.type===`case`||e.type===`shortFormCase`)&&Wt(n)&&t.push(`Reporter "${n}" contains prose words or is implausibly long`)}if(Jt(e)){let n=e;t.push(`Volume ${n.volume} exceeds maximum plausible volume (${Kt}) — likely a zip code or other number`)}if(Yt(e)){let n=e;t.push(`Hyphenated volume "${n.volume}" matches docket number pattern — likely a case number, not a citation volume`)}if(Xt(e)){let n=e;t.push(`Small volume (${n.volume}) with unrecognized reporter "${n.reporter}" — likely a paragraph or footnote marker`)}let r=Ht(e);return r!==void 0&&r<Rt&&t.push(`Year ${r} predates US legal reporting (threshold: ${Rt})`),t}function $t(e,t){if(t)return e.filter(e=>!Zt(e));for(let t of e){if(t.confidence===zt&&t.warnings?.length)continue;let e=Qt(t);if(e.length>0){t.confidence=zt;let n=e.map(e=>({level:`warning`,message:e,position:{start:t.span.originalStart,end:t.span.originalEnd}}));t.warnings=[...t.warnings||[],...n]}}return e}const en=/^(\S+)\s+(.+)\s+(\d+)$/;function tn(e,t){let n=performance.now(),{cleaned:r,transformationMap:i,warnings:a}=y(e,t?.cleaners),o;if(t?.detectFootnotes){let t=O(e);t.length>0&&(o=A(t,i))}let s=bt(r,t?.patterns||[..._t,...vt,...ht,...Ne,...yt,...gt]),c=[],l=new Set,u=r.length<65536;for(let e of s){let t=u?e.span.cleanStart<<16|e.span.cleanEnd:`${e.span.cleanStart}-${e.span.cleanEnd}`;l.has(t)||(l.add(t),c.push(e))}let d=kt(c,r),f=new Map;for(let[e,t]of d.entries())for(let n of t)f.set(n,e);let p=[];for(let e=0;e<c.length;e++){let t=c[e],o;switch(t.type){case`case`:o=t.patternId===`id`||t.patternId===`ibid`?Ke(t,i,r):t.patternId===`supra`?qe(t,i):t.patternId===`shortFormCase`?Je(t,i):je(t,i,r);break;case`statute`:o=pt(t,i);break;case`journal`:o=He(t,i,r);break;case`neutral`:o=We(t,i,r);break;case`publicLaw`:o=Ge(t,i);break;case`federalRegister`:o=Ve(t,i);break;case`statutesAtLarge`:o=mt(t,i);break;case`constitutional`:o=Be(t,i);break;default:continue}if(a.length>0&&(o.warnings=[...o.warnings||[],...a]),o.processTimeMs=performance.now()-n,o.type===`case`){let t=d.has(e),n=f.has(e);if(t||n){let r=c[n?f.get(e)??e:e],i=en.exec(r.text);if(i){let[,n,r,a]=i;if(o.groupId=`${n}-${r.replace(/\s+/g,`.`)}-${a}`,t){let t=d.get(e)??[];o.parallelCitations=t.map(e=>{let t=c[e],n=en.exec(t.text);if(n){let[,e,t,r]=n;return{volume:/^\d+$/.test(e)?Number.parseInt(e,10):e,reporter:t,page:Number.parseInt(r,10)}}return{volume:0,reporter:``,page:0}})}}}}p.push(o)}rn(p),It(p,r),Lt(p,r);let m=$t(p,t?.filterFalsePositives??!1);return o&&j(m,o),t?.resolve?Ot(m,e,o?{...t.resolutionOptions,footnoteMap:o}:t.resolutionOptions):m}async function nn(e,t){return tn(e,t)}function rn(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(r.type!==`case`||!r.subsequentHistoryEntries)continue;let i=r.subsequentHistoryEntries,a=0;for(let r=n+1;r<e.length&&a<i.length;r++){let o=e[r];if(o.type!==`case`)continue;let s=i[a].signalSpan.cleanEnd;o.span.cleanStart>=s&&(t.push({parentIdx:n,childIdx:r,signal:i[a].signal}),a++)}}if(t.length===0)return;let n=new x(e.length);for(let e of t)n.union(e.parentIdx,e.childIdx);let r=new Map;for(let e of t)r.set(e.childIdx,e.signal);for(let[t,i]of n.components()){if(i.length===1)continue;let n=e[t];if(n.type!==`case`)continue;let a=[...n.subsequentHistoryEntries??[]];for(let n of i){if(n===t)continue;let i=e[n];if(i.type!==`case`)continue;let o=r.get(n);if(o&&(i.subsequentHistoryOf={index:t,signal:o},i.subsequentHistoryEntries)){for(let e of i.subsequentHistoryEntries)a.push({...e,order:a.length});i.subsequentHistoryEntries=void 0}}n.subsequentHistoryEntries=a}}exports.DocumentResolver=Dt,exports.applyFalsePositiveFilters=$t,exports.assertUnreachable=a,exports.cleanText=y,exports.detectFootnotes=O,exports.extractCase=je,exports.extractCitations=tn,exports.extractCitationsAsync=nn,exports.extractConstitutional=Be,exports.extractFederalRegister=Ve,exports.extractJournal=He,exports.extractNeutral=We,exports.extractPublicLaw=Ge,exports.extractStatute=pt,exports.extractStatutesAtLarge=mt,exports.isCaseCitation=r,exports.isCitationType=i,exports.isFullCitation=t,exports.isShortFormCitation=n,exports.normalizeCourt=te,exports.parsePincite=V,exports.resolveCitations=Ot,exports.spanFromGroupIndex=o,exports.tokenize=bt;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./knownCodes-D_EXxDqq.cjs`);function t(e){return e.type===`case`||e.type===`statute`||e.type===`journal`||e.type===`neutral`||e.type===`publicLaw`||e.type===`federalRegister`||e.type===`statutesAtLarge`||e.type===`constitutional`}function n(e){return e.type===`id`||e.type===`supra`||e.type===`shortFormCase`}function r(e){return e.type===`case`}function i(e,t){return e.type===t}function a(e){throw Error(`Unexpected value: ${e}`)}function o(e,t,n){let r=e+t[0],i=e+t[1],{originalStart:a,originalEnd:o}=s({cleanStart:r,cleanEnd:i},n);return{cleanStart:r,cleanEnd:i,originalStart:a,originalEnd:o}}function s(e,t){return t.cleanToOriginalSegments?{originalStart:t.cleanToOriginalSegments.lookup(e.cleanStart),originalEnd:t.cleanToOriginalSegments.lookup(e.cleanEnd)}:{originalStart:t.cleanToOriginal.get(e.cleanStart)??e.cleanStart,originalEnd:t.cleanToOriginal.get(e.cleanEnd)??e.cleanEnd}}function c(e){return e.replace(/<[^>]+>/g,``)}function l(e){return e.replace(/(\w)-\s*[\n\r]+\s*(\w)/g,`$1$2`)}function u(e){return e.replace(/[\t\n\r\u00A0\u2000-\u200A\u202F\u205F\u3000]/g,` `)}function d(e){return e.replace(/ {2,}/g,` `)}function f(e){return e.normalize(`NFKC`)}function p(e){return e.replace(/[\u201C\u201D]/g,`"`).replace(/[\u2018\u2019]/g,`'`)}function m(e){return e.replace(/[\u2014\u2015]/g,`---`).replace(/[\u2010\u2012\u2013]/g,`-`)}function h(e){return e.replace(/§/gi,`§`).replace(/¶/gi,`¶`).replace(/&/gi,`&`).replace(/ /gi,` `).replace(/</gi,`<`).replace(/>/gi,`>`).replace(/"/gi,`"`).replace(/'/gi,`'`).replace(/&#(\d+);/g,(e,t)=>{let n=Number.parseInt(t,10);return Number.isNaN(n)?e:String.fromCharCode(n)}).replace(/&#x([0-9a-fA-F]+);/g,(e,t)=>{let n=Number.parseInt(t,16);return Number.isNaN(n)?e:String.fromCharCode(n)})}function g(e){let t=e;return t=t.replace(/\bU\.\s+S\./g,`U.S.`),t=t.replace(/\bS\.\s+Ct\./g,`S.Ct.`),t=t.replace(/\bL\.\s+Ed\./g,`L.Ed.`),t=t.replace(/\bF\.\s+Supp\./g,`F.Supp.`),t=t.replace(/\bF\.\s+(\d+[a-z]+)/g,`F.$1`),t=t.replace(/([A-Za-z])\.\s+(\d+[a-z]+)/g,`$1.$2`),t}function _(e){return e.replace(/[\u2032\u2035]/g,`'`).replace(/\u200B|\u200C|\u200D|\u2060|\uFEFF/g,``)}var v=class e{segments;constructor(e){this.segments=e}static identity(t){return new e([{cleanPos:0,origPos:0,len:t+1}])}static fromMap(t){if(t.size===0)return new e([]);let n=[...t.entries()].sort((e,t)=>e[0]-t[0]),r=[],i=n[0][0],a=n[0][1],o=1;for(let e=1;e<n.length;e++){let[t,s]=n[e],c=i+o,l=a+o;t===c&&s===l?o++:(r.push({cleanPos:i,origPos:a,len:o}),i=t,a=s,o=1)}return r.push({cleanPos:i,origPos:a,len:o}),new e(r)}lookup(e){let t=this.segments;if(t.length===0)return e;let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>>1,a=t[i];if(e<a.cleanPos)r=i-1;else if(e>=a.cleanPos+a.len)n=i+1;else return a.origPos+(e-a.cleanPos)}let i=t[t.length-1];return i.origPos+(e-i.cleanPos)}};function y(e,t=[c,h,l,u,d,f,m,p,_,g]){let n=e,r=new Map,i=new Map;for(let t=0;t<=e.length;t++)r.set(t,t),i.set(t,t);for(let e of t){let t=n,a=e(n);if(t!==a){let{newCleanToOriginal:e,newOriginalToClean:o}=b(t,a,r,i);r=e,i=o,n=a}}let a={cleanToOriginal:r,originalToClean:i,cleanToOriginalSegments:v.fromMap(r)};return{cleaned:n,transformationMap:a,warnings:[]}}function b(e,t,n,r){let i=new Map,a=new Map,o=0,s=0;for(;o<=e.length||s<=t.length;){if(o>=e.length&&s>=t.length){let e=n.get(o)??o;i.set(s,e),a.set(e,s);break}if(o>=e.length){let e=n.get(o)??o;i.set(s,e),s++;continue}if(s>=t.length){let e=n.get(o)??o;a.set(e,s),o++;continue}if(e[o]===t[s]){let e=n.get(o)??o;i.set(s,e),a.set(e,s),o++,s++}else{if(e.length-o===t.length-s){let e=n.get(o)??o;i.set(s,e),a.set(e,s),o++,s++;continue}let r=!1,c=Math.max(40,Math.abs(e.length-t.length)+10),l=-1,u=-1;for(let n=1;n<=c;n++){if(l<0&&o+n<e.length&&e[o+n]===t[s]){let r=!0;for(let i=1;i<3;i++){let a=o+n+i,c=s+i;if(a>=e.length||c>=t.length)break;if(e[a]!==t[c]){r=!1;break}}r&&(l=n)}if(u<0&&s+n<t.length&&e[o]===t[s+n]){let r=!0;for(let i=1;i<3;i++){let a=o+i,c=s+n+i;if(a>=e.length||c>=t.length)break;if(e[a]!==t[c]){r=!1;break}}r&&(u=n)}if(l>=0&&u>=0)break}if(l>=0&&(u<0||l<=u)){for(let e=0;e<l;e++){let t=n.get(o+e)??o+e;a.set(t,s)}o+=l,r=!0}else if(u>=0){let e=n.get(o)??o;for(let t=0;t<u;t++)i.set(s+t,e);s+=u,r=!0}if(r)continue;let d=n.get(o)??o;i.set(s,d),a.set(d,s),o++,s++}}return{newCleanToOriginal:i,newOriginalToClean:a}}var x=class{parent;rank;constructor(e){this.parent=Array.from({length:e},(e,t)=>t),this.rank=Array(e).fill(0)}find(e){let t=e;for(;this.parent[t]!==t;)this.parent[t]=this.parent[this.parent[t]],t=this.parent[t];return t}union(e,t){let n=this.find(e),r=this.find(t);if(n!==r){if(n>r){let e=n;n=r,r=e}this.parent[r]=n,this.rank[n]===this.rank[r]&&this.rank[n]++}}connected(e,t){return this.find(e)===this.find(t)}components(){let e=new Map;for(let t=0;t<this.parent.length;t++){let n=this.find(t),r=e.get(n);r||(r=[],e.set(n,r)),r.push(t)}return e}};function S(e,t,n){let r=/\blabel\s*=\s*["'](\d+)["']/.exec(e);if(r)return Number.parseInt(r[1],10);let i=/\bid\s*=\s*["'](?:fn|footnote)(\d+)["']/.exec(e);if(i)return Number.parseInt(i[1],10);let a=t.replace(/<[^>]*>/g,``),o=/^\s*(\d+)[.\s):]/.exec(a);return o?Number.parseInt(o[1],10):n+1}function C(e,t,n){let r=RegExp(`<${t}\\b[^>]*>`,`gi`),i=RegExp(`</${t}\\s*>`,`gi`);r.lastIndex=n,i.lastIndex=n;let a=1;for(;a>0;){let t=r.exec(e),n=i.exec(e);if(!n)return null;if(t&&t.index<n.index)a++,i.lastIndex=t.index+t[0].length;else{if(a--,a===0)return{contentEnd:n.index,tagEnd:n.index+n[0].length};r.lastIndex=n.index+n[0].length}}return null}function w(e){let t=[],n,r=RegExp(`<(footnote|fn)\\b[^>]*>|<(div|aside|section|p|span)\\b[^>]*(?:class\\s*=\\s*["'][^"']*\\bfootnote\\b[^"']*["']|id\\s*=\\s*["'](?:fn|footnote)\\d*["'])[^>]*>`,`gi`);for(;(n=r.exec(e))!==null;){let i=n[0],a=n.index+i.length,o=C(e,n[1]||n[2],a);if(!o)continue;let s=S(i,e.slice(a,o.contentEnd),t.length);t.push({start:a,end:o.contentEnd,footnoteNumber:s}),r.lastIndex=o.tagEnd}return t.sort((e,t)=>e.start-t.start)}const T=/^\s*[-_]{5,}\s*$/m;function E(e){let t=T.exec(e);if(!t)return[];let n=t.index+t[0].length,r=e.slice(n),i=RegExp(`^\\s*(?:FN\\s*(\\d+)[.\\s:)]|\\[(\\d+)\\]\\s|n\\.\\s*(\\d+)\\s|(\\d+)\\.\\s)`,`gm`),a=[],o;for(;(o=i.exec(r))!==null;){let e=o[1]||o[2]||o[3]||o[4];e&&a.push({index:o.index+n,footnoteNumber:Number.parseInt(e,10)})}if(a.length===0)return[];let s=[];for(let t=0;t<a.length;t++){let n=a[t].index,r=t+1<a.length?a[t+1].index:e.length;s.push({start:n,end:r,footnoteNumber:a[t].footnoteNumber})}return s}const D=/<[^>]+>/;function O(e){if(D.test(e)){let t=w(e);if(t.length>0)return t}return E(e)}function k(e,t,n,r=20){for(let i=1;i<=r;i++){let r=n===`forward`?e+i:e-i,a=t.get(r);if(a!==void 0)return a}}function A(e,t){return e.length===0?[]:e.map(e=>({start:t.originalToClean.get(e.start)??k(e.start,t.originalToClean,`forward`)??e.start,end:t.originalToClean.get(e.end)??k(e.end,t.originalToClean,`backward`)??e.end,footnoteNumber:e.footnoteNumber}))}function j(e,t){if(t.length!==0)for(let n of e){let e=n.span.cleanStart,r=0,i=t.length-1;for(;r<=i;){let a=r+i>>>1,o=t[a];if(e<o.start)i=a-1;else if(e>=o.end)r=a+1;else{n.inFootnote=!0,n.footnoteNumber=o.footnoteNumber;break}}}}const M={jan:1,january:1,feb:2,february:2,mar:3,march:3,apr:4,april:4,may:5,jun:6,june:6,jul:7,july:7,aug:8,august:8,sep:9,sept:9,september:9,oct:10,october:10,nov:11,november:11,dec:12,december:12};function N(e){let t=M[e.toLowerCase().replace(/\.$/,``)];if(t===void 0)throw Error(`Invalid month name: ${e}`);return t}function P(e){let{year:t,month:n,day:r}=e;return n!==void 0&&r!==void 0?`${t}-${String(n).padStart(2,`0`)}-${String(r).padStart(2,`0`)}`:n===void 0?String(t):`${t}-${String(n).padStart(2,`0`)}`}function F(e){let t=e.match(/\b(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Sept|Oct|Nov|Dec)\.?\s+(\d{1,2}),?\s+(\d{4})\b/i);if(t){let e=N(t[1]),n=Number.parseInt(t[2],10),r={year:Number.parseInt(t[3],10),month:e,day:n};return{iso:P(r),parsed:r}}let n=e.match(/\b(January|February|March|April|May|June|July|August|September|October|November|December)\s+(\d{1,2}),?\s+(\d{4})\b/i);if(n){let e=N(n[1]),t=Number.parseInt(n[2],10),r={year:Number.parseInt(n[3],10),month:e,day:t};return{iso:P(r),parsed:r}}let r=e.match(/\b(\d{1,2})\/(\d{1,2})\/(\d{4})\b/);if(r){let e=Number.parseInt(r[1],10),t=Number.parseInt(r[2],10),n={year:Number.parseInt(r[3],10),month:e,day:t};return{iso:P(n),parsed:n}}let i=e.match(/\b(\d{4})\b/);if(i){let e={year:Number.parseInt(i[1],10)};return{iso:P(e),parsed:e}}}function I(e){return{level:e,jurisdiction:`federal`,confidence:1}}function L(e,t){return{level:e,jurisdiction:`state`,state:t,confidence:1}}function R(e){return{level:e,jurisdiction:`state`,confidence:.7}}const z=new Map([[`U.S.`,I(`supreme`)],[`S.Ct.`,I(`supreme`)],[`L.Ed.`,I(`supreme`)],[`L.Ed.2d`,I(`supreme`)],[`S. Ct.`,I(`supreme`)],[`L. Ed.`,I(`supreme`)],[`L. Ed. 2d`,I(`supreme`)],[`U. S.`,I(`supreme`)],[`L.Ed. 2d`,I(`supreme`)],[`L. Ed.2d`,I(`supreme`)],[`F.`,I(`appellate`)],[`F.2d`,I(`appellate`)],[`F.3d`,I(`appellate`)],[`F.4th`,I(`appellate`)],[`F. App'x`,I(`appellate`)],[`F.Supp.`,I(`trial`)],[`F.Supp.2d`,I(`trial`)],[`F.Supp.3d`,I(`trial`)],[`F.Supp.4th`,I(`trial`)],[`F. Supp.`,I(`trial`)],[`F. Supp. 2d`,I(`trial`)],[`F. Supp. 3d`,I(`trial`)],[`F. Supp. 4th`,I(`trial`)],[`F.R.D.`,I(`trial`)],[`B.R.`,I(`trial`)],[`Cal.`,L(`supreme`,`CA`)],[`Cal.2d`,L(`supreme`,`CA`)],[`Cal.3d`,L(`supreme`,`CA`)],[`Cal.4th`,L(`supreme`,`CA`)],[`Cal.5th`,L(`supreme`,`CA`)],[`Cal.App.`,L(`appellate`,`CA`)],[`Cal.App.2d`,L(`appellate`,`CA`)],[`Cal.App.3d`,L(`appellate`,`CA`)],[`Cal.App.4th`,L(`appellate`,`CA`)],[`Cal.App.5th`,L(`appellate`,`CA`)],[`Cal.Rptr.`,L(`unknown`,`CA`)],[`Cal.Rptr.2d`,L(`unknown`,`CA`)],[`Cal.Rptr.3d`,L(`unknown`,`CA`)],[`N.Y.`,L(`supreme`,`NY`)],[`N.Y.2d`,L(`supreme`,`NY`)],[`N.Y.3d`,L(`supreme`,`NY`)],[`A.D.`,L(`appellate`,`NY`)],[`A.D.2d`,L(`appellate`,`NY`)],[`A.D.3d`,L(`appellate`,`NY`)],[`Misc.`,L(`trial`,`NY`)],[`Misc.2d`,L(`trial`,`NY`)],[`Misc.3d`,L(`trial`,`NY`)],[`N.Y.S.`,L(`unknown`,`NY`)],[`N.Y.S.2d`,L(`unknown`,`NY`)],[`N.Y.S.3d`,L(`unknown`,`NY`)],[`Ill.`,L(`supreme`,`IL`)],[`Ill.2d`,L(`supreme`,`IL`)],[`Ill.App.`,L(`appellate`,`IL`)],[`Ill.App.2d`,L(`appellate`,`IL`)],[`Ill.App.3d`,L(`appellate`,`IL`)],[`Ill.Dec.`,L(`unknown`,`IL`)],[`Ohio St.`,L(`supreme`,`OH`)],[`Ohio St.2d`,L(`supreme`,`OH`)],[`Ohio St.3d`,L(`supreme`,`OH`)],[`Ohio App.3d`,L(`appellate`,`OH`)],[`Pa.`,L(`supreme`,`PA`)],[`Pa. Super.`,L(`appellate`,`PA`)],[`Tex.`,L(`supreme`,`TX`)],[`Fla.`,L(`supreme`,`FL`)],[`Mass.`,L(`supreme`,`MA`)],[`Mass. App. Ct.`,L(`appellate`,`MA`)],[`A.`,R(`unknown`)],[`A.2d`,R(`unknown`)],[`A.3d`,R(`unknown`)],[`S.E.`,R(`unknown`)],[`S.E.2d`,R(`unknown`)],[`S.E.3d`,R(`unknown`)],[`S.W.`,R(`unknown`)],[`S.W.2d`,R(`unknown`)],[`S.W.3d`,R(`unknown`)],[`N.E.`,R(`unknown`)],[`N.E.2d`,R(`unknown`)],[`N.E.3d`,R(`unknown`)],[`N.W.`,R(`unknown`)],[`N.W.2d`,R(`unknown`)],[`N.W.3d`,R(`unknown`)],[`So.`,R(`unknown`)],[`So.2d`,R(`unknown`)],[`So.3d`,R(`unknown`)],[`P.`,R(`unknown`)],[`P.2d`,R(`unknown`)],[`P.3d`,R(`unknown`)]]);function ee(e){return z.get(e)}const B=/^(?:at\s+)?(\*?)(\d+)(?:[-–—]\*?(\d+))?\s*(?:(?:nn?|note)\s*\.?\s*(\d+)(?:[-–—](\d+))?)?$/i;function V(e){let t=e.trim();if(!t)return null;let n=B.exec(t);if(!n)return null;let r=n[1],i=n[2],a=n[3],o=n[4],s=n[5],c=Number.parseInt(i,10),l,u=!1;if(a){u=!0;let e=Number.parseInt(a,10);if(a.length<i.length){let e=i.slice(0,i.length-a.length);l=Number.parseInt(e+a,10)}else l=e}let d=o?Number.parseInt(o,10):void 0,f=s?Number.parseInt(s,10):void 0,p={page:c,isRange:u,raw:t};return l!==void 0&&(p.endPage=l),d!==void 0&&(p.footnote=d),f!==void 0&&(p.footnoteEnd=f),r===`*`&&(p.starPage=!0),p}function te(e){if(!e||!e.trim())return;let t=e.trim();return t=t.replace(/\.\s+(?=[A-Za-z])/g,`.`),/[A-Za-z]$/.test(t)&&(/\./.test(t)||/^\d+\w*\s+[A-Z]/i.test(t))&&(t+=`.`),t}const H=new Set([`see`,`see also`,`see generally`,`cf`,`but see`,`but cf`,`compare`,`accord`,`contra`]),U=(()=>{let e=[...H].sort((e,t)=>t.length-e.length).map(e=>e.replace(/\s+/g,`\\s+`).replace(/\./g,`\\.`));return RegExp(`^(${e.join(`|`)})\\s+`,`i`)})();function ne(e){let t=Number.parseInt(e,10);return String(t)===e?t:e}const re=/(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Sept|Oct|Nov|Dec|January|February|March|April|May|June|July|August|September|October|November|December)\.?/,ie=new Date().getFullYear(),ae=new Set(`F.,F.2d,F.3d,F.4th,U.S.,S. Ct.,L. Ed.,L. Ed. 2d,P.,P.2d,P.3d,A.,A.2d,A.3d,N.E.,N.E.2d,N.E.3d,N.W.,N.W.2d,S.E.,S.E.2d,S.W.,S.W.2d,S.W.3d,So.,So. 2d,So. 3d,F. Supp.,F. Supp. 2d,F. Supp. 3d,F. Supp. 4th,F. App'x`.split(`,`)),oe=/^(\d+(?:-\d+)?)\s+([A-Za-z0-9.\s']+)\s+(?:\((\d+)\s+([A-Z][A-Za-z.]+)\)\s+)?(\d+|_{3,}|-{3,})/d,se=/^[_-]{3,}$/,ce=/,\s*(?:at\s+)?(\*?\d+(?:-\d+)?(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)/d,le=/\(([^)]+)\)/,ue=/^(?:,\s*(?:at\s+)?\*?\d+(?:-\d+)?)*(?:\s+(?:n|note)\s*\.?\s*\d+)?\s*\(([^)]+)\)/,de=/^(?:\s+at\s+|,\s*(?:at\s+)?)(\*?\d+(?:-\d+)?(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)/d,W=/\d\.\s+/g,G=/[\s,]/,K=/^(?:,\s*(?:at\s+)?\*?\d+(?:[-–—]\*?\d+)?(?:\s+(?:n|note)\s*\.?\s*\d+)?)+/,fe=[[/^aff'?d\s+on\s+other\s+grounds\b/i,`affirmed`],[/^affirmed\s+on\s+other\s+grounds\b/i,`affirmed`],[/^aff'?d\b/i,`affirmed`],[/^affirmed\b/i,`affirmed`],[/^rev'?d\s+and\s+remanded\b/i,`reversed`],[/^rev'?d\s+on\s+other\s+grounds\b/i,`reversed`],[/^reversed\s+and\s+remanded\b/i,`reversed`],[/^rev'?d\b/i,`reversed`],[/^reversed\b/i,`reversed`],[/^certiorari\s+denied\b/i,`cert_denied`],[/^cert\.\s*den(ied|\.)(?=[\s,;(]|$)/i,`cert_denied`],[/^certiorari\s+granted\b/i,`cert_granted`],[/^cert\.\s*granted\b/i,`cert_granted`],[/^overruled\s+by\b/i,`overruled`],[/^overruled\s+in\b/i,`overruled`],[/^overruling\b/i,`overruled`],[/^overruled\b/i,`overruled`],[/^vacated\s+by\b/i,`vacated`],[/^vacated\b/i,`vacated`],[/^remanded\s+for\s+reconsideration\b/i,`remanded`],[/^remanded\b/i,`remanded`],[/^modified\s+by\b/i,`modified`],[/^modified\b/i,`modified`],[/^abrogated\s+by\b/i,`abrogated`],[/^abrogated\s+in\b/i,`abrogated`],[/^abrogated\b/i,`abrogated`],[/^superseded\s+by\b/i,`superseded`],[/^superseded\b/i,`superseded`],[/^disapproved\s+of\b/i,`disapproved`],[/^disapproved\b/i,`disapproved`],[/^questioned\s+by\b/i,`questioned`],[/^questioned\b/i,`questioned`],[/^distinguished\s+by\b/i,`distinguished`],[/^distinguished\b/i,`distinguished`],[/^withdrawn\b/i,`withdrawn`],[/^reinstated\b/i,`reinstated`]];function pe(e){for(let[t,n]of fe){let r=t.exec(e);if(r)return{signal:n,matchLength:r[0].length}}}const me=new Set([`holding`,`finding`,`stating`,`noting`,`explaining`,`quoting`,`citing`,`discussing`,`describing`,`recognizing`,`applying`,`rejecting`,`adopting`,`requiring`]);function he(e){return me.has(e)}const ge=/^([a-z]+)\b/i,_e=/([A-Z][A-Za-z0-9\s.,'&()/-]+?)\s+v(?:s)?\.?\s+([A-Za-z0-9\s.,'&()/-]+?)\s*,\s*$/,ve=/\b(In\s+the\s+Matter\s+of|In re|Ex parte|Matter of|Estate of|State ex rel\.|United States ex rel\.|Application of|Petition of)\s+([A-Za-z0-9\s.,'&()/-]+?)\s*,\s*$/i,ye=new Set([`of`,`the`,`and`,`for`,`in`,`on`,`by`,`a`,`an`,`to`,`at`,`as`,`de`,`la`,`el`,`del`,`von`,`van`,`ex`,`rel`,`et`,`al`,`d`,`or`]);function q(e){let t=e.split(/\s+/);for(let e of t){if(!e||e===`&`)continue;let t=e.toLowerCase().replace(/[.,']+$/,``);if(!ye.has(t)&&!/^[A-Z]/.test(e)&&!/^\d/.test(e))return!1}return!0}const be=new Set([`this`,`that`,`these`,`those`,`here`,`there`,`such`,`its`,`his`,`her`,`their`,`our`]);function xe(e){let t=e.replace(/\s*\d{1,2}\/\d{1,2}\/\d{4}\s*$/,``).trim();return t=t.replace(/\s*\d{4}\s*$/,``).trim(),t=t.replace(/\s*,?\s*\d{1,2}\s*,?\s*$/,``).trim(),t=t.replace(RegExp(`\\s*${re.source}\\s*$`,`i`),``).trim(),t=t.replace(/,\s*$/,``).trim(),t&&/[A-Za-z]/.test(t)?t:void 0}const Se=new Set(`acad.acct.accts.admin.adm.advert.advoc.aff.affs.afr.agric.all.alt.am.ann.app.arb.assoc.assocs.atl.auth.auto.ave.bankr.behav.bd.bor.brit.broad.bhd.bros.bldg.bull.bus.can.cap.cas.cath.ctr.ctrs.cent.chem.child.chron.coal.coll.com.comm.compar.comp.comput.condo.conf.cong.consol.const.constr.cont.coop.corp.corps.corr.cosm.couns.cntys.cnty.crim.def.delinq.det.dev.dig.dir.disc.disp.distrib.dist.div.econ.educ.elec.emp.eng.enter.ent.equal.equip.est.eur.exam.exch.exec.expl.exp.fac.fam.fams.fed.fid.fin.found.gen.glob.grp.guar.hist.hosp.hous.hum.immigr.imp.inc.indem.indep.indus.info.inj.inst.ins.intell.intel.int.inv.invs.jurid.just.juv.lab.law.liab.ltd.loc.mach.mag.maint.mgmt.mgt.mfr.mfrs.mfg.mar.mkt.mktg.matrim.mech.med.merch.metro.min.misc.mod.mortg.mun.mut.nat.negl.negot.nw.no.nos.off.org.orgs.pac.pat.pers.pharm.phil.plan.pol.prac.pres.priv.prob.proc.prod.pro.prop.psych.pub.rec.reg.regul.rehab.rel.rels.rep.reprod.rsch.rsrv.resol.res.resp.rest.ret.rd.sav.sch.schs.sci.sec.serv.servs.sess.soc.solic.spec.stat.subcomm.sur.surv.sys.tchr.tech.telecomm.tel.temp.twp.transcon.transp.treas.tr.trs.tpk.unemplmt.unif.univ.urb.util.veh.vehs.vill.voc.whse.whol.litig.n.s.e.w.m.ne.se.sw.is.mt.ft.pt.rt.st.blvd.sq.hwy.pkwy.hts.v.vs.ct.cir.supp.cl.jud.super.sup.magis.mil.terr.ala.ariz.ark.cal.colo.conn.del.fla.ga.haw.ida.ill.ind.kan.ky.la.me.md.mass.mich.minn.miss.mo.mont.neb.nev.okla.or.pa.tenn.tex.vt.va.wash.wis.wyo.mr.mrs.ms.dr.jr.sr.prof.rev.hon.sgt.capt.col.lt.ed.op.ad.dep.ass.ry.co.cmty.cty.envtl.gend.par.prot.ref.sol.adver.admr.admx.assn.commcn.commn.commr.contl.dept.empr.empt.engg.engr.entmt.envt.examr.exr.exx.fedn.govt.intl.invr.meml.natl.profl.pship.publg.publn.regl.secy.sholder.socy`.split(`.`));function Ce(e,t){let n=t;for(;n>0&&/[-A-Za-z.']/.test(e[n-1]);)n--;let r=e.substring(n,t);if(!r)return!1;let i=r.replace(/['.]/g,``).toLowerCase();return!!(Se.has(i)||i.length===1&&/[a-z]/i.test(i)||/\.[A-Za-z]/.test(r))}const we=/\bId\.\s+/g,Te=/\(\s*(?:quoting|citing|cited\s+in|quoted\s+in|accord|discussing|noting|explaining|describing|recognizing|applying|rejecting|adopting|requiring|overruling|overruled\s+by|abrogated\s+by)(?:,\s*e\.g\.,?)?\s+/gi,Ee=/[.)]\s+(?=[A-Z])/g;function De(e,t,n=150){let r=Math.max(0,t-n),i=e.substring(r,t),a=r,o=-1,s;for(W.lastIndex=0;(s=W.exec(i))!==null;)o=s.index+s[0].length;for(we.lastIndex=0;(s=we.exec(i))!==null;){let e=s.index+s[0].length;e>o&&(o=e)}for(Te.lastIndex=0;(s=Te.exec(i))!==null;){let e=s.index+s[0].length;e>o&&(o=e)}for(Ee.lastIndex=0;(s=Ee.exec(i))!==null;){if(i[s.index]===`.`&&Ce(i,s.index))continue;let e=s.index+s[0].length;e>o&&(o=e)}o!==-1&&(i=i.substring(o),a=r+o);let c=_e.exec(i);if(c&&!c[0].includes(`;`)){let e=c[1].trim(),t=0;if(!q(e)){let n=e.split(/\s+/),r=n[0]??``,i=r.toLowerCase().replace(/[.,']+$/,``);if(!(/^[A-Z]/.test(r)&&!ye.has(i)&&!be.has(i))&&!U.exec(e))for(let r=1;r<n.length;r++){let i=n.slice(r).join(` `);if(/^[A-Z]/.test(i)&&q(i)){t=n.slice(0,r).join(` `).length+1,e=i;break}}}return{caseName:`${e} v. ${c[2].trim()}`,nameStart:a+c.index+t}}let l=ve.exec(i);if(l&&!l[0].includes(`;`))return{caseName:`${l[1]} ${l[2].trim()}`,nameStart:a+l.index};let u=i.replace(/,\s*$/,``),d=u.length-u.trimStart().length,f=u.substring(d),p=0,m=U.exec(f);m&&(p=m[0].length,f=f.substring(p));let h=f.trim();if(h.length>0&&q(h)){let e=(h.split(/\s+/)[0]??``).toLowerCase().replace(/[.,']+$/,``);if(!be.has(e)&&!h.includes(`;`))return{caseName:h,nameStart:a+d+p}}}function Oe(e,t,n=500){let r=[],i=[],a=t,o=Math.min(e.length,t+n),s,c=e.substring(a,o),l=K.exec(c);for(l&&(a+=l[0].length);a<o;){for(;a<o&&G.test(e[a]);)a++;if(a>=o||e[a]!==`(`){let t=e.substring(a,o),n=pe(t);if(n){s={text:t.substring(0,n.matchLength).replace(/\s+$/,``),normalized:n.signal,start:a,end:a+n.matchLength},a+=n.matchLength;continue}break}let t=a,n=0,c=a+1;for(;a<o;){let o=e[a];if(o===`(`)n++;else if(o===`)`&&(n--,n===0)){a++;let n=e.substring(c,a-1).trim();n.length>0&&(r.push({text:n,start:t,end:a}),s&&=(i.push({signal:s,nextParenIndex:r.length-1}),void 0));break}a++}if(n>0)break}return s&&i.push({signal:s,nextParenIndex:-1}),{parens:r,signals:i}}function J(e){let t={},n=F(e);n&&(t.date=n,t.year=n.parsed.year);let r=xe(e);if(r){t.court=r;let n=e.indexOf(r);n!==-1&&(t.courtStart=n,t.courtEnd=n+r.length)}if(t.year){let n=String(t.year),r=e.lastIndexOf(n);r!==-1&&(t.yearStart=r,t.yearEnd=r+n.length)}return/\ben banc\b/i.test(e)?t.disposition=`en banc`:/\bper curiam\b/i.test(e)&&(t.disposition=`per curiam`),t}function ke(e){let t=ge.exec(e);if(t){let n=t[1].toLowerCase();if(he(n))return{kind:`explanatory`,text:e,type:n}}let n=J(e);return n.year||n.date||n.disposition?{kind:`metadata`,...n}:{kind:`explanatory`,text:e,type:`other`}}function Y(e){let t=e;t=t.replace(/\bet\s+al\.?/gi,``),t=t.replace(/\s+d\/b\/a\b.*/gi,``),t=t.replace(/\s+aka\b.*/gi,``);let n=``;for(;n!==t;)n=t,t=t.replace(/,?\s*(Inc|LLC|Corp|Ltd|Co|LLP|LP|P\.C)\.?$/gi,``);return t=t.replace(/^(The|A|An)\s+/i,``),t=t.replace(/\s+/g,` `),t.trim().toLowerCase()}function Ae(e){let t;for(let t of[`In the Matter of`,`In re`,`Ex parte`,`Matter of`,`State ex rel.`,`United States ex rel.`,`Application of`,`Petition of`,`Estate of`]){let n=RegExp(`^(${t})\\s+(.+)$`,`i`).exec(e);if(n){let t=n[1],r=n[2];if(/\s+v\.?\s+/i.test(r)){let t=/^(.+?)\s+v\.?\s+(.+)$/i.exec(e);if(t){let e=t[1].trim(),n=t[2].trim();return{plaintiff:e,plaintiffNormalized:Y(e),defendant:n,defendantNormalized:Y(n)}}}else return{plaintiff:e,plaintiffNormalized:Y(r),proceduralPrefix:t}}}let n=/^(.+?)\s+v\.?\s+(.+)$/i.exec(e);if(n){let e=n[1].trim(),r=n[2].trim(),i=e.match(U)??e.match(/^(Also|In(?!\s+re\b))\s+/i);if(i){let n=i[1].toLowerCase().replace(/\.$/,``);H.has(n)&&(t=n),e=e.substring(i[0].length).trim()}return{plaintiff:e||n[1].trim(),plaintiffNormalized:Y(e||n[1].trim()),defendant:r,defendantNormalized:Y(r),signal:t}}return{}}function je(t,n,r){let{text:i,span:a}=t,c=oe.exec(i);if(!c)throw Error(`Failed to parse case citation: ${i}`);let l=ne(c[1]),u=c[2].trim(),d=c[3]?Number.parseInt(c[3],10):void 0,f=c[4]||void 0,p=c[5],m=se.test(p),h=m?void 0:Number.parseInt(p,10),g=m?!0:void 0,_=ce.exec(i),v=_?V(_[1])??void 0:void 0,y=v?.page,b={};if(c.indices){if(c.indices[1]&&(b.volume=o(a.cleanStart,c.indices[1],n)),c.indices[2]){let[e,t]=c.indices[2],r=i.substring(e,t),s=r.length-r.trimStart().length,l=r.length-r.trimEnd().length;b.reporter=o(a.cleanStart,[e+s,t-l],n)}c.indices[5]&&(b.page=o(a.cleanStart,c.indices[5],n))}_?.indices?.[1]&&(b.pincite=o(a.cleanStart,_.indices[1],n));let x,S,C,w,T,E,D,O,k=le.exec(i);if(k&&!d&&(D=k[1],O=J(D),x=O.year,S=O.court,C=O.date,w=O.disposition),r&&!D){let e=r.substring(a.cleanEnd),t=ue.exec(e);if(t&&(D=t[1],O=J(D),x=O.year,S=O.court,C=O.date,w=O.disposition),y===void 0){let t=de.exec(e);t&&(v||=V(t[1])??void 0,y=v?.page,t.indices?.[1]&&(b.pincite=o(a.cleanEnd,t.indices[1],n)))}}let A,j,M;if(r){M=Oe(r,a.cleanEnd),j=M.parens;let e=D?j.slice(1):j;for(let t of e){let e=ke(t.text);if(e.kind===`metadata`)e.court&&(!S||S===w)&&(S=e.court),e.year&&!x&&(x=e.year,C=e.date),e.disposition&&!w&&(w=e.disposition);else{A??=[];let r=s({cleanStart:t.start,cleanEnd:t.end},n);A.push({text:e.text,type:e.type,span:{cleanStart:t.start,cleanEnd:t.end,originalStart:r.originalStart,originalEnd:r.originalEnd}})}}}if(j&&j.length>0&&(S||x)){let e=D?j[0]:void 0;if(e){let t=s({cleanStart:e.start,cleanEnd:e.end},n);if(b.metadataParenthetical={cleanStart:e.start,cleanEnd:e.end,originalStart:t.originalStart,originalEnd:t.originalEnd},O){let t=e.start+1;if(O.courtStart!==void 0){let e=t+O.courtStart,r=t+O.courtEnd,i=s({cleanStart:e,cleanEnd:r},n);b.court={cleanStart:e,cleanEnd:r,originalStart:i.originalStart,originalEnd:i.originalEnd}}if(O.yearStart!==void 0){let e=t+O.yearStart,r=t+O.yearEnd,i=s({cleanStart:e,cleanEnd:r},n);b.year={cleanStart:e,cleanEnd:r,originalStart:i.originalStart,originalEnd:i.originalEnd}}}}}let N;if(r&&M&&M.signals.length>0)for(let e=0;e<M.signals.length;e++){let{signal:t}=M.signals[e];N??=[];let{originalStart:r,originalEnd:i}=s({cleanStart:t.start,cleanEnd:t.end},n);N.push({signal:t.normalized,rawSignal:t.text,signalSpan:{cleanStart:t.start,cleanEnd:t.end,originalStart:r,originalEnd:i},order:e})}let P=ee(u);!S&&P?.level===`supreme`&&P?.jurisdiction===`federal`&&(S=`scotus`);let F;if(r&&(F=De(r,a.cleanStart),F)){T=F.caseName;let e=j&&j.length>0?j[j.length-1].end:a.cleanEnd,t=F.nameStart,r=e;E={cleanStart:t,cleanEnd:r,originalStart:n.cleanToOriginal.get(t)??t,originalEnd:n.cleanToOriginal.get(r)??r};let i=F.nameStart,o=i+T.length,c=s({cleanStart:i,cleanEnd:o},n);b.caseName={cleanStart:i,cleanEnd:o,originalStart:c.originalStart,originalEnd:c.originalEnd}}let I,L,R,z,B,H;if(T){let e=Ae(T);if(I=e.plaintiff,L=e.plaintiffNormalized,R=e.defendant,z=e.defendantNormalized,B=e.proceduralPrefix,H=e.signal,I&&R){let e=`${I} v. ${R}`;if(e!==T&&E&&r){T=e;let t=r.substring(E.cleanStart,a.cleanStart),i=/\s+v\.?\s+/i.exec(t);if(i){let e=t.substring(0,i.index).lastIndexOf(I);if(e!==-1){let t=E.cleanStart+e,r=n.cleanToOriginal.get(t)??t;E={...E,cleanStart:t,originalStart:r}}}if(F){let e=E.cleanStart,t=e+T.length,r=s({cleanStart:e,cleanEnd:t},n);b.caseName={cleanStart:e,cleanEnd:t,originalStart:r.originalStart,originalEnd:r.originalEnd}}}}if(I&&F&&r){let e=E?.cleanStart??F.nameStart,t=r.substring(e,a.cleanStart),i=/\s+v\.?\s+/i.exec(t);if(i){let r=t.substring(0,i.index).lastIndexOf(I);if(r!==-1){let t=e+r,i=t+I.length,a=s({cleanStart:t,cleanEnd:i},n);b.plaintiff={cleanStart:t,cleanEnd:i,originalStart:a.originalStart,originalEnd:a.originalEnd}}if(R){let r=i.index+i[0].length,a=t.substring(r).indexOf(R);if(a!==-1){let t=e+r+a,i=t+R.length,o=s({cleanStart:t,cleanEnd:i},n);b.defendant={cleanStart:t,cleanEnd:i,originalStart:o.originalStart,originalEnd:o.originalEnd}}}}else{let r=t.indexOf(I);if(r!==-1){let t=e+r,i=t+I.length,a=s({cleanStart:t,cleanEnd:i},n);b.plaintiff={cleanStart:t,cleanEnd:i,originalStart:a.originalStart,originalEnd:a.originalEnd}}}}if(H&&E&&r&&F){let e=r.substring(F.nameStart,a.cleanStart),t=U.exec(e);if(t){let e=F.nameStart,r=e+t[1].length,i=s({cleanStart:e,cleanEnd:r},n);b.signal={cleanStart:e,cleanEnd:r,originalStart:i.originalStart,originalEnd:i.originalEnd}}}}let{originalStart:re,originalEnd:W}=s(a,n),G=.2,K=e.s()?.byAbbreviation.get(u.toLowerCase());return(K&&K.length>0||ae.has(u))&&(G+=.3),x!==void 0&&x<=ie&&(G+=.2),T&&(G+=.15),S&&(G+=.1),G=Math.round(Math.min(G,1)*100)/100,g&&(G=Math.max(G,.5)),{type:`case`,text:i,span:{cleanStart:a.cleanStart,cleanEnd:a.cleanEnd,originalStart:re,originalEnd:W},confidence:G,matchedText:i,processTimeMs:0,patternsChecked:1,volume:l,reporter:u,page:h,nominativeVolume:d,nominativeReporter:f,pincite:y,pinciteInfo:v,court:S,normalizedCourt:te(S),year:x,hasBlankPage:g,date:C,fullSpan:E,caseName:T,disposition:w,parentheticals:A,subsequentHistoryEntries:N,plaintiff:I,plaintiffNormalized:L,defendant:R,defendantNormalized:z,proceduralPrefix:B,inferredCourt:P,signal:H,spans:b}}const X=`${String.raw`(?:art(?:icle)?\.?|amend(?:ment)?\.?|amdt\.?)\s+([IVX]+|\d+)`}${String.raw`(?:[,;]\s*§\s*([\w-]+))?`}${String.raw`(?:[,;]\s*cl\.?\s*(\d+))?`}`,Me=new RegExp(X,`id`),Ne=[{id:`us-constitution`,regex:new RegExp(String.raw`\b(?:United\s+States\s+Constitution|U\.?\s*S\.?\s+Const\.?),?\s+${X}`,`gi`),description:`U.S. Constitution citations (e.g., "U.S. Const. art. III, § 2", "U.S. Const. amend. XIV")`,type:`constitutional`},{id:`state-constitution`,regex:new RegExp(String.raw`\b(?:Ala|Alaska|Ariz|Ark|Cal(?:if)?|Colo|Conn|Del|Fla|Ga|Haw|Idaho|Ill|Ind|Iowa|Kan|Ky|La|Me|Md|Mass|Mich|Minn|Miss|Mo|Mont|Neb|Nev|N\.?\s*H|N\.?\s*J|N\.?\s*M|N\.?\s*Y|N\.?\s*C|N\.?\s*D|Ohio|Okla|Or(?:e)?|Pa|R\.?\s*I|S\.?\s*C|S\.?\s*D|Tenn|Tex|Utah|Vt|W\.?\s*Va|Va|Wash|Wis|Wyo)\.?\s+Const\.?,?\s+${X}`,`gi`),description:`State constitution citations (e.g., "Cal. Const. art. I, § 7", "N.Y. Const. art. VI, § 20")`,type:`constitutional`},{id:`bare-constitution`,regex:new RegExp(String.raw`(?<!\.\s)(?<![A-Z]\s)\bConst\.?,?\s+${X}`,`g`),description:`Bare constitutional citations without jurisdiction prefix (e.g., "Const. art. I, § 8, cl. 3")`,type:`constitutional`},{id:`bare-article`,regex:new RegExp(String.raw`(?<!Const\.?,?\s)\bArt\.?\s+[IVX]+[,;]\s*§\s*[\w-]+(?:[,;]\s*cl\.?\s*\d+)?`,`g`),description:`Bare article references without "Const." prefix (e.g., "Art. I, §8, cl. 3")`,type:`constitutional`}],Pe={I:1,II:2,III:3,IV:4,V:5,VI:6,VII:7,VIII:8,IX:9,X:10,XI:11,XII:12,XIII:13,XIV:14,XV:15,XVI:16,XVII:17,XVIII:18,XIX:19,XX:20,XXI:21,XXII:22,XXIII:23,XXIV:24,XXV:25,XXVI:26,XXVII:27};function Fe(e){let t=e.toUpperCase();if(t in Pe)return Pe[t];let n=Number.parseInt(e,10);return Number.isNaN(n)?void 0:n}const Ie={ala:`AL`,alaska:`AK`,ariz:`AZ`,ark:`AR`,cal:`CA`,calif:`CA`,colo:`CO`,conn:`CT`,del:`DE`,fla:`FL`,ga:`GA`,haw:`HI`,idaho:`ID`,ill:`IL`,ind:`IN`,iowa:`IA`,kan:`KS`,ky:`KY`,la:`LA`,me:`ME`,md:`MD`,mass:`MA`,mich:`MI`,minn:`MN`,miss:`MS`,mo:`MO`,mont:`MT`,neb:`NE`,nev:`NV`,"n.h":`NH`,"n.j":`NJ`,"n.m":`NM`,"n.y":`NY`,"n.c":`NC`,"n.d":`ND`,ohio:`OH`,okla:`OK`,or:`OR`,ore:`OR`,pa:`PA`,"r.i":`RI`,"s.c":`SC`,"s.d":`SD`,tenn:`TN`,tex:`TX`,utah:`UT`,vt:`VT`,va:`VA`,wash:`WA`,"w.va":`WV`,wis:`WI`,wyo:`WY`},Le=/amend|amdt/i,Re=/^([A-Za-z]+(?:\.\s*[A-Za-z]+)?(?:\.\s*[A-Za-z]+)?)\.?\s+Const/i;function ze(e){let t=Re.exec(e);if(!t)return;let n=t[1].replace(/\s+/g,``).replace(/\.$/g,``).toLowerCase();if(n in Ie)return Ie[n]}function Be(e,t){let{text:n,span:r}=e,i=Me.exec(n),a,c,l,u;if(i){let e=Fe(i[1]);Le.test(i[0])?c=e:a=e,l=i[2]||void 0,u=i[3]?Number.parseInt(i[3],10):void 0}let d;switch(e.patternId){case`us-constitution`:d=`US`;break;case`state-constitution`:d=ze(n);break;default:d=void 0;break}let{originalStart:f,originalEnd:p}=s(r,t),m;m=e.patternId===`bare-article`?.5:e.patternId===`bare-constitution`?.7:l?.95:.9;let h=n.endsWith(`.`)?n.slice(0,-1):n,g={};if(d===`US`){let e=n.indexOf(`U.S.`);e!==-1&&(g.jurisdiction=o(r.cleanStart,[e,e+4],t))}else if(d&&e.patternId===`state-constitution`){let e=Re.exec(n);if(e){let n=e[1].length+1;g.jurisdiction=o(r.cleanStart,[0,n],t)}}return i?.indices&&(Le.test(i[0])?i.indices[1]&&(g.amendment=o(r.cleanStart,i.indices[1],t)):i.indices[1]&&(g.article=o(r.cleanStart,i.indices[1],t)),i.indices[2]&&(g.section=o(r.cleanStart,i.indices[2],t)),i.indices[3]&&(g.clause=o(r.cleanStart,i.indices[3],t))),{type:`constitutional`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:f,originalEnd:p},confidence:m,matchedText:h,processTimeMs:0,patternsChecked:1,jurisdiction:d,article:a,amendment:c,section:l,clause:u,spans:g}}function Ve(e,t){let{text:n,span:r}=e,i=/^(\d+(?:-\d+)?)\s+Fed\.\s?Reg\.\s+(\d+)/d.exec(n);if(!i)throw Error(`Failed to parse Federal Register citation: ${n}`);let a=i[1],c=/^\d+$/.test(a)?Number.parseInt(a,10):a,l=Number.parseInt(i[2],10),u;i.indices&&(u={volume:o(r.cleanStart,i.indices[1],t),page:o(r.cleanStart,i.indices[2],t)});let d=/\((?:.*?\s)?(\d{4})\)/.exec(n),f=d?Number.parseInt(d[1],10):void 0,{originalStart:p,originalEnd:m}=s(r,t);return{type:`federalRegister`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:.9,matchedText:n,processTimeMs:0,patternsChecked:1,volume:c,page:l,year:f,spans:u}}function He(e,t,n){let{text:r,span:i}=e,a=/^(\d+(?:-\d+)?)\s+([A-Za-z.\s]+?)\s+(\d+)/d.exec(r);if(!a)throw Error(`Failed to parse journal citation: ${r}`);let c=a[1],l=/^\d+$/.test(c)?Number.parseInt(c,10):c,u=a[2].trim(),d=Number.parseInt(a[3],10),f,p;n===void 0?(f=r.slice(a[0].length),p=i.cleanStart+a[0].length):(f=n.slice(i.cleanEnd,i.cleanEnd+30),p=i.cleanEnd);let m=n?n.slice(i.cleanStart,i.cleanEnd+30):r,h=/^,\s*(\d+)/d.exec(f),g=h?Number.parseInt(h[1],10):void 0,_=/\((?:.*?\s)?(\d{4})\)/d.exec(m),v=_?Number.parseInt(_[1],10):void 0,y;a.indices&&(y={volume:o(i.cleanStart,a.indices[1],t),journal:o(i.cleanStart,a.indices[2],t),page:o(i.cleanStart,a.indices[3],t)},h?.indices?.[1]&&(y.pincite=o(p,h.indices[1],t)),_?.indices?.[1]&&(y.year=o(i.cleanStart,_.indices[1],t)));let{originalStart:b,originalEnd:x}=s(i,t);return{type:`journal`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:b,originalEnd:x},confidence:.6,matchedText:r,processTimeMs:0,patternsChecked:1,volume:l,journal:u,abbreviation:u,page:d,pincite:g,year:v,spans:y}}const Ue=/^(?:\s+at\s+|,\s*(?:at\s+)?)(\*?\d+(?:[-–—]\*?\d+)?(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)/d;function We(e,t,n){let{text:r,span:i}=e,a=/^(\d{4})\s+(.+?)\s+(\d+)$/d.exec(r);if(!a)throw Error(`Failed to parse neutral citation: ${r}`);let c=Number.parseInt(a[1],10),l=a[2],u=a[3],d;a.indices&&(d={year:o(i.cleanStart,a.indices[1],t),court:o(i.cleanStart,a.indices[2],t),documentNumber:o(i.cleanStart,a.indices[3],t)});let f,p;if(n){let e=n.substring(i.cleanEnd),r=Ue.exec(e);r&&(p=V(r[1])??void 0,f=p?.page,r.indices?.[1]&&(d||={},d.pincite=o(i.cleanEnd,r.indices[1],t)))}let{originalStart:m,originalEnd:h}=s(i,t);return{type:`neutral`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:m,originalEnd:h},confidence:1,matchedText:r,processTimeMs:0,patternsChecked:1,year:c,court:l,documentNumber:u,pincite:f,pinciteInfo:p,spans:d}}function Ge(e,t){let{text:n,span:r}=e,i=/Pub\.\s?L\.(?:\s?No\.)?\s?(\d+)-(\d+)/d.exec(n);if(!i)throw Error(`Failed to parse public law citation: ${n}`);let a=Number.parseInt(i[1],10),c=Number.parseInt(i[2],10),l;i.indices&&(l={congress:o(r.cleanStart,i.indices[1],t),lawNumber:o(r.cleanStart,i.indices[2],t)});let{originalStart:u,originalEnd:d}=s(r,t);return{type:`publicLaw`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:u,originalEnd:d},confidence:.9,matchedText:n,processTimeMs:0,patternsChecked:1,congress:a,lawNumber:c,spans:l}}function Ke(e,t,n){let{text:r,span:i}=e,a=/([Ii])(?:d|bid)(\.)(,?)\s*(?:at\s+(\*?\d+(?:\s*[-–]\s*\*?\d+)?(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?))?/d.exec(r);if(!a)throw Error(`Failed to parse Id. citation: ${r}`);let c=a[1],l=a[3]===`,`,u=a[4]?V(a[4])??void 0:void 0,d=u?.page,f;a[4]&&a.indices?.[4]&&(f={pincite:o(i.cleanStart,a.indices[4],t)});let p=1;if(c===`i`&&(p=.85),l&&(p=Math.min(p,.9)),n&&i.cleanStart>0){let e=n.slice(Math.max(0,i.cleanStart-20),i.cleanStart).trimEnd();e.length>0&&(e[e.length-1],/[.;)\]—:]$/.test(e)||(p=Math.min(p,.4)))}let{originalStart:m,originalEnd:h}=s(i,t);return{type:`id`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:m,originalEnd:h},confidence:p,matchedText:r,processTimeMs:0,patternsChecked:1,pincite:d,pinciteInfo:u,spans:f}}function qe(e,t){let{text:n,span:r}=e,i=/\b([A-Z][a-zA-Z''\-]+\.?(?:(?:\s+v\.?\s+|\s+)[A-Z][a-zA-Z''\-]+\.?)*)\s*,?\s+supra(?:\s+note\s+(\d+))?(?:,?\s+at\s+(\*?\d+(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?))?/d.exec(n),a=i||/supra(?:\s+note\s+(\d+)(?:,?\s+at\s+(\*?\d+(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?))?|\s+at\s+(\*?\d+(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?))?/d.exec(n);if(!a)throw Error(`Failed to parse supra citation: ${n}`);let c,l,u,d;if(i)c=i[1],l=i[3]?V(i[3])??void 0:void 0,u=.9,i[3]&&(d=3);else{c=void 0;let e=a[2],t=a[3],n=e??t;l=n?V(n)??void 0:void 0,u=.8,e?d=2:t&&(d=3)}let f=l?.page,p;d!==void 0&&a.indices?.[d]&&(p={pincite:o(r.cleanStart,a.indices[d],t)});let{originalStart:m,originalEnd:h}=s(r,t);return{type:`supra`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:m,originalEnd:h},confidence:u,matchedText:n,processTimeMs:0,patternsChecked:1,partyName:c,pincite:f,pinciteInfo:l,spans:p}}function Je(e,t){let{text:n,span:r}=e,i=/(\d+(?:-\d+)?)\s+([A-Z][A-Za-z.''\s]+?(?:\d[a-z]{1,2})?)\s*,?\s+at\s+(\*?\d+(?:[-–—]\*?\d+)?(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)/d.exec(n);if(!i)throw Error(`Failed to parse short-form case citation: ${n}`);let a=i[1],c=/^\d+$/.test(a)?Number.parseInt(a,10):a,l=i[2].trim(),u=V(i[3])??void 0,d=u?.page,f;i.indices?.[3]&&(f={pincite:o(r.cleanStart,i.indices[3],t)});let{originalStart:p,originalEnd:m}=s(r,t),h=.4;return ae.has(l)&&(h+=.3),{type:`shortFormCase`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:h,matchedText:n,processTimeMs:0,patternsChecked:1,volume:c,reporter:l,pincite:d,pinciteInfo:u,spans:f}}const Ye=/^([^(]+?)\s*((?:\([^)]*\))*)$/,Xe=/\s*et\s+seq\.?\s*$/i;function Z(e){let t=e.replace(Xe,``),n=t!==e,r=t.trim(),i=Ye.exec(r),a=i?.[2];return i!==null&&a?{section:i[1].trim(),subsection:a,hasEtSeq:n}:{section:r,hasEtSeq:n}}const Ze=/^(?:(\d+)\s+)?(.+?)\s*§?\s*(\d+[A-Za-z0-9.:/-]*(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)$/d;function Qe(t,n){let{text:r,span:i}=t,a=Ze.exec(r),c,l,u;a?(c=a[1]?Number.parseInt(a[1],10):void 0,l=a[2].trim(),u=a[3]):(l=r,u=``);let d=e.n(l),f=d?.jurisdiction,p=l,{section:m,subsection:h,hasEtSeq:g}=Z(u),{originalStart:_,originalEnd:v}=s(i,n),y;if(a?.indices&&(y={},a.indices[1]&&(y.title=o(i.cleanStart,a.indices[1],n)),a.indices[2]&&(y.code=o(i.cleanStart,a.indices[2],n)),a.indices[3]&&m)){let e=a.indices[3][0],t=m.replace(/[.,;:]\s*$/,``).length;if(y.section=o(i.cleanStart,[e,e+t],n),h){let t=e+m.length;y.subsection=o(i.cleanStart,[t,t+h.length],n)}}let b=r.includes(`§`),x;return x=d&&b?.95:d?.85:b?.6:.4,c!==void 0&&(x+=.05),h&&(x+=.05),x=Math.min(x,1),{type:`statute`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:_,originalEnd:v},confidence:x,matchedText:r,processTimeMs:0,patternsChecked:1,title:c,code:p,section:m,subsection:h,pincite:h,jurisdiction:f,hasEtSeq:g||void 0,spans:y}}const $e=/^(\d+)\s+(?:ILCS|Ill\.?\s*Comp\.?\s*Stat\.?)\s*(?:Ann\.?\s+)?(\d+)\/(.+)$/d;function et(e,t){let{text:n,span:r}=e,i=$e.exec(n),a,c,l;i?(a=Number.parseInt(i[1],10),c=i[2],l=i[3]):(c=n,l=``);let{section:u,subsection:d,hasEtSeq:f}=Z(l),{originalStart:p,originalEnd:m}=s(r,t),h=u.replace(/[.,;:]\s*$/,``).length,g;if(i?.indices&&(g={},i.indices[1]&&(g.title=o(r.cleanStart,i.indices[1],t)),i.indices[2]&&(g.code=o(r.cleanStart,i.indices[2],t)),i.indices[3]&&u)){let e=i.indices[3][0];if(g.section=o(r.cleanStart,[e,e+h],t),d){let n=e+u.length;g.subsection=o(r.cleanStart,[n,n+d.length],t)}}let _=i?.95:.3;return d&&(_+=.05),_=Math.min(_,1),{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:_,matchedText:n,processTimeMs:0,patternsChecked:1,title:a,code:c,section:u,subsection:d,pincite:d,jurisdiction:i?`IL`:void 0,hasEtSeq:f||void 0,spans:g}}const tt=/^(\d+)\s+(\S+(?:\.\S+)*)\s*§§?\s*(.+)$/d,nt=/^(\d+)\s+(\S+(?:\.\S+)*)\s+(?:Part|pt\.)\s+(.+)$/d;function rt(e,t){let{text:n,span:r}=e,i=tt.exec(n)??nt.exec(n),a,c,l;i?(a=Number.parseInt(i[1],10),c=i[2],l=i[3]):(c=e.patternId===`cfr`?`C.F.R.`:`U.S.C.`,l=n,a=void 0);let{section:u,subsection:d,hasEtSeq:f}=Z(l),{originalStart:p,originalEnd:m}=s(r,t),h;if(i?.indices&&(h={},i.indices[1]&&(h.title=o(r.cleanStart,i.indices[1],t)),i.indices[2]&&(h.code=o(r.cleanStart,i.indices[2],t)),i.indices[3]&&u)){let e=i.indices[3][0],n=u.replace(/[.,;:]\s*$/,``).length;if(h.section=o(r.cleanStart,[e,e+n],t),d){let n=e+u.length;h.subsection=o(r.cleanStart,[n,n+d.length],t)}}let g=.95;return a!==void 0&&(g+=.05),d&&(g+=.05),g=Math.min(g,1),{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:g,matchedText:n,processTimeMs:0,patternsChecked:1,title:a,code:c,section:u,subsection:d,pincite:d,jurisdiction:`US`,hasEtSeq:f||void 0,spans:h}}const it=/^(N\.?\s*Y\.?|Cal(?:ifornia)?\.?|Tex(?:as)?\.?|Md\.?|Va\.?|Ala(?:bama)?\.?)\s+(.*?)\s*§§?\s*(.+)$/ds,at=/^(.*?)\s+(?:ch\.?|c\.?)\s*(\w+),?\s*§\s*(.+)$/d,ot={"n.y.":`NY`,"n.y":`NY`,ny:`NY`,"cal.":`CA`,cal:`CA`,"california.":`CA`,california:`CA`,"tex.":`TX`,tex:`TX`,"texas.":`TX`,texas:`TX`,"md.":`MD`,md:`MD`,"va.":`VA`,va:`VA`,"ala.":`AL`,ala:`AL`,"alabama.":`AL`,alabama:`AL`};function st(e){return ot[e.toLowerCase().replace(/\s+/g,``)]}function ct(e){return e.replace(/^\s*Code\s+Ann\.\s*,\s*/i,``).replace(/^\s*Code\s*,\s*/i,``).replace(/\s+Code\s*$/i,``).replace(/\s+Ann\.?\s*$/i,``).replace(/,\s*$/,``).trim()}function lt(t,n){let{text:r,span:i}=t,a,c,l,u=null,d=null;if(t.patternId===`mass-chapter`)u=at.exec(r),u?(a=`MA`,c=u[2],l=u[3]):(c=r,l=``);else if(d=it.exec(r),d){a=st(d[1]);let t=d[2],n=ct(t);c=a&&e.r(a,n)?n:t.trim(),l=d[3]}else c=r,l=``;let{section:f,subsection:p,hasEtSeq:m}=Z(l),{originalStart:h,originalEnd:g}=s(i,n),_=f.replace(/[.,;:]\s*$/,``).length,v;if(u?.indices){if(v={},u.indices[2]&&(v.code=o(i.cleanStart,u.indices[2],n)),u.indices[3]&&f){let e=u.indices[3][0];if(v.section=o(i.cleanStart,[e,e+_],n),p){let t=e+f.length;v.subsection=o(i.cleanStart,[t,t+p.length],n)}}}else if(d?.indices&&(v={},d.indices[2]&&(v.code=o(i.cleanStart,d.indices[2],n)),d.indices[3]&&f)){let e=d.indices[3][0];if(v.section=o(i.cleanStart,[e,e+_],n),p){let t=e+f.length;v.subsection=o(i.cleanStart,[t,t+p.length],n)}}let y=a?.95:.5;return p&&(y+=.05),y=Math.min(y,1),{type:`statute`,text:r,span:{cleanStart:i.cleanStart,cleanEnd:i.cleanEnd,originalStart:h,originalEnd:g},confidence:y,matchedText:r,processTimeMs:0,patternsChecked:1,code:c,section:f,subsection:p,pincite:p,jurisdiction:a,hasEtSeq:m||void 0,spans:v}}const ut=/[Ss]ection\s+(\d+[A-Za-z0-9-]*)((?:\([^)]*\))*)\s+of\s+title\s+(\d+)/d;function dt(e,t){let{text:n,span:r}=e,i=ut.exec(n),a,c,l;i?(a=i[1],c=i[2]||void 0,l=Number.parseInt(i[3],10)):a=n;let{originalStart:u,originalEnd:d}=s(r,t),f;i?.indices&&(f={},i.indices[1]&&(f.section=o(r.cleanStart,i.indices[1],t)),i.indices[3]&&(f.title=o(r.cleanStart,i.indices[3],t)),i.indices[2]&&c&&(f.subsection=o(r.cleanStart,i.indices[2],t)));let p=.85;return l!==void 0&&(p+=.05),c&&(p+=.05),p=Math.min(p,1),{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:u,originalEnd:d},confidence:p,matchedText:n,processTimeMs:0,patternsChecked:1,title:l,code:`U.S.C.`,section:a,subsection:c,pincite:c,jurisdiction:`US`,spans:f}}function ft(e,t){let{text:n,span:r}=e,i=/^(?:(\d+)\s+)?([A-Za-z.\s]+?)\s*§+\s*(\d+[A-Za-z0-9-]*)/.exec(n);if(!i){let{originalStart:e,originalEnd:i}=s(r,t);return{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:e,originalEnd:i},confidence:.3,matchedText:n,processTimeMs:0,patternsChecked:1,code:n,section:``}}let a=i[1]?Number.parseInt(i[1],10):void 0,o=i[2].trim(),c=i[3],{originalStart:l,originalEnd:u}=s(r,t),d=.5;return[`U.S.C.`,`C.F.R.`,`Cal. Civ. Code`,`Cal. Penal Code`,`N.Y. Civ. Prac. L. & R.`,`Tex. Civ. Prac. & Rem. Code`].some(e=>o.includes(e))&&(d+=.3),d=Math.min(d,1),{type:`statute`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:l,originalEnd:u},confidence:d,matchedText:n,processTimeMs:0,patternsChecked:1,title:a,code:o,section:c}}function pt(e,t){switch(e.patternId){case`usc`:case`cfr`:return rt(e,t);case`prose`:return dt(e,t);case`abbreviated-code`:return Qe(e,t);case`named-code`:case`mass-chapter`:return lt(e,t);case`chapter-act`:return et(e,t);default:return ft(e,t)}}function mt(e,t){let{text:n,span:r}=e,i=/^(\d+(?:-\d+)?)\s+Stat\.\s+(\d+)/d.exec(n);if(!i)throw Error(`Failed to parse Statutes at Large citation: ${n}`);let a=i[1],c=/^\d+$/.test(a)?Number.parseInt(a,10):a,l=Number.parseInt(i[2],10),u;i.indices&&(u={volume:o(r.cleanStart,i.indices[1],t),page:o(r.cleanStart,i.indices[2],t)});let d=/\((?:.*?\s)?(\d{4})\)/.exec(n),f=d?Number.parseInt(d[1],10):void 0,{originalStart:p,originalEnd:m}=s(r,t);return{type:`statutesAtLarge`,text:n,span:{cleanStart:r.cleanStart,cleanEnd:r.cleanEnd,originalStart:p,originalEnd:m},confidence:.9,matchedText:n,processTimeMs:0,patternsChecked:1,volume:c,page:l,year:f,spans:u}}const ht=[{id:`federal-reporter`,regex:/\b(\d+(?:-\d+)?)\s+(F\.|F\.2d|F\.3d|F\.4th|F\.\s?Supp\.|F\.\s?Supp\.\s?2d|F\.\s?Supp\.\s?3d|F\.\s?Supp\.\s?4th|F\.\s?App'x)\s+(\d+|_{3,}|-{3,})(?=\s|$|\(|,|;|\.)/g,description:`Federal Reporter (F., F.2d, F.3d, F.4th, F.Supp., F.App'x, etc.)`,type:`case`},{id:`supreme-court`,regex:/\b(\d+(?:-\d+)?)\s+(U\.\s?S\.|S\.\s?Ct\.|L\.\s?Ed\.(?:\s?2d)?)\s+(?:\(\d+\s+[A-Z][A-Za-z.]+\)\s+)?(\d+|_{3,}|-{3,})(?=\s|$|\(|,|;|\.)/g,description:`U.S. Supreme Court reporters (with optional nominative reporter parenthetical)`,type:`case`},{id:`state-reporter`,regex:/\b(\d+(?:-\d+)?)\s+([A-Z](?:(?! L\.[JQR\s])(?!\s+vs?\.\s)[A-Za-z.\d\s])+?)\s+(\d+|_{3,}|-{3,})(?=\s|$|\(|,|;|\.)/g,description:`State reporters (broad pattern allowing multi-word reporters, excludes journal patterns with " L.J/Q/Rev" and phantom matches across a case-name separator " v. "/" vs. ", validated against reporters-db in Phase 3)`,type:`case`}],gt=[{id:`law-review`,regex:/\b(\d+(?:-\d+)?)\s+([A-Z](?:(?!\s+vs?\.\s)(?!\s+at\s+\d)[A-Za-z.\s])+)\s+(\d+)\b/g,description:`Law review citations (e.g., "120 Harv. L. Rev. 500"), validated against journals-db in Phase 3. Negative lookaheads exclude " v. "/" vs. " (so a party-name run isn't mis-captured as a journal) and " at <digit>" (so a short-form pincite like "554 U.S. at 621" isn't mis-captured as a journal).`,type:`journal`}],_t=[{id:`state-vendor-neutral`,regex:/\b(\d{4})\s+([A-Z]{2}(?:\s+App\.?)?)\s+(\d+)\b/g,description:`State vendor-neutral citations (e.g., "2007 UT 49", "2017 WI 17", "2013 IL 112116")`,type:`neutral`},{id:`westlaw`,regex:/\b(\d{4})\s+WL\s+(\d+)\b/g,description:`WestLaw citations (e.g., "2021 WL 123456")`,type:`neutral`},{id:`lexis`,regex:/\b(\d{4})\s+U\.S\.(?:\s+(?:App|Dist)\.)?\s+LEXIS\s+(\d+)\b/g,description:`LexisNexis citations (e.g., "2021 U.S. LEXIS 5000", "2021 U.S. App. LEXIS 12345", "2021 U.S. Dist. LEXIS 67890")`,type:`neutral`},{id:`public-law`,regex:/\bPub\.\s?L\.(?:\s?No\.)?\s?(\d+-\d+)\b/g,description:`Public Law citations (e.g., "Pub. L. No. 117-58" or "Pub. L. 116-283")`,type:`publicLaw`},{id:`federal-register`,regex:/\b(\d+(?:-\d+)?)\s+Fed\.\s?Reg\.\s+(\d+)\b/g,description:`Federal Register citations (e.g., "86 Fed. Reg. 12345")`,type:`federalRegister`},{id:`statutes-at-large`,regex:/\b(\d+(?:-\d+)?)\s+Stat\.\s+(\d+)\b/g,description:`Statutes at Large citations (e.g., "124 Stat. 119")`,type:`statutesAtLarge`},{id:`compact-law-review`,regex:/\b(\d+(?:-\d+)?)\s+([A-Z][A-Za-z.]+L\.(?:Rev|J|Q)\.)\s+(\d+)\b/g,description:`Compact law review citations without spaces (e.g., "93 Harv.L.Rev. 752")`,type:`journal`}],vt=[{id:`id`,regex:/(?:^|(?<=\s)|(?<=["'(\[—]))\b[Ii]d\.(?:,?\s+at\s+(\*?\d+(?:\s*[-–]\s*\*?\d+)?)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)?/g,description:`Id. citations (e.g., "Id." or "Id. at 253")`,type:`case`},{id:`ibid`,regex:/(?:^|(?<=\s)|(?<=["'(\[—]))\b[Ii]bid\.(?:,?\s+at\s+(\*?\d+(?:\s*[-–]\s*\*?\d+)?)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)?/g,description:`Ibid. citations (e.g., "Ibid." or "Ibid. at 125")`,type:`case`},{id:`supra`,regex:/\b([A-Z][a-zA-Z''\-]+\.?(?:(?:\s+v\.?\s+|\s+)[A-Z][a-zA-Z''\-]+\.?)*)\s*,?\s+supra(?:\s+note\s+(\d+))?(?:,?\s+at\s+(\*?\d+)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)?/g,description:`Supra citations (e.g., "Smith, supra" or "Smith, supra, at 460")`,type:`case`},{id:`supra`,regex:/(?:^|(?<=\s)|(?<=[;.]))supra(?:\s+note\s+(\d+)(?:,?\s+at\s+(\*?\d+)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?)?|\s+at\s+(\*?\d+)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?|\s+(?:§+|Part|p\.)\s*\S+)/g,description:`Standalone supra (e.g., "supra note 12" or "supra at 15")`,type:`case`},{id:`shortFormCase`,regex:/\b(\d+(?:-\d+)?)\s+([A-Z][A-Za-z.''\s]+?(?:\d[a-z]{1,2})?)\s*,?\s+at\s+(\*?\d+(?:[-–—]\*?\d+)?)(?:\s+(?:nn?|note)\s*\.?\s*\d+(?:[-–—]\d+)?)?\b/g,description:`Short-form case citations (e.g., "500 F.2d at 125")`,type:`case`}],yt=[{id:`usc`,regex:/\b(\d+)\s+(?:U\.S\.C\.?|USC)\s*§§?\s*(\d+[A-Za-z0-9-]*(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`U.S. Code citations with optional subsections and et seq. (e.g., "42 U.S.C. § 1983(a)(1) et seq.")`,type:`statute`},{id:`cfr`,regex:/\b(\d+)\s+C\.?F\.?R\.?\s*(?:(?:Part|pt\.)\s+|§§?\s*)(\d+(?:\.\d+)?[A-Za-z0-9-]*(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`Code of Federal Regulations with Part or §, subsections, et seq. (e.g., "12 C.F.R. Part 226", "40 C.F.R. § 122.26(b)(14)")`,type:`statute`},{id:`prose`,regex:/\b[Ss]ection\s+(\d+[A-Za-z0-9-]*(?:\([^)]*\))*)\s+of\s+title\s+(\d+)\b/g,description:`Prose-form federal citations (e.g., "section 1983 of title 42"). Note: MD-style "section X of the Y Article" deferred to PR 3.`,type:`statute`},{id:`named-code`,regex:/\b(N\.?\s*Y\.?|Cal(?:ifornia)?\.?|Tex(?:as)?\.?|Md\.?|(?<!W\.?\s?)Va\.?|Ala(?:bama)?\.?)\s+((?:[A-Za-z.&',\s]+?))\s*§§?\s*(\d+[A-Za-z0-9.:/-]*(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`Named-code state citations (NY, CA, TX, MD, VA, AL) with jurisdiction prefix + code name + §`,type:`statute`},{id:`mass-chapter`,regex:/\b(Mass\.?\s*Gen\.?\s*Laws|M\.?G\.?L\.?A?\.?|A\.?L\.?M\.?|G\.?\s*L\.?)\s+(?:ch\.?|c\.?)\s*(\w+),?\s*§\s*([\w./-]+(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`Massachusetts chapter-based citations (e.g., "Mass. Gen. Laws ch. 93A, § 2")`,type:`statute`},{id:`chapter-act`,regex:/\b(\d+)\s+(?:ILCS|Ill\.?\s*Comp\.?\s*Stat\.?)\s*(?:Ann\.?\s+)?(\d+)\/([^\s(]+(?:\([^)]*\))*(?:\s*et\s+seq\.?)?)/g,description:`Illinois Compiled Statutes chapter-act citations (e.g., "735 ILCS 5/2-1001")`,type:`statute`},{id:`abbreviated-code`,regex:e.a(),description:`Abbreviated state code citations for all US jurisdictions`,type:`statute`}];function bt(e,t=[...ht,...yt,...gt,..._t,...vt]){let n=[];for(let r of t)try{let t=e.matchAll(r.regex);for(let e of t)n.push({text:e[0],span:{cleanStart:e.index,cleanEnd:e.index+e[0].length},type:r.type,patternId:r.id})}catch(e){console.warn(`Pattern ${r.id} threw error, skipping:`,e instanceof Error?e.message:String(e))}return n.sort((e,t)=>e.span.cleanStart-t.span.cleanStart),n}var xt=class{root=null;nextOrder=0;distanceFn;constructor(e){this.distanceFn=e}insert(e){let t={key:e,insertionOrder:this.nextOrder++,children:new Map};if(this.root===null){this.root=t;return}let n=this.root;for(;;){let r=this.distanceFn(e,n.key);if(r===0)return;let i=n.children.get(r);if(i)n=i;else{n.children.set(r,t);return}}}query(e,t){if(this.root===null)return[];let n=[],r=[this.root],i;for(;i=r.pop();){let a=this.distanceFn(e,i.key);a<=t&&n.push({key:i.key,distance:a,insertionOrder:i.insertionOrder});let o=a-t,s=a+t;for(let[e,t]of i.children)e>=o&&e<=s&&r.push(t)}return n.sort((e,t)=>e.distance-t.distance||e.insertionOrder-t.insertionOrder),n}};function St(e,t,n=1/0){if(e.length===0)return Math.min(t.length,n+1);if(t.length===0)return Math.min(e.length,n+1);let r=e.length<=t.length?e:t,i=e.length<=t.length?t:e,a=r.length,o=Array.from({length:a+1},(e,t)=>t),s=Array(a+1);for(let e=1;e<=i.length;e++){s[0]=e;let t=e;for(let n=1;n<=a;n++)i[e-1]===r[n-1]?s[n]=o[n-1]:s[n]=1+Math.min(o[n],s[n-1],o[n-1]),s[n]<t&&(t=s[n]);if(t>n)return n+1;let c=o;o=s,s=c}return o[a]}function Ct(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i]<=t?n=i+1:r=i}return n}function wt(e,t,n=/\n\n+/g){let r=new Map,i=[0],a;for(;(a=n.exec(e))!==null;)i.push(a.index+a[0].length);i.push(e.length);for(let e=0;e<t.length;e++){let n=t[e].span.originalStart;r.set(e,Ct(i,n)-1)}return r}function Tt(e,t){let n=new Map;for(let r=0;r<e.length;r++){let i=e[r].span.cleanStart,a=0,o=0,s=t.length-1;for(;o<=s;){let e=o+s>>>1,n=t[e];if(i<n.start)s=e-1;else if(i>=n.end)o=e+1;else{a=n.footnoteNumber;break}}n.set(r,a)}return n}function Et(e,t,n,r,i=!1){if(r===`none`)return!0;let a=n.get(e),o=n.get(t);return!!(a===void 0||o===void 0||a===o||r===`footnote`&&i&&a===0)}var Dt=class{citations;text;options;context;partyNameTree;constructor(e,t,n={}){this.citations=e,this.text=t,this.options={scopeStrategy:n.scopeStrategy??`none`,autoDetectParagraphs:n.autoDetectParagraphs??!0,paragraphBoundaryPattern:n.paragraphBoundaryPattern??/\n\n+/g,fuzzyPartyMatching:n.fuzzyPartyMatching??!0,partyMatchThreshold:n.partyMatchThreshold??.8,reportUnresolved:n.reportUnresolved??!0,footnoteMap:n.footnoteMap},this.partyNameTree=new xt(St),this.context={citationIndex:0,allCitations:e,lastResolvedIndex:void 0,fullCitationHistory:new Map,paragraphMap:new Map},this.options.autoDetectParagraphs&&(this.context.paragraphMap=wt(t,e,this.options.paragraphBoundaryPattern)),this.options.scopeStrategy===`footnote`&&this.options.footnoteMap&&(this.context.paragraphMap=Tt(e,this.options.footnoteMap))}resolve(){let e=[];for(let n=0;n<this.citations.length;n++){this.context.citationIndex=n;let r=this.citations[n],i;switch(r.type){case`id`:i=this.resolveId(r);break;case`supra`:i=this.resolveSupra(r);break;case`shortFormCase`:i=this.resolveShortFormCase(r);break;default:t(r)&&(this.context.lastResolvedIndex=n,this.trackFullCitation(r,n));break}i?.resolvedTo!==void 0&&(this.context.lastResolvedIndex=i.resolvedTo),e.push({...r,resolution:i})}return e}resolveId(e){let t=this.context.citationIndex,n=this.context.lastResolvedIndex;return n===void 0?this.createFailureResult(`No preceding citation found`):this.isWithinScope(n,t)?{resolvedTo:n,confidence:1}:this.createFailureResult(`Antecedent citation outside scope boundary`)}resolveSupra(e){if(!e.partyName)return;let t=this.context.citationIndex,n=this.normalizePartyName(e.partyName),r=n.length,i=this.options.partyMatchThreshold,a=r===0?0:Math.ceil(r*(1-i)/i),o=this.partyNameTree.query(n,a);o.sort((e,t)=>e.insertionOrder-t.insertionOrder);let s;for(let e of o){let n=this.context.fullCitationHistory.get(e.key);if(n===void 0||!this.isWithinScope(n,t,!0))continue;let i=Math.max(r,e.key.length),a=i===0?1:1-e.distance/i;(!s||a>s.similarity)&&(s={index:n,similarity:a})}if(!s)return this.createFailureResult(`No full citation found in scope`);if(s.similarity<this.options.partyMatchThreshold)return this.createFailureResult(`Party name similarity ${s.similarity.toFixed(2)} below threshold ${this.options.partyMatchThreshold}`);let c=[];return s.similarity<1&&c.push(`Fuzzy match: similarity ${s.similarity.toFixed(2)}`),{resolvedTo:s.index,confidence:s.similarity,warnings:c.length>0?c:void 0}}resolveShortFormCase(e){let t=this.context.citationIndex;for(let n=t-1;n>=0;n--){let r=this.citations[n];if(r.type===`case`&&r.volume===e.volume&&this.normalizeReporter(r.reporter)===this.normalizeReporter(e.reporter))return this.isWithinScope(n,t,!0)?{resolvedTo:n,confidence:.95}:this.createFailureResult(`Matching citation outside scope boundary`)}return this.createFailureResult(`No matching full case citation found`)}trackFullCitation(e,t){if(e.type===`case`&&(e.defendantNormalized&&(this.context.fullCitationHistory.set(e.defendantNormalized,t),this.partyNameTree.insert(e.defendantNormalized)),e.plaintiffNormalized&&(this.context.fullCitationHistory.set(e.plaintiffNormalized,t),this.partyNameTree.insert(e.plaintiffNormalized)),!e.plaintiffNormalized&&!e.defendantNormalized)){let n=this.extractPartyName(e);if(n){let e=this.normalizePartyName(n);this.context.fullCitationHistory.set(e,t),this.partyNameTree.insert(e)}}}extractPartyName(e){let t=e.span.originalStart,n=Math.max(0,t-100),r=this.text.substring(n,t),i=r.match(/([A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*)\s+v\.?\s+[A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*,\s*$/);if(i)return this.stripSignalWords(i[1].trim());let a=r.match(/([A-Z][a-zA-Z]*(?:\s+[A-Z][a-zA-Z]*)*),\s*$/);if(a)return this.stripSignalWords(a[1].trim())}stripSignalWords(e){let t=e.replace(/^(?:In(?!\s+re\b)|See(?:\s+[Aa]lso)?|Compare|But(?:\s+[Ss]ee)?|Cf\.?|Also)\s+/i,``).trim();return t.length>0?t:e}normalizePartyName(e){return e.toLowerCase().replace(/\s+/g,` `).trim()}normalizeReporter(e){return e.toLowerCase().replace(/\s+/g,``).replace(/\./g,``)}isWithinScope(e,t,n=!1){return Et(e,t,this.context.paragraphMap,this.options.scopeStrategy,n)}createFailureResult(e){if(this.options.reportUnresolved)return{resolvedTo:void 0,failureReason:e,confidence:0}}};function Ot(e,t,n){return new Dt(e,t,n).resolve()}function kt(e,t=``){let n=new Map;if(e.length===0||t===``)return n;let r=new Set;for(let i=0;i<e.length;i++){let a=e[i];if(a.type!==`case`||r.has(i))continue;let o=[];for(let n=i+1;n<e.length;n++){let s=e[n];if(s.type!==`case`)break;let c=(n===i+1?a:e[n-1]).span.cleanEnd,l=s.span.cleanStart;if(l-c>20)break;let u=t.substring(c,l);if(!u.includes(`,`))break;let d=u.indexOf(`,`);if(u.length-d-1>5||t.substring(a.span.cleanEnd,s.span.cleanEnd).includes(`)`)||!At(t,s.span.cleanEnd))break;o.push(n),r.add(n)}o.length>0&&n.set(i,o)}return n}function At(e,t){let n=e.substring(t,t+200),r=n.indexOf(`(`);if(r===-1)return!1;let i=0;for(let e=r;e<n.length;e++)if(n[e]===`(`)i++;else if(n[e]===`)`&&(i--,i===0))return!0;return!1}const Q=jt();function jt(){return[{regex:/^see\s+generally\b/i,signal:`see generally`},{regex:/^see\s+also\b/i,signal:`see also`},{regex:/^but\s+see\b/i,signal:`but see`},{regex:/^but\s+cf\.?(?=\s|$)/i,signal:`but cf`},{regex:/^compare\b/i,signal:`compare`},{regex:/^accord\b/i,signal:`accord`},{regex:/^contra\b/i,signal:`contra`},{regex:/^see\b/i,signal:`see`},{regex:/^cf\.?(?=\s|$)/i,signal:`cf`}].map(({regex:e,signal:t})=>({regex:e,endRegex:RegExp(`${e.source.replace(/^\^/,`(?<![a-z])`)}\\s*$`,e.flags),signal:t}))}function Mt(e){let t=`fullSpan`in e?e.fullSpan:void 0;return t?t.cleanEnd:e.span.cleanEnd}function $(e){let t=`fullSpan`in e?e.fullSpan:void 0;return t?t.cleanStart:e.span.cleanStart}function Nt(e,t){e.signal=t}function Pt(e){let t=e.trimStart();for(let{regex:e,signal:n}of Q){let r=e.exec(t);if(r)return{signal:n,length:r[0].length}}}function Ft(e){let t=e.indexOf(`;`);if(t===-1||e.substring(0,t).trim()!==``)return{valid:!1};let n=e.substring(t+1).trim();if(n===``)return{valid:!0};let r=Pt(n);return r&&n.substring(r.length).trim()===``?{valid:!0,signal:r.signal}:{valid:!1}}function It(e,t){if(e.length<2)return;let n=[],r=[];for(let i=0;i<e.length-1;i++){let a=e[i],o=e[i+1];if(o.type===`case`&&o.subsequentHistoryOf){r.length>=2&&n.push(r),r=[];continue}if(a.type===`case`&&a.subsequentHistoryOf)continue;let s=Mt(a),c=$(o);if(c<=s){r.length>=2&&n.push(r),r=[];continue}let l=Ft(t.substring(s,c));l.valid?(r.length===0&&r.push(i),r.push(i+1),l.signal&&!o.signal&&Nt(o,l.signal)):(r.length>=2&&n.push(r),r=[])}r.length>=2&&n.push(r);for(let t=0;t<n.length;t++){let r=n[t];if(r.length<2)continue;let i=`sc-${t}`;for(let t=0;t<r.length;t++){let n=e[r[t]];n.stringCitationGroupId=i,n.stringCitationIndex=t,n.stringCitationGroupSize=r.length}}for(let r of n){if(r.length<2)continue;let n=e[r[0]];if(n.signal)continue;let i=Math.max(0,$(n)-60),a=t.substring(i,$(n)).trim();for(let{endRegex:e,signal:t}of Q)if(e.test(a)){Nt(n,t);break}}}function Lt(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(r.signal&&r.stringCitationGroupId)continue;let i=n>0?Mt(e[n-1]):0,a=r.span.cleanStart;if(a<=i)continue;let o=t.substring(i,a),s=[];for(let{signal:e}of Q){let t=e.replace(/\./g,`\\.`).replace(/\s+/g,`\\s+`),n=RegExp(`(?<![a-zA-Z])(${t})(?![a-zA-Z])`,`gi`),r;for(;(r=n.exec(o))!==null;)s.push({signal:e,start:r.index,end:r.index+r[0].length})}if(s.length===0)continue;s.sort((e,t)=>{let n=t.end-e.end;return n===0?t.end-t.start-(e.end-e.start):n});let c=s[0];for(let e of s)e.start<=c.start&&e.end>=c.end&&(c=e);Nt(r,c.signal)}}const Rt=1750,zt=.1,Bt=new Set([`i.c.j.`,`u.n.t.s.`,`i.l.m.`,`i.l.r.`,`p.c.i.j.`,`a.c.`,`w.l.r.`,`all e.r.`,`q.b.`,`k.b.`,`ch.`,`co. rep.`,`e.c.r.`,`e.h.r.r.`,`c.m.l.r.`,`edw.`]);function Vt(e){if(e.type===`case`||e.type===`shortFormCase`)return e.reporter;if(e.type===`journal`)return e.abbreviation}function Ht(e){switch(e.type){case`case`:return e.year;case`journal`:return e.year;case`federalRegister`:return e.year;case`statutesAtLarge`:return e.year;default:return}}const Ut=new Set([`court`,`rule`,`section`,`chapter`,`article`,`part`,`title`,`paragraph`,`clause`,`amendment`,`dismissed`,`granted`,`denied`,`filed`,`argued`]);function Wt(e){return!!(e.toLowerCase().split(/\s+/).some(e=>Ut.has(e))||!e.includes(`.`)&&e.length>12)}const Gt=new Set(`the.a.an.in.on.at.but.and.for.by.to.with.from.as.if.so.nor.yet.not.no.then.when.where.who.what.how.that.this.these.those.he.she.it.they.we.his.her.its.their.our.was.were.is.are.has.had.been.being.did.does.do.may.shall.will.would.could.should.held.said.found.made.took.gave.see.also.january.february.march.april.june.july.august.september.october.november.december`.split(`.`)),Kt=2e3,qt=/^\d{1,2}-\d{4,}$/;function Jt(e){if(e.type!==`case`&&e.type!==`shortFormCase`)return!1;let t=e;return typeof t.volume==`number`?t.volume>Kt:!1}function Yt(e){if(e.type!==`case`&&e.type!==`shortFormCase`)return!1;let t=e,n=String(t.volume);return qt.test(n)}function Xt(t){if(t.type!==`case`&&t.type!==`shortFormCase`)return!1;let n=t,r=typeof n.volume==`number`?n.volume:Number.parseInt(String(n.volume),10);if(Number.isNaN(r)||r<1||r>20)return!1;let i=n.reporter;if(!i)return!1;let a=e.s();return a?(a.byAbbreviation.get(i.toLowerCase())??[]).length===0:i.includes(`.`)?!1:i.toLowerCase().split(/\s+/).some(e=>Gt.has(e))}function Zt(e){let t=Vt(e);if(t&&Bt.has(t.toLowerCase().trim())||t&&(e.type===`case`||e.type===`shortFormCase`)&&Wt(t)||Jt(e)||Yt(e)||Xt(e))return!0;let n=Ht(e);return n!==void 0&&n<Rt}function Qt(e){let t=[],n=Vt(e);if(n){let r=n.toLowerCase().trim();Bt.has(r)&&t.push(`Reporter "${n}" is a known non-US source`),(e.type===`case`||e.type===`shortFormCase`)&&Wt(n)&&t.push(`Reporter "${n}" contains prose words or is implausibly long`)}if(Jt(e)){let n=e;t.push(`Volume ${n.volume} exceeds maximum plausible volume (${Kt}) — likely a zip code or other number`)}if(Yt(e)){let n=e;t.push(`Hyphenated volume "${n.volume}" matches docket number pattern — likely a case number, not a citation volume`)}if(Xt(e)){let n=e;t.push(`Small volume (${n.volume}) with unrecognized reporter "${n.reporter}" — likely a paragraph or footnote marker`)}let r=Ht(e);return r!==void 0&&r<Rt&&t.push(`Year ${r} predates US legal reporting (threshold: ${Rt})`),t}function $t(e,t){if(t)return e.filter(e=>!Zt(e));for(let t of e){if(t.confidence===zt&&t.warnings?.length)continue;let e=Qt(t);if(e.length>0){t.confidence=zt;let n=e.map(e=>({level:`warning`,message:e,position:{start:t.span.originalStart,end:t.span.originalEnd}}));t.warnings=[...t.warnings||[],...n]}}return e}const en=/^(\S+)\s+(.+)\s+(\d+)$/;function tn(e,t){let n=performance.now(),{cleaned:r,transformationMap:i,warnings:a}=y(e,t?.cleaners),o;if(t?.detectFootnotes){let t=O(e);t.length>0&&(o=A(t,i))}let s=t?.patterns||[..._t,...vt,...ht,...Ne,...yt,...gt],c=bt(r,s),l=new Map;for(let e=0;e<s.length;e++){let t=s[e].id;l.has(t)||l.set(t,e)}let u=e=>l.get(e.patternId)??1/0,d=[...c].sort((e,t)=>e.span.cleanStart-t.span.cleanStart||t.span.cleanEnd-e.span.cleanEnd||u(e)-u(t)),f=[];for(let e of d){let t=!1;for(let n of f)if(n.span.cleanStart<=e.span.cleanStart&&n.span.cleanEnd>=e.span.cleanEnd&&!(u(n)>u(e))&&(n.span.cleanStart<e.span.cleanStart||n.span.cleanEnd>e.span.cleanEnd||u(n)<u(e))){t=!0;break}t||f.push(e)}let p=kt(f,r),m=new Map;for(let[e,t]of p.entries())for(let n of t)m.set(n,e);let h=[];for(let e=0;e<f.length;e++){let t=f[e],o;switch(t.type){case`case`:o=t.patternId===`id`||t.patternId===`ibid`?Ke(t,i,r):t.patternId===`supra`?qe(t,i):t.patternId===`shortFormCase`?Je(t,i):je(t,i,r);break;case`statute`:o=pt(t,i);break;case`journal`:o=He(t,i,r);break;case`neutral`:o=We(t,i,r);break;case`publicLaw`:o=Ge(t,i);break;case`federalRegister`:o=Ve(t,i);break;case`statutesAtLarge`:o=mt(t,i);break;case`constitutional`:o=Be(t,i);break;default:continue}if(a.length>0&&(o.warnings=[...o.warnings||[],...a]),o.processTimeMs=performance.now()-n,o.type===`case`){let t=p.has(e),n=m.has(e);if(t||n){let r=f[n?m.get(e)??e:e],i=en.exec(r.text);if(i){let[,n,r,a]=i;if(o.groupId=`${n}-${r.replace(/\s+/g,`.`)}-${a}`,t){let t=p.get(e)??[];o.parallelCitations=t.map(e=>{let t=f[e],n=en.exec(t.text);if(n){let[,e,t,r]=n;return{volume:/^\d+$/.test(e)?Number.parseInt(e,10):e,reporter:t,page:Number.parseInt(r,10)}}return{volume:0,reporter:``,page:0}})}}}}h.push(o)}rn(h),It(h,r),Lt(h,r);let g=$t(h,t?.filterFalsePositives??!1);return o&&j(g,o),t?.resolve?Ot(g,e,o?{...t.resolutionOptions,footnoteMap:o}:t.resolutionOptions):g}async function nn(e,t){return tn(e,t)}function rn(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];if(r.type!==`case`||!r.subsequentHistoryEntries)continue;let i=r.subsequentHistoryEntries,a=0;for(let r=n+1;r<e.length&&a<i.length;r++){let o=e[r];if(o.type!==`case`)continue;let s=i[a].signalSpan.cleanEnd;o.span.cleanStart>=s&&(t.push({parentIdx:n,childIdx:r,signal:i[a].signal}),a++)}}if(t.length===0)return;let n=new x(e.length);for(let e of t)n.union(e.parentIdx,e.childIdx);let r=new Map;for(let e of t)r.set(e.childIdx,e.signal);for(let[t,i]of n.components()){if(i.length===1)continue;let n=e[t];if(n.type!==`case`)continue;let a=[...n.subsequentHistoryEntries??[]];for(let n of i){if(n===t)continue;let i=e[n];if(i.type!==`case`)continue;let o=r.get(n);if(o&&(i.subsequentHistoryOf={index:t,signal:o},i.subsequentHistoryEntries)){for(let e of i.subsequentHistoryEntries)a.push({...e,order:a.length});i.subsequentHistoryEntries=void 0}}n.subsequentHistoryEntries=a}}exports.DocumentResolver=Dt,exports.applyFalsePositiveFilters=$t,exports.assertUnreachable=a,exports.cleanText=y,exports.detectFootnotes=O,exports.extractCase=je,exports.extractCitations=tn,exports.extractCitationsAsync=nn,exports.extractConstitutional=Be,exports.extractFederalRegister=Ve,exports.extractJournal=He,exports.extractNeutral=We,exports.extractPublicLaw=Ge,exports.extractStatute=pt,exports.extractStatutesAtLarge=mt,exports.isCaseCitation=r,exports.isCitationType=i,exports.isFullCitation=t,exports.isShortFormCitation=n,exports.normalizeCourt=te,exports.parsePincite=V,exports.resolveCitations=Ot,exports.spanFromGroupIndex=o,exports.tokenize=bt;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|