@superdoc/mcp 1.0.0-next.10 → 1.0.0-next.11

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.
Files changed (2) hide show
  1. package/dist/index.js +948 -73
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -30516,6 +30516,7 @@ var init_contract = __esm(() => {
30516
30516
  enum: [
30517
30517
  "paragraph",
30518
30518
  "heading",
30519
+ "listItem",
30519
30520
  "table",
30520
30521
  "tableOfContents",
30521
30522
  "sdt",
@@ -47271,6 +47272,9 @@ var init_contract = __esm(() => {
47271
47272
  {
47272
47273
  const: "heading"
47273
47274
  },
47275
+ {
47276
+ const: "listItem"
47277
+ },
47274
47278
  {
47275
47279
  const: "table"
47276
47280
  },
@@ -47706,6 +47710,9 @@ var init_contract = __esm(() => {
47706
47710
  {
47707
47711
  const: "heading"
47708
47712
  },
47713
+ {
47714
+ const: "listItem"
47715
+ },
47709
47716
  {
47710
47717
  const: "table"
47711
47718
  },
@@ -48835,6 +48842,9 @@ var init_contract = __esm(() => {
48835
48842
  {
48836
48843
  const: "heading"
48837
48844
  },
48845
+ {
48846
+ const: "listItem"
48847
+ },
48838
48848
  {
48839
48849
  const: "table"
48840
48850
  },
@@ -49270,6 +49280,9 @@ var init_contract = __esm(() => {
49270
49280
  {
49271
49281
  const: "heading"
49272
49282
  },
49283
+ {
49284
+ const: "listItem"
49285
+ },
49273
49286
  {
49274
49287
  const: "table"
49275
49288
  },
@@ -50411,6 +50424,9 @@ var init_contract = __esm(() => {
50411
50424
  {
50412
50425
  const: "heading"
50413
50426
  },
50427
+ {
50428
+ const: "listItem"
50429
+ },
50414
50430
  {
50415
50431
  const: "table"
50416
50432
  },
@@ -50846,6 +50862,9 @@ var init_contract = __esm(() => {
50846
50862
  {
50847
50863
  const: "heading"
50848
50864
  },
50865
+ {
50866
+ const: "listItem"
50867
+ },
50849
50868
  {
50850
50869
  const: "table"
50851
50870
  },
@@ -51996,6 +52015,9 @@ var init_contract = __esm(() => {
51996
52015
  {
51997
52016
  const: "heading"
51998
52017
  },
52018
+ {
52019
+ const: "listItem"
52020
+ },
51999
52021
  {
52000
52022
  const: "table"
52001
52023
  },
@@ -52431,6 +52453,9 @@ var init_contract = __esm(() => {
52431
52453
  {
52432
52454
  const: "heading"
52433
52455
  },
52456
+ {
52457
+ const: "listItem"
52458
+ },
52434
52459
  {
52435
52460
  const: "table"
52436
52461
  },
@@ -55193,6 +55218,9 @@ var init_contract = __esm(() => {
55193
55218
  {
55194
55219
  const: "heading"
55195
55220
  },
55221
+ {
55222
+ const: "listItem"
55223
+ },
55196
55224
  {
55197
55225
  const: "table"
55198
55226
  },
@@ -55628,6 +55656,9 @@ var init_contract = __esm(() => {
55628
55656
  {
55629
55657
  const: "heading"
55630
55658
  },
55659
+ {
55660
+ const: "listItem"
55661
+ },
55631
55662
  {
55632
55663
  const: "table"
55633
55664
  },
@@ -56261,6 +56292,9 @@ var init_contract = __esm(() => {
56261
56292
  {
56262
56293
  const: "heading"
56263
56294
  },
56295
+ {
56296
+ const: "listItem"
56297
+ },
56264
56298
  {
56265
56299
  const: "table"
56266
56300
  },
@@ -56696,6 +56730,9 @@ var init_contract = __esm(() => {
56696
56730
  {
56697
56731
  const: "heading"
56698
56732
  },
56733
+ {
56734
+ const: "listItem"
56735
+ },
56699
56736
  {
56700
56737
  const: "table"
56701
56738
  },
@@ -59802,6 +59839,9 @@ var init_contract = __esm(() => {
59802
59839
  {
59803
59840
  const: "heading"
59804
59841
  },
59842
+ {
59843
+ const: "listItem"
59844
+ },
59805
59845
  {
59806
59846
  const: "table"
59807
59847
  },
@@ -60237,6 +60277,9 @@ var init_contract = __esm(() => {
60237
60277
  {
60238
60278
  const: "heading"
60239
60279
  },
60280
+ {
60281
+ const: "listItem"
60282
+ },
60240
60283
  {
60241
60284
  const: "table"
60242
60285
  },
@@ -61107,6 +61150,9 @@ var init_contract = __esm(() => {
61107
61150
  {
61108
61151
  const: "heading"
61109
61152
  },
61153
+ {
61154
+ const: "listItem"
61155
+ },
61110
61156
  {
61111
61157
  const: "table"
61112
61158
  },
@@ -61542,6 +61588,9 @@ var init_contract = __esm(() => {
61542
61588
  {
61543
61589
  const: "heading"
61544
61590
  },
61591
+ {
61592
+ const: "listItem"
61593
+ },
61545
61594
  {
61546
61595
  const: "table"
61547
61596
  },
@@ -64215,6 +64264,9 @@ var init_contract = __esm(() => {
64215
64264
  {
64216
64265
  const: "heading"
64217
64266
  },
64267
+ {
64268
+ const: "listItem"
64269
+ },
64218
64270
  {
64219
64271
  const: "table"
64220
64272
  },
@@ -64650,6 +64702,9 @@ var init_contract = __esm(() => {
64650
64702
  {
64651
64703
  const: "heading"
64652
64704
  },
64705
+ {
64706
+ const: "listItem"
64707
+ },
64653
64708
  {
64654
64709
  const: "table"
64655
64710
  },
@@ -65728,6 +65783,9 @@ var init_contract = __esm(() => {
65728
65783
  {
65729
65784
  const: "heading"
65730
65785
  },
65786
+ {
65787
+ const: "listItem"
65788
+ },
65731
65789
  {
65732
65790
  const: "table"
65733
65791
  },
@@ -66163,6 +66221,9 @@ var init_contract = __esm(() => {
66163
66221
  {
66164
66222
  const: "heading"
66165
66223
  },
66224
+ {
66225
+ const: "listItem"
66226
+ },
66166
66227
  {
66167
66228
  const: "table"
66168
66229
  },
@@ -73367,6 +73428,9 @@ var init_contract = __esm(() => {
73367
73428
  {
73368
73429
  const: "heading"
73369
73430
  },
73431
+ {
73432
+ const: "listItem"
73433
+ },
73370
73434
  {
73371
73435
  const: "table"
73372
73436
  },
@@ -73802,6 +73866,9 @@ var init_contract = __esm(() => {
73802
73866
  {
73803
73867
  const: "heading"
73804
73868
  },
73869
+ {
73870
+ const: "listItem"
73871
+ },
73805
73872
  {
73806
73873
  const: "table"
73807
73874
  },
@@ -77252,6 +77319,9 @@ var init_contract = __esm(() => {
77252
77319
  {
77253
77320
  const: "heading"
77254
77321
  },
77322
+ {
77323
+ const: "listItem"
77324
+ },
77255
77325
  {
77256
77326
  const: "table"
77257
77327
  },
@@ -77687,6 +77757,9 @@ var init_contract = __esm(() => {
77687
77757
  {
77688
77758
  const: "heading"
77689
77759
  },
77760
+ {
77761
+ const: "listItem"
77762
+ },
77690
77763
  {
77691
77764
  const: "table"
77692
77765
  },
@@ -78583,6 +78656,9 @@ var init_contract = __esm(() => {
78583
78656
  {
78584
78657
  const: "heading"
78585
78658
  },
78659
+ {
78660
+ const: "listItem"
78661
+ },
78586
78662
  {
78587
78663
  const: "table"
78588
78664
  },
@@ -79018,6 +79094,9 @@ var init_contract = __esm(() => {
79018
79094
  {
79019
79095
  const: "heading"
79020
79096
  },
79097
+ {
79098
+ const: "listItem"
79099
+ },
79021
79100
  {
79022
79101
  const: "table"
79023
79102
  },
@@ -79914,6 +79993,9 @@ var init_contract = __esm(() => {
79914
79993
  {
79915
79994
  const: "heading"
79916
79995
  },
79996
+ {
79997
+ const: "listItem"
79998
+ },
79917
79999
  {
79918
80000
  const: "table"
79919
80001
  },
@@ -80349,6 +80431,9 @@ var init_contract = __esm(() => {
80349
80431
  {
80350
80432
  const: "heading"
80351
80433
  },
80434
+ {
80435
+ const: "listItem"
80436
+ },
80352
80437
  {
80353
80438
  const: "table"
80354
80439
  },
@@ -81245,6 +81330,9 @@ var init_contract = __esm(() => {
81245
81330
  {
81246
81331
  const: "heading"
81247
81332
  },
81333
+ {
81334
+ const: "listItem"
81335
+ },
81248
81336
  {
81249
81337
  const: "table"
81250
81338
  },
@@ -81680,6 +81768,9 @@ var init_contract = __esm(() => {
81680
81768
  {
81681
81769
  const: "heading"
81682
81770
  },
81771
+ {
81772
+ const: "listItem"
81773
+ },
81683
81774
  {
81684
81775
  const: "table"
81685
81776
  },
@@ -82691,6 +82782,9 @@ var init_contract = __esm(() => {
82691
82782
  {
82692
82783
  const: "heading"
82693
82784
  },
82785
+ {
82786
+ const: "listItem"
82787
+ },
82694
82788
  {
82695
82789
  const: "table"
82696
82790
  },
@@ -83126,6 +83220,9 @@ var init_contract = __esm(() => {
83126
83220
  {
83127
83221
  const: "heading"
83128
83222
  },
83223
+ {
83224
+ const: "listItem"
83225
+ },
83129
83226
  {
83130
83227
  const: "table"
83131
83228
  },
@@ -84026,6 +84123,9 @@ var init_contract = __esm(() => {
84026
84123
  {
84027
84124
  const: "heading"
84028
84125
  },
84126
+ {
84127
+ const: "listItem"
84128
+ },
84029
84129
  {
84030
84130
  const: "table"
84031
84131
  },
@@ -84461,6 +84561,9 @@ var init_contract = __esm(() => {
84461
84561
  {
84462
84562
  const: "heading"
84463
84563
  },
84564
+ {
84565
+ const: "listItem"
84566
+ },
84464
84567
  {
84465
84568
  const: "table"
84466
84569
  },
@@ -85361,6 +85464,9 @@ var init_contract = __esm(() => {
85361
85464
  {
85362
85465
  const: "heading"
85363
85466
  },
85467
+ {
85468
+ const: "listItem"
85469
+ },
85364
85470
  {
85365
85471
  const: "table"
85366
85472
  },
@@ -85796,6 +85902,9 @@ var init_contract = __esm(() => {
85796
85902
  {
85797
85903
  const: "heading"
85798
85904
  },
85905
+ {
85906
+ const: "listItem"
85907
+ },
85799
85908
  {
85800
85909
  const: "table"
85801
85910
  },
@@ -86694,6 +86803,9 @@ var init_contract = __esm(() => {
86694
86803
  {
86695
86804
  const: "heading"
86696
86805
  },
86806
+ {
86807
+ const: "listItem"
86808
+ },
86697
86809
  {
86698
86810
  const: "table"
86699
86811
  },
@@ -87129,6 +87241,9 @@ var init_contract = __esm(() => {
87129
87241
  {
87130
87242
  const: "heading"
87131
87243
  },
87244
+ {
87245
+ const: "listItem"
87246
+ },
87132
87247
  {
87133
87248
  const: "table"
87134
87249
  },
@@ -88029,6 +88144,9 @@ var init_contract = __esm(() => {
88029
88144
  {
88030
88145
  const: "heading"
88031
88146
  },
88147
+ {
88148
+ const: "listItem"
88149
+ },
88032
88150
  {
88033
88151
  const: "table"
88034
88152
  },
@@ -88464,6 +88582,9 @@ var init_contract = __esm(() => {
88464
88582
  {
88465
88583
  const: "heading"
88466
88584
  },
88585
+ {
88586
+ const: "listItem"
88587
+ },
88467
88588
  {
88468
88589
  const: "table"
88469
88590
  },
@@ -89362,6 +89483,9 @@ var init_contract = __esm(() => {
89362
89483
  {
89363
89484
  const: "heading"
89364
89485
  },
89486
+ {
89487
+ const: "listItem"
89488
+ },
89365
89489
  {
89366
89490
  const: "table"
89367
89491
  },
@@ -89797,6 +89921,9 @@ var init_contract = __esm(() => {
89797
89921
  {
89798
89922
  const: "heading"
89799
89923
  },
89924
+ {
89925
+ const: "listItem"
89926
+ },
89800
89927
  {
89801
89928
  const: "table"
89802
89929
  },
@@ -90713,6 +90840,9 @@ var init_contract = __esm(() => {
90713
90840
  {
90714
90841
  const: "heading"
90715
90842
  },
90843
+ {
90844
+ const: "listItem"
90845
+ },
90716
90846
  {
90717
90847
  const: "table"
90718
90848
  },
@@ -91148,6 +91278,9 @@ var init_contract = __esm(() => {
91148
91278
  {
91149
91279
  const: "heading"
91150
91280
  },
91281
+ {
91282
+ const: "listItem"
91283
+ },
91151
91284
  {
91152
91285
  const: "table"
91153
91286
  },
@@ -92046,6 +92179,9 @@ var init_contract = __esm(() => {
92046
92179
  {
92047
92180
  const: "heading"
92048
92181
  },
92182
+ {
92183
+ const: "listItem"
92184
+ },
92049
92185
  {
92050
92186
  const: "table"
92051
92187
  },
@@ -92481,6 +92617,9 @@ var init_contract = __esm(() => {
92481
92617
  {
92482
92618
  const: "heading"
92483
92619
  },
92620
+ {
92621
+ const: "listItem"
92622
+ },
92484
92623
  {
92485
92624
  const: "table"
92486
92625
  },
@@ -93377,6 +93516,9 @@ var init_contract = __esm(() => {
93377
93516
  {
93378
93517
  const: "heading"
93379
93518
  },
93519
+ {
93520
+ const: "listItem"
93521
+ },
93380
93522
  {
93381
93523
  const: "table"
93382
93524
  },
@@ -93812,6 +93954,9 @@ var init_contract = __esm(() => {
93812
93954
  {
93813
93955
  const: "heading"
93814
93956
  },
93957
+ {
93958
+ const: "listItem"
93959
+ },
93815
93960
  {
93816
93961
  const: "table"
93817
93962
  },
@@ -94708,6 +94853,9 @@ var init_contract = __esm(() => {
94708
94853
  {
94709
94854
  const: "heading"
94710
94855
  },
94856
+ {
94857
+ const: "listItem"
94858
+ },
94711
94859
  {
94712
94860
  const: "table"
94713
94861
  },
@@ -95143,6 +95291,9 @@ var init_contract = __esm(() => {
95143
95291
  {
95144
95292
  const: "heading"
95145
95293
  },
95294
+ {
95295
+ const: "listItem"
95296
+ },
95146
95297
  {
95147
95298
  const: "table"
95148
95299
  },
@@ -96039,6 +96190,9 @@ var init_contract = __esm(() => {
96039
96190
  {
96040
96191
  const: "heading"
96041
96192
  },
96193
+ {
96194
+ const: "listItem"
96195
+ },
96042
96196
  {
96043
96197
  const: "table"
96044
96198
  },
@@ -96474,6 +96628,9 @@ var init_contract = __esm(() => {
96474
96628
  {
96475
96629
  const: "heading"
96476
96630
  },
96631
+ {
96632
+ const: "listItem"
96633
+ },
96477
96634
  {
96478
96635
  const: "table"
96479
96636
  },
@@ -97478,6 +97635,9 @@ var init_contract = __esm(() => {
97478
97635
  {
97479
97636
  const: "heading"
97480
97637
  },
97638
+ {
97639
+ const: "listItem"
97640
+ },
97481
97641
  {
97482
97642
  const: "table"
97483
97643
  },
@@ -97913,6 +98073,9 @@ var init_contract = __esm(() => {
97913
98073
  {
97914
98074
  const: "heading"
97915
98075
  },
98076
+ {
98077
+ const: "listItem"
98078
+ },
97916
98079
  {
97917
98080
  const: "table"
97918
98081
  },
@@ -98945,6 +99108,9 @@ var init_contract = __esm(() => {
98945
99108
  {
98946
99109
  const: "heading"
98947
99110
  },
99111
+ {
99112
+ const: "listItem"
99113
+ },
98948
99114
  {
98949
99115
  const: "table"
98950
99116
  },
@@ -99380,6 +99546,9 @@ var init_contract = __esm(() => {
99380
99546
  {
99381
99547
  const: "heading"
99382
99548
  },
99549
+ {
99550
+ const: "listItem"
99551
+ },
99383
99552
  {
99384
99553
  const: "table"
99385
99554
  },
@@ -100276,6 +100445,9 @@ var init_contract = __esm(() => {
100276
100445
  {
100277
100446
  const: "heading"
100278
100447
  },
100448
+ {
100449
+ const: "listItem"
100450
+ },
100279
100451
  {
100280
100452
  const: "table"
100281
100453
  },
@@ -100711,6 +100883,9 @@ var init_contract = __esm(() => {
100711
100883
  {
100712
100884
  const: "heading"
100713
100885
  },
100886
+ {
100887
+ const: "listItem"
100888
+ },
100714
100889
  {
100715
100890
  const: "table"
100716
100891
  },
@@ -101607,6 +101782,9 @@ var init_contract = __esm(() => {
101607
101782
  {
101608
101783
  const: "heading"
101609
101784
  },
101785
+ {
101786
+ const: "listItem"
101787
+ },
101610
101788
  {
101611
101789
  const: "table"
101612
101790
  },
@@ -102042,6 +102220,9 @@ var init_contract = __esm(() => {
102042
102220
  {
102043
102221
  const: "heading"
102044
102222
  },
102223
+ {
102224
+ const: "listItem"
102225
+ },
102045
102226
  {
102046
102227
  const: "table"
102047
102228
  },
@@ -102938,6 +103119,9 @@ var init_contract = __esm(() => {
102938
103119
  {
102939
103120
  const: "heading"
102940
103121
  },
103122
+ {
103123
+ const: "listItem"
103124
+ },
102941
103125
  {
102942
103126
  const: "table"
102943
103127
  },
@@ -103373,6 +103557,9 @@ var init_contract = __esm(() => {
103373
103557
  {
103374
103558
  const: "heading"
103375
103559
  },
103560
+ {
103561
+ const: "listItem"
103562
+ },
103376
103563
  {
103377
103564
  const: "table"
103378
103565
  },
@@ -104269,6 +104456,9 @@ var init_contract = __esm(() => {
104269
104456
  {
104270
104457
  const: "heading"
104271
104458
  },
104459
+ {
104460
+ const: "listItem"
104461
+ },
104272
104462
  {
104273
104463
  const: "table"
104274
104464
  },
@@ -104704,6 +104894,9 @@ var init_contract = __esm(() => {
104704
104894
  {
104705
104895
  const: "heading"
104706
104896
  },
104897
+ {
104898
+ const: "listItem"
104899
+ },
104707
104900
  {
104708
104901
  const: "table"
104709
104902
  },
@@ -105602,6 +105795,9 @@ var init_contract = __esm(() => {
105602
105795
  {
105603
105796
  const: "heading"
105604
105797
  },
105798
+ {
105799
+ const: "listItem"
105800
+ },
105605
105801
  {
105606
105802
  const: "table"
105607
105803
  },
@@ -106037,6 +106233,9 @@ var init_contract = __esm(() => {
106037
106233
  {
106038
106234
  const: "heading"
106039
106235
  },
106236
+ {
106237
+ const: "listItem"
106238
+ },
106040
106239
  {
106041
106240
  const: "table"
106042
106241
  },
@@ -106935,6 +107134,9 @@ var init_contract = __esm(() => {
106935
107134
  {
106936
107135
  const: "heading"
106937
107136
  },
107137
+ {
107138
+ const: "listItem"
107139
+ },
106938
107140
  {
106939
107141
  const: "table"
106940
107142
  },
@@ -107370,6 +107572,9 @@ var init_contract = __esm(() => {
107370
107572
  {
107371
107573
  const: "heading"
107372
107574
  },
107575
+ {
107576
+ const: "listItem"
107577
+ },
107373
107578
  {
107374
107579
  const: "table"
107375
107580
  },
@@ -108266,6 +108471,9 @@ var init_contract = __esm(() => {
108266
108471
  {
108267
108472
  const: "heading"
108268
108473
  },
108474
+ {
108475
+ const: "listItem"
108476
+ },
108269
108477
  {
108270
108478
  const: "table"
108271
108479
  },
@@ -108701,6 +108909,9 @@ var init_contract = __esm(() => {
108701
108909
  {
108702
108910
  const: "heading"
108703
108911
  },
108912
+ {
108913
+ const: "listItem"
108914
+ },
108704
108915
  {
108705
108916
  const: "table"
108706
108917
  },
@@ -109597,6 +109808,9 @@ var init_contract = __esm(() => {
109597
109808
  {
109598
109809
  const: "heading"
109599
109810
  },
109811
+ {
109812
+ const: "listItem"
109813
+ },
109600
109814
  {
109601
109815
  const: "table"
109602
109816
  },
@@ -110032,6 +110246,9 @@ var init_contract = __esm(() => {
110032
110246
  {
110033
110247
  const: "heading"
110034
110248
  },
110249
+ {
110250
+ const: "listItem"
110251
+ },
110035
110252
  {
110036
110253
  const: "table"
110037
110254
  },
@@ -110928,6 +111145,9 @@ var init_contract = __esm(() => {
110928
111145
  {
110929
111146
  const: "heading"
110930
111147
  },
111148
+ {
111149
+ const: "listItem"
111150
+ },
110931
111151
  {
110932
111152
  const: "table"
110933
111153
  },
@@ -111363,6 +111583,9 @@ var init_contract = __esm(() => {
111363
111583
  {
111364
111584
  const: "heading"
111365
111585
  },
111586
+ {
111587
+ const: "listItem"
111588
+ },
111366
111589
  {
111367
111590
  const: "table"
111368
111591
  },
@@ -112259,6 +112482,9 @@ var init_contract = __esm(() => {
112259
112482
  {
112260
112483
  const: "heading"
112261
112484
  },
112485
+ {
112486
+ const: "listItem"
112487
+ },
112262
112488
  {
112263
112489
  const: "table"
112264
112490
  },
@@ -112694,6 +112920,9 @@ var init_contract = __esm(() => {
112694
112920
  {
112695
112921
  const: "heading"
112696
112922
  },
112923
+ {
112924
+ const: "listItem"
112925
+ },
112697
112926
  {
112698
112927
  const: "table"
112699
112928
  },
@@ -113590,6 +113819,9 @@ var init_contract = __esm(() => {
113590
113819
  {
113591
113820
  const: "heading"
113592
113821
  },
113822
+ {
113823
+ const: "listItem"
113824
+ },
113593
113825
  {
113594
113826
  const: "table"
113595
113827
  },
@@ -114025,6 +114257,9 @@ var init_contract = __esm(() => {
114025
114257
  {
114026
114258
  const: "heading"
114027
114259
  },
114260
+ {
114261
+ const: "listItem"
114262
+ },
114028
114263
  {
114029
114264
  const: "table"
114030
114265
  },
@@ -114921,6 +115156,9 @@ var init_contract = __esm(() => {
114921
115156
  {
114922
115157
  const: "heading"
114923
115158
  },
115159
+ {
115160
+ const: "listItem"
115161
+ },
114924
115162
  {
114925
115163
  const: "table"
114926
115164
  },
@@ -115356,6 +115594,9 @@ var init_contract = __esm(() => {
115356
115594
  {
115357
115595
  const: "heading"
115358
115596
  },
115597
+ {
115598
+ const: "listItem"
115599
+ },
115359
115600
  {
115360
115601
  const: "table"
115361
115602
  },
@@ -116252,6 +116493,9 @@ var init_contract = __esm(() => {
116252
116493
  {
116253
116494
  const: "heading"
116254
116495
  },
116496
+ {
116497
+ const: "listItem"
116498
+ },
116255
116499
  {
116256
116500
  const: "table"
116257
116501
  },
@@ -116687,6 +116931,9 @@ var init_contract = __esm(() => {
116687
116931
  {
116688
116932
  const: "heading"
116689
116933
  },
116934
+ {
116935
+ const: "listItem"
116936
+ },
116690
116937
  {
116691
116938
  const: "table"
116692
116939
  },
@@ -117749,6 +117996,9 @@ var init_contract = __esm(() => {
117749
117996
  {
117750
117997
  const: "heading"
117751
117998
  },
117999
+ {
118000
+ const: "listItem"
118001
+ },
117752
118002
  {
117753
118003
  const: "table"
117754
118004
  },
@@ -118184,6 +118434,9 @@ var init_contract = __esm(() => {
118184
118434
  {
118185
118435
  const: "heading"
118186
118436
  },
118437
+ {
118438
+ const: "listItem"
118439
+ },
118187
118440
  {
118188
118441
  const: "table"
118189
118442
  },
@@ -119084,6 +119337,9 @@ var init_contract = __esm(() => {
119084
119337
  {
119085
119338
  const: "heading"
119086
119339
  },
119340
+ {
119341
+ const: "listItem"
119342
+ },
119087
119343
  {
119088
119344
  const: "table"
119089
119345
  },
@@ -119519,6 +119775,9 @@ var init_contract = __esm(() => {
119519
119775
  {
119520
119776
  const: "heading"
119521
119777
  },
119778
+ {
119779
+ const: "listItem"
119780
+ },
119522
119781
  {
119523
119782
  const: "table"
119524
119783
  },
@@ -120489,6 +120748,9 @@ var init_contract = __esm(() => {
120489
120748
  {
120490
120749
  const: "heading"
120491
120750
  },
120751
+ {
120752
+ const: "listItem"
120753
+ },
120492
120754
  {
120493
120755
  const: "table"
120494
120756
  },
@@ -120924,6 +121186,9 @@ var init_contract = __esm(() => {
120924
121186
  {
120925
121187
  const: "heading"
120926
121188
  },
121189
+ {
121190
+ const: "listItem"
121191
+ },
120927
121192
  {
120928
121193
  const: "table"
120929
121194
  },
@@ -121820,6 +122085,9 @@ var init_contract = __esm(() => {
121820
122085
  {
121821
122086
  const: "heading"
121822
122087
  },
122088
+ {
122089
+ const: "listItem"
122090
+ },
121823
122091
  {
121824
122092
  const: "table"
121825
122093
  },
@@ -122255,6 +122523,9 @@ var init_contract = __esm(() => {
122255
122523
  {
122256
122524
  const: "heading"
122257
122525
  },
122526
+ {
122527
+ const: "listItem"
122528
+ },
122258
122529
  {
122259
122530
  const: "table"
122260
122531
  },
@@ -123259,6 +123530,9 @@ var init_contract = __esm(() => {
123259
123530
  {
123260
123531
  const: "heading"
123261
123532
  },
123533
+ {
123534
+ const: "listItem"
123535
+ },
123262
123536
  {
123263
123537
  const: "table"
123264
123538
  },
@@ -123694,6 +123968,9 @@ var init_contract = __esm(() => {
123694
123968
  {
123695
123969
  const: "heading"
123696
123970
  },
123971
+ {
123972
+ const: "listItem"
123973
+ },
123697
123974
  {
123698
123975
  const: "table"
123699
123976
  },
@@ -124590,6 +124867,9 @@ var init_contract = __esm(() => {
124590
124867
  {
124591
124868
  const: "heading"
124592
124869
  },
124870
+ {
124871
+ const: "listItem"
124872
+ },
124593
124873
  {
124594
124874
  const: "table"
124595
124875
  },
@@ -125025,6 +125305,9 @@ var init_contract = __esm(() => {
125025
125305
  {
125026
125306
  const: "heading"
125027
125307
  },
125308
+ {
125309
+ const: "listItem"
125310
+ },
125028
125311
  {
125029
125312
  const: "table"
125030
125313
  },
@@ -125925,6 +126208,9 @@ var init_contract = __esm(() => {
125925
126208
  {
125926
126209
  const: "heading"
125927
126210
  },
126211
+ {
126212
+ const: "listItem"
126213
+ },
125928
126214
  {
125929
126215
  const: "table"
125930
126216
  },
@@ -126360,6 +126646,9 @@ var init_contract = __esm(() => {
126360
126646
  {
126361
126647
  const: "heading"
126362
126648
  },
126649
+ {
126650
+ const: "listItem"
126651
+ },
126363
126652
  {
126364
126653
  const: "table"
126365
126654
  },
@@ -127556,6 +127845,9 @@ var init_contract = __esm(() => {
127556
127845
  {
127557
127846
  const: "heading"
127558
127847
  },
127848
+ {
127849
+ const: "listItem"
127850
+ },
127559
127851
  {
127560
127852
  const: "table"
127561
127853
  },
@@ -127991,6 +128283,9 @@ var init_contract = __esm(() => {
127991
128283
  {
127992
128284
  const: "heading"
127993
128285
  },
128286
+ {
128287
+ const: "listItem"
128288
+ },
127994
128289
  {
127995
128290
  const: "table"
127996
128291
  },
@@ -128889,6 +129184,9 @@ var init_contract = __esm(() => {
128889
129184
  {
128890
129185
  const: "heading"
128891
129186
  },
129187
+ {
129188
+ const: "listItem"
129189
+ },
128892
129190
  {
128893
129191
  const: "table"
128894
129192
  },
@@ -129324,6 +129622,9 @@ var init_contract = __esm(() => {
129324
129622
  {
129325
129623
  const: "heading"
129326
129624
  },
129625
+ {
129626
+ const: "listItem"
129627
+ },
129327
129628
  {
129328
129629
  const: "table"
129329
129630
  },
@@ -130224,6 +130525,9 @@ var init_contract = __esm(() => {
130224
130525
  {
130225
130526
  const: "heading"
130226
130527
  },
130528
+ {
130529
+ const: "listItem"
130530
+ },
130227
130531
  {
130228
130532
  const: "table"
130229
130533
  },
@@ -130659,6 +130963,9 @@ var init_contract = __esm(() => {
130659
130963
  {
130660
130964
  const: "heading"
130661
130965
  },
130966
+ {
130967
+ const: "listItem"
130968
+ },
130662
130969
  {
130663
130970
  const: "table"
130664
130971
  },
@@ -131559,6 +131866,9 @@ var init_contract = __esm(() => {
131559
131866
  {
131560
131867
  const: "heading"
131561
131868
  },
131869
+ {
131870
+ const: "listItem"
131871
+ },
131562
131872
  {
131563
131873
  const: "table"
131564
131874
  },
@@ -131994,6 +132304,9 @@ var init_contract = __esm(() => {
131994
132304
  {
131995
132305
  const: "heading"
131996
132306
  },
132307
+ {
132308
+ const: "listItem"
132309
+ },
131997
132310
  {
131998
132311
  const: "table"
131999
132312
  },
@@ -132894,6 +133207,9 @@ var init_contract = __esm(() => {
132894
133207
  {
132895
133208
  const: "heading"
132896
133209
  },
133210
+ {
133211
+ const: "listItem"
133212
+ },
132897
133213
  {
132898
133214
  const: "table"
132899
133215
  },
@@ -133329,6 +133645,9 @@ var init_contract = __esm(() => {
133329
133645
  {
133330
133646
  const: "heading"
133331
133647
  },
133648
+ {
133649
+ const: "listItem"
133650
+ },
133332
133651
  {
133333
133652
  const: "table"
133334
133653
  },
@@ -134274,6 +134593,9 @@ var init_contract = __esm(() => {
134274
134593
  {
134275
134594
  const: "heading"
134276
134595
  },
134596
+ {
134597
+ const: "listItem"
134598
+ },
134277
134599
  {
134278
134600
  const: "table"
134279
134601
  },
@@ -134709,6 +135031,9 @@ var init_contract = __esm(() => {
134709
135031
  {
134710
135032
  const: "heading"
134711
135033
  },
135034
+ {
135035
+ const: "listItem"
135036
+ },
134712
135037
  {
134713
135038
  const: "table"
134714
135039
  },
@@ -194706,6 +195031,9 @@ var init_contract = __esm(() => {
194706
195031
  {
194707
195032
  const: "heading"
194708
195033
  },
195034
+ {
195035
+ const: "listItem"
195036
+ },
194709
195037
  {
194710
195038
  const: "table"
194711
195039
  },
@@ -195141,6 +195469,9 @@ var init_contract = __esm(() => {
195141
195469
  {
195142
195470
  const: "heading"
195143
195471
  },
195472
+ {
195473
+ const: "listItem"
195474
+ },
195144
195475
  {
195145
195476
  const: "table"
195146
195477
  },
@@ -196980,6 +197311,9 @@ var init_contract = __esm(() => {
196980
197311
  {
196981
197312
  const: "heading"
196982
197313
  },
197314
+ {
197315
+ const: "listItem"
197316
+ },
196983
197317
  {
196984
197318
  const: "table"
196985
197319
  },
@@ -197415,6 +197749,9 @@ var init_contract = __esm(() => {
197415
197749
  {
197416
197750
  const: "heading"
197417
197751
  },
197752
+ {
197753
+ const: "listItem"
197754
+ },
197418
197755
  {
197419
197756
  const: "table"
197420
197757
  },
@@ -199531,7 +199868,13 @@ var init_contract = __esm(() => {
199531
199868
  enum: [
199532
199869
  "insertion",
199533
199870
  "deletion",
199534
- "replacement"
199871
+ "replacement",
199872
+ "formatting",
199873
+ "move",
199874
+ "structural",
199875
+ "insert",
199876
+ "delete",
199877
+ "format"
199535
199878
  ]
199536
199879
  },
199537
199880
  subtype: {
@@ -200526,7 +200869,13 @@ var init_contract = __esm(() => {
200526
200869
  enum: [
200527
200870
  "insertion",
200528
200871
  "deletion",
200529
- "replacement"
200872
+ "replacement",
200873
+ "formatting",
200874
+ "move",
200875
+ "structural",
200876
+ "insert",
200877
+ "delete",
200878
+ "format"
200530
200879
  ]
200531
200880
  },
200532
200881
  subtype: {
@@ -204833,6 +205182,9 @@ var init_contract = __esm(() => {
204833
205182
  {
204834
205183
  const: "heading"
204835
205184
  },
205185
+ {
205186
+ const: "listItem"
205187
+ },
204836
205188
  {
204837
205189
  const: "table"
204838
205190
  },
@@ -205340,6 +205692,9 @@ var init_contract = __esm(() => {
205340
205692
  {
205341
205693
  const: "heading"
205342
205694
  },
205695
+ {
205696
+ const: "listItem"
205697
+ },
205343
205698
  {
205344
205699
  const: "table"
205345
205700
  },
@@ -207264,6 +207619,9 @@ var init_contract = __esm(() => {
207264
207619
  {
207265
207620
  const: "heading"
207266
207621
  },
207622
+ {
207623
+ const: "listItem"
207624
+ },
207267
207625
  {
207268
207626
  const: "table"
207269
207627
  },
@@ -207699,6 +208057,9 @@ var init_contract = __esm(() => {
207699
208057
  {
207700
208058
  const: "heading"
207701
208059
  },
208060
+ {
208061
+ const: "listItem"
208062
+ },
207702
208063
  {
207703
208064
  const: "table"
207704
208065
  },
@@ -209226,6 +209587,9 @@ var init_contract = __esm(() => {
209226
209587
  {
209227
209588
  const: "heading"
209228
209589
  },
209590
+ {
209591
+ const: "listItem"
209592
+ },
209229
209593
  {
209230
209594
  const: "table"
209231
209595
  },
@@ -209661,6 +210025,9 @@ var init_contract = __esm(() => {
209661
210025
  {
209662
210026
  const: "heading"
209663
210027
  },
210028
+ {
210029
+ const: "listItem"
210030
+ },
209664
210031
  {
209665
210032
  const: "table"
209666
210033
  },
@@ -211113,6 +211480,9 @@ var init_contract = __esm(() => {
211113
211480
  {
211114
211481
  const: "heading"
211115
211482
  },
211483
+ {
211484
+ const: "listItem"
211485
+ },
211116
211486
  {
211117
211487
  const: "table"
211118
211488
  },
@@ -211548,6 +211918,9 @@ var init_contract = __esm(() => {
211548
211918
  {
211549
211919
  const: "heading"
211550
211920
  },
211921
+ {
211922
+ const: "listItem"
211923
+ },
211551
211924
  {
211552
211925
  const: "table"
211553
211926
  },
@@ -212899,6 +213272,9 @@ var init_contract = __esm(() => {
212899
213272
  {
212900
213273
  const: "heading"
212901
213274
  },
213275
+ {
213276
+ const: "listItem"
213277
+ },
212902
213278
  {
212903
213279
  const: "table"
212904
213280
  },
@@ -213334,6 +213710,9 @@ var init_contract = __esm(() => {
213334
213710
  {
213335
213711
  const: "heading"
213336
213712
  },
213713
+ {
213714
+ const: "listItem"
213715
+ },
213337
213716
  {
213338
213717
  const: "table"
213339
213718
  },
@@ -218284,6 +218663,9 @@ var init_contract = __esm(() => {
218284
218663
  {
218285
218664
  const: "heading"
218286
218665
  },
218666
+ {
218667
+ const: "listItem"
218668
+ },
218287
218669
  {
218288
218670
  const: "table"
218289
218671
  },
@@ -218719,6 +219101,9 @@ var init_contract = __esm(() => {
218719
219101
  {
218720
219102
  const: "heading"
218721
219103
  },
219104
+ {
219105
+ const: "listItem"
219106
+ },
218722
219107
  {
218723
219108
  const: "table"
218724
219109
  },
@@ -220246,6 +220631,9 @@ var init_contract = __esm(() => {
220246
220631
  {
220247
220632
  const: "heading"
220248
220633
  },
220634
+ {
220635
+ const: "listItem"
220636
+ },
220249
220637
  {
220250
220638
  const: "table"
220251
220639
  },
@@ -220681,6 +221069,9 @@ var init_contract = __esm(() => {
220681
221069
  {
220682
221070
  const: "heading"
220683
221071
  },
221072
+ {
221073
+ const: "listItem"
221074
+ },
220684
221075
  {
220685
221076
  const: "table"
220686
221077
  },
@@ -222133,6 +222524,9 @@ var init_contract = __esm(() => {
222133
222524
  {
222134
222525
  const: "heading"
222135
222526
  },
222527
+ {
222528
+ const: "listItem"
222529
+ },
222136
222530
  {
222137
222531
  const: "table"
222138
222532
  },
@@ -222568,6 +222962,9 @@ var init_contract = __esm(() => {
222568
222962
  {
222569
222963
  const: "heading"
222570
222964
  },
222965
+ {
222966
+ const: "listItem"
222967
+ },
222571
222968
  {
222572
222969
  const: "table"
222573
222970
  },
@@ -223919,6 +224316,9 @@ var init_contract = __esm(() => {
223919
224316
  {
223920
224317
  const: "heading"
223921
224318
  },
224319
+ {
224320
+ const: "listItem"
224321
+ },
223922
224322
  {
223923
224323
  const: "table"
223924
224324
  },
@@ -224354,6 +224754,9 @@ var init_contract = __esm(() => {
224354
224754
  {
224355
224755
  const: "heading"
224356
224756
  },
224757
+ {
224758
+ const: "listItem"
224759
+ },
224357
224760
  {
224358
224761
  const: "table"
224359
224762
  },
@@ -246441,6 +246844,9 @@ var init_contract = __esm(() => {
246441
246844
  {
246442
246845
  const: "heading"
246443
246846
  },
246847
+ {
246848
+ const: "listItem"
246849
+ },
246444
246850
  {
246445
246851
  const: "table"
246446
246852
  },
@@ -246876,6 +247282,9 @@ var init_contract = __esm(() => {
246876
247282
  {
246877
247283
  const: "heading"
246878
247284
  },
247285
+ {
247286
+ const: "listItem"
247287
+ },
246879
247288
  {
246880
247289
  const: "table"
246881
247290
  },
@@ -248379,6 +248788,9 @@ var init_contract = __esm(() => {
248379
248788
  {
248380
248789
  const: "heading"
248381
248790
  },
248791
+ {
248792
+ const: "listItem"
248793
+ },
248382
248794
  {
248383
248795
  const: "table"
248384
248796
  },
@@ -248814,6 +249226,9 @@ var init_contract = __esm(() => {
248814
249226
  {
248815
249227
  const: "heading"
248816
249228
  },
249229
+ {
249230
+ const: "listItem"
249231
+ },
248817
249232
  {
248818
249233
  const: "table"
248819
249234
  },
@@ -250339,6 +250754,9 @@ var init_contract = __esm(() => {
250339
250754
  {
250340
250755
  const: "heading"
250341
250756
  },
250757
+ {
250758
+ const: "listItem"
250759
+ },
250342
250760
  {
250343
250761
  const: "table"
250344
250762
  },
@@ -250774,6 +251192,9 @@ var init_contract = __esm(() => {
250774
251192
  {
250775
251193
  const: "heading"
250776
251194
  },
251195
+ {
251196
+ const: "listItem"
251197
+ },
250777
251198
  {
250778
251199
  const: "table"
250779
251200
  },
@@ -290426,6 +290847,9 @@ var init_contract = __esm(() => {
290426
290847
  {
290427
290848
  const: "heading"
290428
290849
  },
290850
+ {
290851
+ const: "listItem"
290852
+ },
290429
290853
  {
290430
290854
  const: "table"
290431
290855
  },
@@ -290861,6 +291285,9 @@ var init_contract = __esm(() => {
290861
291285
  {
290862
291286
  const: "heading"
290863
291287
  },
291288
+ {
291289
+ const: "listItem"
291290
+ },
290864
291291
  {
290865
291292
  const: "table"
290866
291293
  },
@@ -339812,6 +340239,9 @@ var init_contract = __esm(() => {
339812
340239
  {
339813
340240
  const: "heading"
339814
340241
  },
340242
+ {
340243
+ const: "listItem"
340244
+ },
339815
340245
  {
339816
340246
  const: "table"
339817
340247
  },
@@ -340247,6 +340677,9 @@ var init_contract = __esm(() => {
340247
340677
  {
340248
340678
  const: "heading"
340249
340679
  },
340680
+ {
340681
+ const: "listItem"
340682
+ },
340250
340683
  {
340251
340684
  const: "table"
340252
340685
  },
@@ -342387,6 +342820,9 @@ var init_contract = __esm(() => {
342387
342820
  {
342388
342821
  const: "heading"
342389
342822
  },
342823
+ {
342824
+ const: "listItem"
342825
+ },
342390
342826
  {
342391
342827
  const: "table"
342392
342828
  },
@@ -342822,6 +343258,9 @@ var init_contract = __esm(() => {
342822
343258
  {
342823
343259
  const: "heading"
342824
343260
  },
343261
+ {
343262
+ const: "listItem"
343263
+ },
342825
343264
  {
342826
343265
  const: "table"
342827
343266
  },
@@ -343691,6 +344130,9 @@ var init_contract = __esm(() => {
343691
344130
  {
343692
344131
  const: "heading"
343693
344132
  },
344133
+ {
344134
+ const: "listItem"
344135
+ },
343694
344136
  {
343695
344137
  const: "table"
343696
344138
  },
@@ -344126,6 +344568,9 @@ var init_contract = __esm(() => {
344126
344568
  {
344127
344569
  const: "heading"
344128
344570
  },
344571
+ {
344572
+ const: "listItem"
344573
+ },
344129
344574
  {
344130
344575
  const: "table"
344131
344576
  },
@@ -349142,7 +349587,6 @@ var init_document_rpc = __esm(() => {
349142
349587
 
349143
349588
  // ../../packages/sdk/langs/node/src/runtime/host.ts
349144
349589
  import { spawn } from "node:child_process";
349145
- import { createInterface } from "node:readline";
349146
349590
  function mapCliInvocationResult(operation, value) {
349147
349591
  const envelopeKey = operation.responseEnvelopeKey;
349148
349592
  if (envelopeKey === null || envelopeKey === undefined)
@@ -349191,7 +349635,8 @@ class HostTransport {
349191
349635
  user;
349192
349636
  documentRpcEnabled;
349193
349637
  child = null;
349194
- stdoutReader = null;
349638
+ stdoutBuffer = "";
349639
+ stdoutDataListener = null;
349195
349640
  pending = new Map;
349196
349641
  nextRequestId = 1;
349197
349642
  connecting = null;
@@ -349476,14 +349921,10 @@ class HostTransport {
349476
349921
  stdio: ["pipe", "pipe", "pipe"]
349477
349922
  });
349478
349923
  this.child = child;
349479
- const stdoutReader = createInterface({
349480
- input: child.stdout,
349481
- crlfDelay: Number.POSITIVE_INFINITY
349482
- });
349483
- this.stdoutReader = stdoutReader;
349484
- stdoutReader.on("line", (line) => {
349485
- this.onStdoutLine(line);
349486
- });
349924
+ child.stdout.setEncoding("utf8");
349925
+ const stdoutDataListener = (chunk) => this.onStdoutChunk(chunk);
349926
+ this.stdoutDataListener = stdoutDataListener;
349927
+ child.stdout.on("data", stdoutDataListener);
349487
349928
  child.stderr.on("data", (chunk) => {
349488
349929
  if (!FORWARD_HOST_STDERR) {
349489
349930
  return;
@@ -349724,6 +350165,20 @@ class HostTransport {
349724
350165
  }
349725
350166
  pending.resolve(record3.result);
349726
350167
  }
350168
+ onStdoutChunk(chunk) {
350169
+ this.stdoutBuffer += chunk;
350170
+ let newlineIndex = this.stdoutBuffer.indexOf(`
350171
+ `);
350172
+ while (newlineIndex !== -1) {
350173
+ let line = this.stdoutBuffer.slice(0, newlineIndex);
350174
+ this.stdoutBuffer = this.stdoutBuffer.slice(newlineIndex + 1);
350175
+ if (line.endsWith("\r"))
350176
+ line = line.slice(0, -1);
350177
+ this.onStdoutLine(line);
350178
+ newlineIndex = this.stdoutBuffer.indexOf(`
350179
+ `);
350180
+ }
350181
+ }
349727
350182
  mapJsonRpcError(rawError) {
349728
350183
  if (typeof rawError !== "object" || rawError == null || Array.isArray(rawError)) {
349729
350184
  return new SuperDocCliError("Host returned an unknown JSON-RPC error.", {
@@ -349782,15 +350237,14 @@ class HostTransport {
349782
350237
  this.indeterminateDiscardCloses.clear();
349783
350238
  const child = this.child;
349784
350239
  if (child) {
350240
+ if (this.stdoutDataListener)
350241
+ child.stdout.off("data", this.stdoutDataListener);
349785
350242
  child.removeAllListeners();
349786
350243
  child.kill("SIGKILL");
349787
350244
  }
349788
350245
  this.child = null;
349789
- if (this.stdoutReader) {
349790
- this.stdoutReader.removeAllListeners();
349791
- this.stdoutReader.close();
349792
- this.stdoutReader = null;
349793
- }
350246
+ this.stdoutBuffer = "";
350247
+ this.stdoutDataListener = null;
349794
350248
  const pendingEntries = Array.from(this.pending.values());
349795
350249
  this.pending.clear();
349796
350250
  const rejection = error48 ?? new SuperDocCliError("Host process was disposed while request was in flight.", {
@@ -349815,7 +350269,7 @@ var init_host = __esm(() => {
349815
350269
  });
349816
350270
 
349817
350271
  // ../../packages/sdk/langs/node/src/runtime/sdk-version.generated.ts
349818
- var SDK_VERSION = "2.13.0-next.12";
350272
+ var SDK_VERSION = "2.13.0-next.13";
349819
350273
 
349820
350274
  // ../../packages/sdk/langs/node/src/runtime/embedded-platform.ts
349821
350275
  import { chmodSync, existsSync } from "node:fs";
@@ -389438,8 +389892,8 @@ function evaluateChecks(pre, post, checks4) {
389438
389892
  } else if (check2.kind === "tracked-change-count-delta") {
389439
389893
  results.push({
389440
389894
  check: check2,
389441
- passed: post.trackedChanges.length - pre.trackedChanges.length === check2.delta,
389442
- detail: `pre=${pre.trackedChanges.length} post=${post.trackedChanges.length}`
389895
+ passed: post.counts.trackedChanges - pre.counts.trackedChanges === check2.delta,
389896
+ detail: `pre=${pre.counts.trackedChanges} post=${post.counts.trackedChanges}`
389443
389897
  });
389444
389898
  } else if (check2.kind === "revision-changed") {
389445
389899
  results.push({
@@ -390199,11 +390653,19 @@ async function runDeleteBlocks(doc2, args) {
390199
390653
  const changeMode = parseChangeMode4(args.changeMode);
390200
390654
  const executedOperations = [];
390201
390655
  const deleted = [];
390656
+ const addressedTrackedChangeIds = new Set;
390657
+ let allTrackedEffectsAddressed = true;
390202
390658
  for (const target of targets) {
390203
390659
  try {
390204
390660
  const result = await deleteFn({ target: { kind: "block", nodeType: target.nodeType, nodeId: target.nodeId } }, changeMode ? { changeMode } : undefined);
390205
390661
  executedOperations.push({ operationId: "doc.blocks.delete", result: compactOpResult(result) });
390206
390662
  deleted.push({ nodeId: target.nodeId, nodeType: target.nodeType });
390663
+ if (changeMode === "tracked") {
390664
+ const refIds = trackedChangeRefIds(result);
390665
+ allTrackedEffectsAddressed &&= refIds.size > 0;
390666
+ for (const entityId of refIds)
390667
+ addressedTrackedChangeIds.add(entityId);
390668
+ }
390207
390669
  } catch (err) {
390208
390670
  errors4.push({
390209
390671
  code: "ACTION_FAILED",
@@ -390213,12 +390675,26 @@ async function runDeleteBlocks(doc2, args) {
390213
390675
  }
390214
390676
  }
390215
390677
  const post = await buildMutationSnapshot(doc2, { includeDomains: [...domains] });
390216
- const checks4 = changeMode === "tracked" ? [{ kind: "tracked-change-count-delta", delta: deleted.length }] : [...new Set(deleted.map((entry) => entry.nodeType))].map((nodeType) => ({
390678
+ const observedTrackedChangeDelta = post.counts.trackedChanges - pre.counts.trackedChanges;
390679
+ const expectedTrackedChangeDelta = deleted.length > 1 ? observedTrackedChangeDelta : allTrackedEffectsAddressed ? addressedTrackedChangeIds.size : Math.max(observedTrackedChangeDelta, addressedTrackedChangeIds.size);
390680
+ const checks4 = changeMode === "tracked" ? [
390681
+ {
390682
+ kind: "tracked-change-count-delta",
390683
+ delta: expectedTrackedChangeDelta
390684
+ }
390685
+ ] : [...new Set(deleted.map((entry) => entry.nodeType))].map((nodeType) => ({
390217
390686
  kind: "block-count-delta",
390218
390687
  nodeType,
390219
390688
  delta: -deleted.filter((entry) => entry.nodeType === nodeType).length
390220
390689
  }));
390221
390690
  const verification = evaluateChecks(pre, post, checks4);
390691
+ if (changeMode === "tracked" && observedTrackedChangeDelta <= 0) {
390692
+ verification[0] = {
390693
+ ...verification[0],
390694
+ passed: false,
390695
+ detail: `pre=${pre.counts.trackedChanges} post=${post.counts.trackedChanges}; no tracked review entity was created`
390696
+ };
390697
+ }
390222
390698
  const allApplied = deleted.length === targets.length && errors4.length === 0;
390223
390699
  const verified = verification.every((v) => v.passed);
390224
390700
  return {
@@ -392653,6 +393129,15 @@ function compactOpResult(result) {
392653
393129
  compact.stepCount = result.steps.length;
392654
393130
  return compact;
392655
393131
  }
393132
+ function trackedChangeRefIds(result) {
393133
+ const refs = asRecord2(result)?.trackedChangeRefs;
393134
+ if (!Array.isArray(refs))
393135
+ return new Set;
393136
+ return new Set(refs.flatMap((entry) => {
393137
+ const entityId = asString2(asRecord2(entry)?.entityId);
393138
+ return entityId ? [entityId] : [];
393139
+ }));
393140
+ }
392656
393141
  function parseScopedReplaceArgs(args, changeMode) {
392657
393142
  if (args.action !== "replace_text")
392658
393143
  return null;
@@ -397656,6 +398141,7 @@ var init_address = __esm(() => {
397656
398141
  SELECTION_EDGE_NODE_TYPES = [
397657
398142
  "paragraph",
397658
398143
  "heading",
398144
+ "listItem",
397659
398145
  "table",
397660
398146
  "tableOfContents",
397661
398147
  "sdt",
@@ -408939,7 +409425,7 @@ var init_schemas4 = __esm(() => {
408939
409425
  type: "array",
408940
409426
  items: objectSchema2({
408941
409427
  id: { type: "string" },
408942
- type: { enum: ["insertion", "deletion", "replacement"] },
409428
+ type: { enum: [...trackChangeBroadTypeEnum] },
408943
409429
  subtype: { type: "string" },
408944
409430
  sourceIds: trackChangeSourceIdsSchema
408945
409431
  }, ["id", "type", "subtype", "sourceIds"])
@@ -469970,10 +470456,13 @@ function buildTextRewriteReviewGroupId(storyId, origin, noteId) {
469970
470456
  function projectRewriteGroups(input) {
469971
470457
  const groups = new Map;
469972
470458
  for (const entry of input.byId.values()) {
469973
- if (entry.reviewGroup || entry.fragments.length === 0 || !["insertion", "deletion", "replacement"].includes(entry.type))
470459
+ if (entry.reviewGroup)
469974
470460
  continue;
469975
- const origin = readRewriteGroupId(entry.fragments[0]);
469976
- if (!origin || entry.fragments.some((fragment2) => readRewriteGroupId(fragment2) !== origin))
470461
+ const carriers = ["insertion", "deletion", "replacement"].includes(entry.type) ? entry.fragments : entry.type === "structural" && (entry.subtype === "footnote-deletion" || entry.subtype === "endnote-deletion") ? entry.structuralFragments : [];
470462
+ if (carriers.length === 0)
470463
+ continue;
470464
+ const origin = readRewriteGroupId(carriers[0]);
470465
+ if (!origin || carriers.some((carrier) => readRewriteGroupId(carrier) !== origin))
469977
470466
  continue;
469978
470467
  const id = buildTextRewriteReviewGroupId(entry.storyId, origin, entry.noteId);
469979
470468
  const members = groups.get(id) ?? [];
@@ -469985,13 +470474,15 @@ function projectRewriteGroups(input) {
469985
470474
  const first = children[0];
469986
470475
  const display = children.some((child) => child.fragments.some((fragment2) => fragment2.customAttributes?.some((attribute) => attribute.namespaceUri === REWRITE_NAMESPACE && attribute.localName === "display" && attribute.value === "children"))) ? { display: "children" } : {};
469987
470476
  const fragments = children.flatMap((child) => child.fragments).sort((a, b) => a.byteStart - b.byteStart);
470477
+ const structuralFragments = children.flatMap((child) => child.structuralFragments).sort((a, b) => a.byteStart - b.byteStart);
469988
470478
  const inserted = fragments.filter((fragment2) => fragment2.kind === "ins");
469989
470479
  const deleted = fragments.filter((fragment2) => fragment2.kind === "del");
469990
- const type = inserted.length === 0 ? "deletion" : deleted.length === 0 ? "insertion" : "replacement";
470480
+ const hasStructuralDeletion = children.some((child) => child.type === "structural" && (child.subtype === "footnote-deletion" || child.subtype === "endnote-deletion"));
470481
+ const type = inserted.length === 0 ? "deletion" : deleted.length === 0 && !hasStructuralDeletion ? "insertion" : "replacement";
469991
470482
  const wordIdInsert = inserted.find((fragment2) => fragment2.wId)?.wId;
469992
- const wordIdDelete = deleted.find((fragment2) => fragment2.wId)?.wId;
470483
+ const wordIdDelete = deleted.find((fragment2) => fragment2.wId)?.wId ?? children.find((child) => child.sourceIds.wordIdDelete)?.sourceIds.wordIdDelete;
469993
470484
  const rsids = [
469994
- ...new Set(fragments.map((fragment2) => fragment2.rsid).filter((value) => Boolean(value)))
470485
+ ...new Set(children.flatMap((child) => child.sourceIds.rsids))
469995
470486
  ];
469996
470487
  const parent = {
469997
470488
  ...first,
@@ -470010,11 +470501,16 @@ function projectRewriteGroups(input) {
470010
470501
  wordIdInsert,
470011
470502
  wordIdDelete,
470012
470503
  wordIdOther: [
470013
- ...new Set(fragments.map((fragment2) => fragment2.wId).filter((value) => Boolean(value) && value !== wordIdInsert && value !== wordIdDelete))
470504
+ ...new Set(children.flatMap((child) => [
470505
+ ...child.sourceIds.wordIdOther,
470506
+ ...child.sourceIds.wordIdInsert ? [child.sourceIds.wordIdInsert] : [],
470507
+ ...child.sourceIds.wordIdDelete ? [child.sourceIds.wordIdDelete] : []
470508
+ ]).filter((value) => Boolean(value) && value !== wordIdInsert && value !== wordIdDelete))
470014
470509
  ],
470015
470510
  rsids
470016
470511
  },
470017
470512
  fragments,
470513
+ structuralFragments,
470018
470514
  reviewGroup: {
470019
470515
  kind: "text-rewrite",
470020
470516
  ...display,
@@ -470022,17 +470518,31 @@ function projectRewriteGroups(input) {
470022
470518
  parentId: null,
470023
470519
  ownedChildIds: children.map((child) => child.id),
470024
470520
  duplicateDisplayPolicy: "subsumed",
470025
- members: children.flatMap((child) => child.fragments.map((fragment2) => ({
470026
- logicalId: child.id,
470027
- carrier: "text",
470028
- partUri: fragment2.partUri,
470029
- storyId: fragment2.storyId,
470030
- rsid: fragment2.rsid,
470031
- wordId: fragment2.wId,
470032
- subtype: child.subtype,
470033
- byteStart: fragment2.byteStart,
470034
- byteEnd: fragment2.byteEnd
470035
- })))
470521
+ members: children.flatMap((child) => [
470522
+ ...child.fragments.map((fragment2) => ({
470523
+ logicalId: child.id,
470524
+ carrier: "text",
470525
+ partUri: fragment2.partUri,
470526
+ storyId: fragment2.storyId,
470527
+ rsid: fragment2.rsid,
470528
+ wordId: fragment2.wId,
470529
+ subtype: child.subtype,
470530
+ byteStart: fragment2.byteStart,
470531
+ byteEnd: fragment2.byteEnd
470532
+ })),
470533
+ ...child.structuralFragments.map((fragment2) => ({
470534
+ logicalId: child.id,
470535
+ carrier: "structural",
470536
+ partUri: fragment2.partUri,
470537
+ storyId: fragment2.storyId,
470538
+ rsid: fragment2.rsid,
470539
+ entityKey: fragment2.entityKey,
470540
+ wordId: fragment2.wId,
470541
+ subtype: child.subtype,
470542
+ byteStart: fragment2.byteStart,
470543
+ byteEnd: fragment2.byteEnd
470544
+ }))
470545
+ ])
470036
470546
  }
470037
470547
  };
470038
470548
  for (const child of children)
@@ -488928,9 +489438,10 @@ function isBreakRunToken(token) {
488928
489438
  return token.kind === "unsupported" && token.inertBreakRun !== undefined;
488929
489439
  }
488930
489440
  function compileOverlapEdit(input) {
488931
- const readsComplexDeletionForCollapsedInsert = input.newText.length > 0 && input.rangeStart === input.rangeEnd && ((input.coordinateSpace ?? "visible") === "visible" || input.changeMode === "tracked");
488932
- const readsComplexDeletions = (input.changeMode === "direct" || input.newText.length === 0) && input.rangeStart < input.rangeEnd || readsComplexDeletionForCollapsedInsert;
488933
489441
  const paragraphInlineMap = input.paragraphInlineMap ?? parseParagraphInlineMap(input.paragraphXml, input.namespaceBindings);
489442
+ const readsComplexDeletionForCollapsedInsert = input.newText.length > 0 && input.rangeStart === input.rangeEnd && ((input.coordinateSpace ?? "visible") === "visible" || input.changeMode === "tracked");
489443
+ const readsStructuralDeletionForReplacement = input.changeMode === "tracked" && input.newText.length > 0 && input.rangeStart < input.rangeEnd && paragraphInlineMap.pieces.some((piece) => piece.kind === "tracked" && piece.trackedKind === "del" && piece.visibleStart === piece.visibleEnd && input.rangeStart < piece.visibleStart && input.rangeEnd > piece.visibleEnd && piece.children.some(isSupportedStructuralDeletionChild));
489444
+ const readsComplexDeletions = (input.changeMode === "direct" || input.newText.length === 0) && input.rangeStart < input.rangeEnd || readsComplexDeletionForCollapsedInsert || readsStructuralDeletionForReplacement;
488934
489445
  if (input.newText.length > 0 && input.rangeStart === input.rangeEnd && hasNonWordMarkerAtCollapsedMoveBoundary(paragraphInlineMap.pieces, input.rangeStart, input.coordinateSpace ?? "visible")) {
488935
489446
  return {
488936
489447
  ok: false,
@@ -488938,7 +489449,7 @@ function compileOverlapEdit(input) {
488938
489449
  detail: "overlap compiler: foreign marker at a move boundary."
488939
489450
  };
488940
489451
  }
488941
- const parsed = tokenizeParagraph(input.paragraphXml, input.coordinateSpace ?? "visible", input.namespaceBindings, readsComplexDeletions, input.rangeStart, input.rangeEnd, paragraphInlineMap, input.changeMode === "tracked", true);
489452
+ const parsed = tokenizeParagraph(input.paragraphXml, input.coordinateSpace ?? "visible", input.namespaceBindings, readsComplexDeletions, input.rangeStart, input.rangeEnd, paragraphInlineMap, input.changeMode === "tracked", true, readsStructuralDeletionForReplacement);
488942
489453
  if (!parsed.ok)
488943
489454
  return parsed;
488944
489455
  const result = compileParsedOverlapEdit(input, parsed.tokens, parsed.descendedEditableContainers);
@@ -490788,7 +491299,7 @@ function buildAttrChain(params, prefix) {
490788
491299
  out += ` ${prefix}:rsidDel="${escapeXmlAttribute(params.rsidDel)}"`;
490789
491300
  return out;
490790
491301
  }
490791
- function tokenizeParagraph(paragraphXml, coordinateSpace, inheritedNamespaceBindings = {}, allowComplexDeletions = false, rangeStart = 0, rangeEnd = 0, preparedMap, allowTrackedCoordinateEditableTextContainers = false, validateRangeExtent = false) {
491302
+ function tokenizeParagraph(paragraphXml, coordinateSpace, inheritedNamespaceBindings = {}, allowComplexDeletions = false, rangeStart = 0, rangeEnd = 0, preparedMap, allowTrackedCoordinateEditableTextContainers = false, validateRangeExtent = false, allowStructuralDeletionPassThrough = false) {
490792
491303
  const paragraph = findRawXmlElementRangeAt(paragraphXml, 0, NS_W3, "p", {
490793
491304
  w: NS_W3,
490794
491305
  ...inheritedNamespaceBindings
@@ -490835,7 +491346,7 @@ function tokenizeParagraph(paragraphXml, coordinateSpace, inheritedNamespaceBind
490835
491346
  continue;
490836
491347
  }
490837
491348
  if (piece.kind === "tracked") {
490838
- tokens.push(trackedToken(piece, spanStart, spanEnd, allowComplexDeletions));
491349
+ tokens.push(trackedToken(piece, spanStart, spanEnd, allowComplexDeletions, allowStructuralDeletionPassThrough));
490839
491350
  i2 += 1;
490840
491351
  continue;
490841
491352
  }
@@ -490955,7 +491466,26 @@ function runToken(leaves, runCharStart, runCharEnd, enclosesForeign, spanStart,
490955
491466
  ...inertBreakRun ? { inertBreakRun } : {}
490956
491467
  };
490957
491468
  }
490958
- function trackedToken(piece, spanStart, spanEnd, allowComplexDeletions) {
491469
+ function isSupportedStructuralDeletionChild(piece) {
491470
+ if (piece.kind === "noteReference")
491471
+ return true;
491472
+ if (piece.kind !== "container")
491473
+ return false;
491474
+ if (piece.containerKind === "complexField") {
491475
+ return piece.resultCharStart != null && piece.resultCharEnd != null && !piece.children.some((child) => child.kind === "container" || child.kind === "control" || child.kind === "unknown");
491476
+ }
491477
+ if (piece.namespaceBindings.get(piece.prefix ?? "") !== NS_W3)
491478
+ return false;
491479
+ if (piece.containerKind === "fldSimple") {
491480
+ return !piece.children.some((child) => child.kind === "container" || child.kind === "control" || child.kind === "unknown");
491481
+ }
491482
+ if (piece.containerKind === "sdt") {
491483
+ const policy = classifySdtMutationPolicy(piece);
491484
+ return policy.ok && policy.contentEditable && !piece.children.some((child) => child.kind === "container" || child.kind === "control" || child.kind === "unknown");
491485
+ }
491486
+ return piece.containerKind === "unknown" && (piece.localName === "smartTag" || piece.localName === "dir" || piece.localName === "bdo");
491487
+ }
491488
+ function trackedToken(piece, spanStart, spanEnd, allowComplexDeletions, allowStructuralDeletionPassThrough) {
490959
491489
  const visibleStart = spanStart(piece);
490960
491490
  const visibleEnd = spanEnd(piece);
490961
491491
  const unsupported2 = (reason, detail) => ({
@@ -490995,7 +491525,7 @@ function trackedToken(piece, spanStart, spanEnd, allowComplexDeletions) {
490995
491525
  })).sort((a, b) => a.localOffset - b.localOffset);
490996
491526
  }
490997
491527
  if (allowComplexDeletions && piece.trackedKind === "del") {
490998
- const unsupportedChild = piece.children.find((child) => child.kind !== "text" && !(child.kind === "marker" && isCommentMarker2(child.markerKind)));
491528
+ const unsupportedChild = piece.children.find((child) => child.kind !== "text" && !(child.kind === "marker" && isCommentMarker2(child.markerKind)) && !(allowStructuralDeletionPassThrough && isSupportedStructuralDeletionChild(child)));
490999
491529
  if (unsupportedChild) {
491000
491530
  return unsupported2(unsupportedChild.kind === "control" ? "text-payload-unsupported-control-char" : "text-range-in-unsupported-tracked-wrapper", `overlap compiler: unsupported payload inside w:${piece.trackedKind}`);
491001
491531
  }
@@ -491017,7 +491547,7 @@ function trackedToken(piece, spanStart, spanEnd, allowComplexDeletions) {
491017
491547
  text: leaves.map((leaf) => leaf.decodedText).join("")
491018
491548
  };
491019
491549
  });
491020
- const hasCommentAnchors = piece.children.some((child) => child.kind === "marker");
491550
+ const hasUnrepresentedChildren = piece.children.some((child) => child.kind !== "text");
491021
491551
  const runIdentityOf = (leaf) => `${leaf.runOpenTag}\x00${leaf.runProperties ?? ""}\x00${leaf.runCloseTag}`;
491022
491552
  const firstRunIdentity = runIdentityOf(firstText);
491023
491553
  const hasMixedRunProperties = textLeaves2.some((leaf) => runIdentityOf(leaf) !== firstRunIdentity);
@@ -491042,7 +491572,7 @@ function trackedToken(piece, spanStart, spanEnd, allowComplexDeletions) {
491042
491572
  wId: piece.revisionId ?? "",
491043
491573
  rsidDel: decodeNamespacedAttr(openTag2, piece.namespaceBindings, "rsidDel") ?? "",
491044
491574
  sourceIdentity: revisionSourceIdentity(piece, openTag2),
491045
- payloadHasUnrepresentedChildren: hasCommentAnchors,
491575
+ payloadHasUnrepresentedChildren: hasUnrepresentedChildren,
491046
491576
  payloadHasMixedRunProperties: hasMixedRunProperties,
491047
491577
  payloadRunCount: sourceRunCount,
491048
491578
  payloadTextLeafCount: textLeaves2.length,
@@ -492323,6 +492853,7 @@ function runTrackedEditTextBatchCommit(input, edits) {
492323
492853
  const preconditions = [];
492324
492854
  const targetBlockIds = [];
492325
492855
  const shifts = [];
492856
+ let requiresCollaborationSessionSync = false;
492326
492857
  for (const [blockId, blockEdits] of byBlock) {
492327
492858
  const paragraph = index.byParaId(blockId);
492328
492859
  if (!paragraph || index.duplicateParaIds.has(blockId) || paragraph.partUri !== partUri || paragraph.partRevision !== first.on.partRevision || paragraph.storyRevision !== first.on.storyRevision || isParagraphInsideContentLockedBlockSdt(state, { storyId, partUri, blockId })) {
@@ -492394,6 +492925,7 @@ function runTrackedEditTextBatchCommit(input, edits) {
492394
492925
  });
492395
492926
  if (localized?.ok && !(edit.preserveExistingRevisions && localized.foldedInsRsid)) {
492396
492927
  afterBytes = localized.bytes;
492928
+ requiresCollaborationSessionSync || (requiresCollaborationSessionSync = localized.requiresCollaborationSessionSync === true);
492397
492929
  if (localized.foldedInsRsid) {
492398
492930
  emittedByEdit.set(edit, []);
492399
492931
  updatedByEdit.set(edit, [localized.foldedInsRsid]);
@@ -492419,7 +492951,7 @@ function runTrackedEditTextBatchCommit(input, edits) {
492419
492951
  }
492420
492952
  continue;
492421
492953
  }
492422
- if (localized && !localized.ok && localized.reason !== "text-range-in-unsupported-tracked-wrapper") {
492954
+ if (localized && !localized.ok && localized.reason !== "text-range-in-unsupported-tracked-wrapper" && localized.reason !== "text-range-in-field") {
492423
492955
  return rejected2(txId, localized.reason);
492424
492956
  }
492425
492957
  const overlap = tryOverlapRewriteTracked({ ...input, op: batchOp }, afterBytes, paragraphWindow, paragraph.byteStart, {
@@ -492432,6 +492964,7 @@ function runTrackedEditTextBatchCommit(input, edits) {
492432
492964
  if (!overlap.ok)
492433
492965
  return rejected2(txId, overlap.reason);
492434
492966
  afterBytes = overlap.bytes;
492967
+ requiresCollaborationSessionSync || (requiresCollaborationSessionSync = overlap.requiresCollaborationSessionSync === true);
492435
492968
  emittedByEdit.set(edit, overlap.emittedRsids);
492436
492969
  updatedByEdit.set(edit, overlap.updatedRsids);
492437
492970
  for (const rsid of overlap.updatedRsids)
@@ -492579,6 +493112,7 @@ function runTrackedEditTextBatchCommit(input, edits) {
492579
493112
  targetBlockIds,
492580
493113
  atomCarrierContract: SD_DEFAULT_ATOM_CARRIER_CONTRACT,
492581
493114
  resyncFromSession: true,
493115
+ ...requiresCollaborationSessionSync ? { sessionSync: { reason: "structural-inline-edit" } } : {},
492582
493116
  ...trackedAnnotations.length > 0 ? { trackedTextAnnotations: trackedAnnotations } : {},
492583
493117
  ...trackedTextEditOutcomes.length > 0 ? { trackedTextEditOutcomes } : {},
492584
493118
  ...resolvedInsertionRevisions.length > 0 ? {
@@ -496099,6 +496633,7 @@ function parsePlainRun(runXml, textStart, byteStart, byteEnd, options = {}) {
496099
496633
  childRe.lastIndex = runOpen.length;
496100
496634
  let tMatch = null;
496101
496635
  let controlKind = null;
496636
+ let controlXml = null;
496102
496637
  let leadingTransparentXml = "";
496103
496638
  let trailingTransparentXml = "";
496104
496639
  while (true) {
@@ -496171,6 +496706,7 @@ function parsePlainRun(runXml, textStart, byteStart, byteEnd, options = {}) {
496171
496706
  if (tMatch || controlKind)
496172
496707
  return fail4("invalid-range");
496173
496708
  controlKind = local;
496709
+ controlXml = m[0];
496174
496710
  continue;
496175
496711
  }
496176
496712
  if (local === "drawing" || local === "pict" || local === "object") {
@@ -496194,6 +496730,7 @@ function parsePlainRun(runXml, textStart, byteStart, byteEnd, options = {}) {
496194
496730
  xml: runXml,
496195
496731
  kind: "control",
496196
496732
  controlKind,
496733
+ ...controlXml ? { controlXml } : {},
496197
496734
  textStart,
496198
496735
  textEnd: textStart + 1,
496199
496736
  text: INLINE_CONTROL_PLACEHOLDER,
@@ -496547,6 +497084,8 @@ function rewriteRunSpanTrackedReplacePreservingMarkers(paragraphXml, span, stamp
496547
497084
  let emittedDelete = false;
496548
497085
  for (let i2 = span.firstRunIdx;i2 <= span.lastRunIdx; i2 += 1) {
496549
497086
  const run = span.runs[i2];
497087
+ if (run.kind === "control" && run.controlKind == null)
497088
+ continue;
496550
497089
  const start = i2 === span.firstRunIdx ? span.startInFirstRun : 0;
496551
497090
  const end = i2 === span.lastRunIdx ? span.endInLastRun : run.text.length;
496552
497091
  if (start === end)
@@ -496576,6 +497115,38 @@ function rewriteRunSpanTrackedReplacePreservingMarkers(paragraphXml, span, stamp
496576
497115
  inserted || (inserted = wrappedInsert.length > 0);
496577
497116
  emittedDelete || (emittedDelete = wrappedDelete.length > 0);
496578
497117
  }
497118
+ const model = parseParagraphInlineMap(paragraphXml);
497119
+ const leaves = model.leaves();
497120
+ const paragraphBytes = TE16.encode(paragraphXml);
497121
+ const charOffsetAtByte = (byteOffset) => TD38.decode(paragraphBytes.subarray(0, byteOffset)).length;
497122
+ for (const piece of model.pieces) {
497123
+ const selected = piece.visibleEnd > piece.visibleStart && span.runs[span.firstRunIdx].textStart + span.startInFirstRun <= piece.visibleStart && span.runs[span.lastRunIdx].textStart + span.endInLastRun >= piece.visibleEnd;
497124
+ if (!selected)
497125
+ continue;
497126
+ let start;
497127
+ let end;
497128
+ let inner;
497129
+ if (piece.kind === "noteReference" && !piece.deleted) {
497130
+ const runLeaves = leaves.filter((leaf) => ("runByteStart" in leaf) && leaf.runByteStart === piece.runByteStart && leaf.runByteEnd === piece.runByteEnd);
497131
+ if (runLeaves.length !== 1 || runLeaves[0] !== piece)
497132
+ continue;
497133
+ start = charOffsetAtByte(piece.runByteStart);
497134
+ end = charOffsetAtByte(piece.runByteEnd);
497135
+ inner = paragraphXml.slice(start, end);
497136
+ } else if (piece.kind === "container" && piece.containerKind === "unknown" && piece.namespaceBindings.get(piece.prefix ?? "") === NS_W && (piece.localName === "smartTag" || piece.localName === "dir" || piece.localName === "bdo") && !piece.containerStack.some((scope) => scope.deleted)) {
497137
+ start = piece.charStart;
497138
+ end = piece.charEnd;
497139
+ inner = piece.rawXml;
497140
+ } else {
497141
+ continue;
497142
+ }
497143
+ ops.push({
497144
+ start,
497145
+ end,
497146
+ xml: buildDeletedContentWrapper(inner, inner, delStamp)
497147
+ });
497148
+ emittedDelete = true;
497149
+ }
496579
497150
  ops.sort((a, b) => b.start - a.start);
496580
497151
  let xml = paragraphXml;
496581
497152
  for (const op of ops) {
@@ -497069,7 +497640,7 @@ function buildDeletedRunXmlFromRunSpan(span) {
497069
497640
  for (let i2 = span.firstRunIdx;i2 <= span.lastRunIdx; i2 += 1) {
497070
497641
  const run = span.runs[i2];
497071
497642
  if (run.kind === "control") {
497072
- const control = `<${wordTextName(run.runOpen, run.controlKind ?? "br")}/>`;
497643
+ const control = run.controlXml ?? `<${wordTextName(run.runOpen, run.controlKind ?? "br")}/>`;
497073
497644
  inner += `${run.runOpen}${run.rPr}${control}${run.runClose}`;
497074
497645
  continue;
497075
497646
  }
@@ -508458,6 +509029,7 @@ function runParagraphDeleteCommit(input) {
508458
509029
  if (!trackedStamp)
508459
509030
  return rejected8(input.txId, "no-author-configured");
508460
509031
  let trackedXml = paraXml;
509032
+ const paragraphMarkCreatedRefs = [];
508461
509033
  if (target.entry.textLength > 0) {
508462
509034
  const wrapped = wrapParagraphTextSpanTrackedDelete(paraXml, 0, target.entry.textLength, { rsid: trackedStamp.rsid, author: trackedStamp.author, date: trackedStamp.date }, input.state);
508463
509035
  if (!wrapped.ok)
@@ -508465,7 +509037,11 @@ function runParagraphDeleteCommit(input) {
508465
509037
  trackedXml = wrapped.xml;
508466
509038
  }
508467
509039
  if (successor) {
508468
- trackedXml = injectParagraphMarkTrackedMarker(trackedXml, "del", trackedStamp);
509040
+ trackedXml = injectParagraphMarkTrackedMarker(trackedXml, "del", trackedStamp, target.entry.textLength === 0 || structural.hasSectPr ? (entityId) => paragraphMarkCreatedRefs.push({
509041
+ kind: "trackedChange",
509042
+ entityId,
509043
+ storyId: op.target.storyId
509044
+ }) : undefined);
508469
509045
  }
508470
509046
  const patch = {
508471
509047
  kind: "replaceBytes",
@@ -508482,11 +509058,12 @@ function runParagraphDeleteCommit(input) {
508482
509058
  patches: [patch],
508483
509059
  textRangeShifts: [],
508484
509060
  createdRefs: [
508485
- {
509061
+ ...target.entry.textLength > 0 ? [{
508486
509062
  kind: "trackedChange",
508487
509063
  entityId: trackedStamp.rsid,
508488
509064
  storyId: op.target.storyId
508489
- }
509065
+ }] : [],
509066
+ ...paragraphMarkCreatedRefs
508490
509067
  ],
508491
509068
  invalidatedRefs: [],
508492
509069
  updatedRefs: [{ kind: "block", nodeId: op.target.paraId, storyId: op.target.storyId }],
@@ -510049,7 +510626,7 @@ function topLevelMarkRPrSpan2(pPrXml) {
510049
510626
  return null;
510050
510627
  return { start: openOffset, end: openOffset + span.length };
510051
510628
  }
510052
- function injectParagraphMarkTrackedMarker(paraXml, kind, stamp) {
510629
+ function injectParagraphMarkTrackedMarker(paraXml, kind, stamp, collectCreatedRef) {
510053
510630
  const openTag = matchParagraphOpenTag(paraXml);
510054
510631
  const closeMatch = paraXml.match(/<\/([\w.-]+):p>\s*$/);
510055
510632
  if (!openTag || !closeMatch)
@@ -510058,6 +510635,7 @@ function injectParagraphMarkTrackedMarker(paraXml, kind, stamp) {
510058
510635
  const closeTag = closeMatch[0];
510059
510636
  const inner = paraXml.slice(openTag.length, paraXml.length - closeTag.length);
510060
510637
  const marker = buildParagraphMarkTrackedMarker(prefix, kind, stamp);
510638
+ collectCreatedRef?.(String(stamp.wId));
510061
510639
  const pPrXml = matchLeadingElement(inner, "pPr");
510062
510640
  if (!pPrXml) {
510063
510641
  return `${openTag}<${prefix}:pPr><${prefix}:rPr>${marker}</${prefix}:rPr></${prefix}:pPr>${inner}${closeTag}`;
@@ -542787,6 +543365,7 @@ var init_address2 = __esm(() => {
542787
543365
  SELECTION_EDGE_NODE_TYPES2 = [
542788
543366
  "paragraph",
542789
543367
  "heading",
543368
+ "listItem",
542790
543369
  "table",
542791
543370
  "tableOfContents",
542792
543371
  "sdt",
@@ -552632,7 +553211,7 @@ var init_schemas5 = __esm(() => {
552632
553211
  type: "array",
552633
553212
  items: objectSchema4({
552634
553213
  id: { type: "string" },
552635
- type: { enum: ["insertion", "deletion", "replacement"] },
553214
+ type: { enum: [...trackChangeBroadTypeEnum2] },
552636
553215
  subtype: { type: "string" },
552637
553216
  sourceIds: trackChangeSourceIdsSchema2
552638
553217
  }, ["id", "type", "subtype", "sourceIds"])
@@ -581118,6 +581697,47 @@ function planTextReplacement(before, after) {
581118
581697
  return spans;
581119
581698
  }
581120
581699
 
581700
+ // ../../../v2/document-api-v2-adapter/dist/selection-mutation/structural-rewrite-span.js
581701
+ function planTrackedRewriteReplacement(before, after, scope) {
581702
+ const precise = planTextReplacement(before, after);
581703
+ if (!scope || precise.length <= 1)
581704
+ return precise;
581705
+ const boundary = narrowTextReplacement(before, after);
581706
+ if (!boundary)
581707
+ return [];
581708
+ const start = scope.startOffset + boundary.start;
581709
+ const end = scope.startOffset + boundary.end;
581710
+ return rewriteRangeContainsCoupledStructure(scope.paragraphXml, start, end, scope.coordinateSpace ?? "visible") ? [boundary] : precise;
581711
+ }
581712
+ function rewriteRangeContainsCoupledStructure(paragraphXml, start, end, coordinateSpace) {
581713
+ const model = parseParagraphInlineMap(paragraphXml);
581714
+ const span = (piece) => coordinateSpace === "tracked" ? [piece.trackedStart, piece.trackedEnd] : [piece.visibleStart, piece.visibleEnd];
581715
+ const fullyContains = (piece) => {
581716
+ const [pieceStart2, pieceEnd2] = span(piece);
581717
+ return pieceStart2 === pieceEnd2 ? start < pieceStart2 && end > pieceEnd2 : start <= pieceStart2 && end >= pieceEnd2;
581718
+ };
581719
+ const visit = (pieces) => {
581720
+ for (const piece of pieces) {
581721
+ if ((piece.kind === "marker" || piece.kind === "noteReference") && fullyContains(piece))
581722
+ return true;
581723
+ if (piece.kind === "container") {
581724
+ const supportedOpaqueWrapper = piece.containerKind === "unknown" && (piece.localName === "smartTag" || piece.localName === "dir" || piece.localName === "bdo");
581725
+ if (fullyContains(piece) && (piece.containerKind === "sdt" || piece.containerKind === "fldSimple" || piece.containerKind === "complexField" || supportedOpaqueWrapper))
581726
+ return true;
581727
+ if (visit(piece.children))
581728
+ return true;
581729
+ } else if (piece.kind === "tracked" && visit(piece.children)) {
581730
+ return true;
581731
+ }
581732
+ }
581733
+ return false;
581734
+ };
581735
+ return visit(model.pieces);
581736
+ }
581737
+ var init_structural_rewrite_span = __esm(() => {
581738
+ init_sd_document_session_internal();
581739
+ });
581740
+
581121
581741
  // ../../../v2/document-api-v2-adapter/dist/ranges/adapter.js
581122
581742
  class V2RangesAdapter {
581123
581743
  constructor(context) {
@@ -582289,10 +582909,24 @@ class V2SelectionMutationAdapter {
582289
582909
  const planned = [];
582290
582910
  for (const [editIndex, edit] of edits.entries()) {
582291
582911
  const { on, newText, resolution } = edit;
582292
- const spans = on.coordinateSpace !== "tracked" && resolution.text.length === on.endOffset - on.startOffset && isPlannableTextPayload(newText) ? planTextReplacement(resolution.text, newText) : [{ start: 0, end: on.endOffset - on.startOffset, text: newText }];
582912
+ let spans = on.coordinateSpace !== "tracked" && resolution.text.length === on.endOffset - on.startOffset && isPlannableTextPayload(newText) ? planTrackedRewriteReplacement(resolution.text, newText) : [{ start: 0, end: on.endOffset - on.startOffset, text: newText }];
582293
582913
  const index = isMainStoryId(on.storyId) ? getSDDocumentSessionInternalParagraphIndex(this.context.session) : getSDDocumentSessionInternalStoryParagraphIndex(this.context.session, on.storyId);
582294
582914
  if (!index)
582295
582915
  return { success: false, failure: { code: "TARGET_NOT_FOUND", message: "rewrite paragraph index unavailable" }, resolution };
582916
+ let structuralRewrite = false;
582917
+ if (options?.changeMode === "tracked" && edit.rewriteIntent === true && spans.length > 1) {
582918
+ const paragraph2 = index.byParaId(on.startBlockId);
582919
+ const paragraphBytes = paragraph2 ? getSDDocumentSessionInternalPartRange(this.context.session, paragraph2.partUri, paragraph2.byteStart, paragraph2.byteEnd) : null;
582920
+ if (paragraphBytes) {
582921
+ const scopedSpans = planTrackedRewriteReplacement(resolution.text, newText, {
582922
+ paragraphXml: TD79.decode(paragraphBytes),
582923
+ startOffset: on.startOffset,
582924
+ ...on.coordinateSpace ? { coordinateSpace: on.coordinateSpace } : {}
582925
+ });
582926
+ structuralRewrite = scopedSpans.length === 1 && spans.length > 1;
582927
+ spans = scopedSpans;
582928
+ }
582929
+ }
582296
582930
  const preparedKey = `${on.storyId}:${on.startBlockId}:${on.coordinateSpace ?? "visible"}`;
582297
582931
  const prepared = preparedByBlock.get(preparedKey) ?? prepareSelectionTargetResolution({
582298
582932
  target: {
@@ -582315,7 +582949,7 @@ class V2SelectionMutationAdapter {
582315
582949
  return { success: false, failure: { code: narrowed.error, message: narrowed.message }, resolution };
582316
582950
  if (narrowed.paintedObjectContained)
582317
582951
  return { success: false, failure: { code: "INVALID_CONTEXT", message: "rewrite contains an inline object" }, resolution };
582318
- planned.push({ on: narrowed, newText: span.text, resolution: { ...resolution, text: resolution.text.slice(span.start, span.end) }, resultKey: String(editIndex), owner: edit.ownerStepId ?? "", rewriteIntent: edit.rewriteIntent === true });
582952
+ planned.push({ on: narrowed, newText: span.text, resolution: { ...resolution, text: resolution.text.slice(span.start, span.end) }, resultKey: String(editIndex), owner: edit.ownerStepId ?? "", rewriteIntent: edit.rewriteIntent === true, structuralRewrite });
582319
582953
  }
582320
582954
  }
582321
582955
  if (planned.length === 0)
@@ -582329,9 +582963,12 @@ class V2SelectionMutationAdapter {
582329
582963
  const retiredFieldIds = [];
582330
582964
  const independentTracked = options?.changeMode === "tracked" && this.context.trackedChangesReplacementMode === "independent";
582331
582965
  let trackedFieldDeletion = false;
582332
- const kernelEdits = planned.map(({ on, newText, resolution, resultKey, owner, rewriteIntent }, index) => {
582966
+ const kernelEdits = planned.map(({ on, newText, resolution, resultKey, owner, rewriteIntent, structuralRewrite }, index) => {
582333
582967
  const stamps = {
582334
- ...options?.changeMode === "tracked" && rewriteIntent ? { rewriteGroupId: ownerIds.get(owner), preserveExistingRevisions: true } : {},
582968
+ ...options?.changeMode === "tracked" && rewriteIntent ? {
582969
+ rewriteGroupId: ownerIds.get(owner),
582970
+ ...!structuralRewrite ? { preserveExistingRevisions: true } : {}
582971
+ } : {},
582335
582972
  ...independentTracked && on.startOffset < on.endOffset && newText.length > 0 ? {
582336
582973
  rsid: deriveRsid(`${begun.tx.txId}:${index}`, "del"),
582337
582974
  insRsid: deriveRsid(`${begun.tx.txId}:${index}`, "ins")
@@ -582621,7 +583258,20 @@ class V2SelectionMutationAdapter {
582621
583258
  resolved
582622
583259
  });
582623
583260
  const buildResolutionMs = nowMs6() - buildResolutionStartedAt;
582624
- let replacements = resolved.coordinateSpace !== "tracked" && resolved.startOffset < resolved.endOffset && selectedText.length === resolved.endOffset - resolved.startOffset && isPlannableTextPayload(request.text) ? planTextReplacement(selectedText, request.text) : [{ start: 0, end: resolved.endOffset - resolved.startOffset, text: request.text }];
583261
+ let replacements = resolved.coordinateSpace !== "tracked" && resolved.startOffset < resolved.endOffset && selectedText.length === resolved.endOffset - resolved.startOffset && isPlannableTextPayload(request.text) ? planTrackedRewriteReplacement(selectedText, request.text) : [{ start: 0, end: resolved.endOffset - resolved.startOffset, text: request.text }];
583262
+ let structuralRewrite = false;
583263
+ if (options?.changeMode === "tracked" && isRewrite && replacements.length > 1) {
583264
+ const paragraphBytes = getSDDocumentSessionInternalPartRange(this.context.session, resolved.partUri, resolved.paragraphByteStart ?? resolved.startByte, resolved.paragraphByteEnd ?? resolved.endByte);
583265
+ if (paragraphBytes) {
583266
+ const scopedReplacements = planTrackedRewriteReplacement(selectedText, request.text, {
583267
+ paragraphXml: TD79.decode(paragraphBytes),
583268
+ startOffset: resolved.startOffset,
583269
+ ...resolved.coordinateSpace ? { coordinateSpace: resolved.coordinateSpace } : {}
583270
+ });
583271
+ structuralRewrite = scopedReplacements.length === 1 && replacements.length > 1;
583272
+ replacements = scopedReplacements;
583273
+ }
583274
+ }
582625
583275
  if (story.storyKind === "textbox" && replacements.length > 1) {
582626
583276
  const boundary = narrowTextReplacement(selectedText, request.text);
582627
583277
  replacements = boundary ? [boundary] : [];
@@ -582667,7 +583317,10 @@ class V2SelectionMutationAdapter {
582667
583317
  const kernelEdits = edits.map((edit, index2) => ({
582668
583318
  on: collapsedInlineAffinity && edit.on.startOffset === edit.on.endOffset ? { ...edit.on, collapsedInlineAffinity } : edit.on,
582669
583319
  newText: edit.newText,
582670
- ...options?.changeMode === "tracked" && (isRewrite || edits.length > 1) && !typingHistoryMetadata(options) && story.storyKind !== "textbox" ? { rewriteGroupId: `${tx.txId}:0`, preserveExistingRevisions: isRewrite } : {},
583320
+ ...options?.changeMode === "tracked" && (isRewrite || edits.length > 1) && !typingHistoryMetadata(options) && story.storyKind !== "textbox" ? {
583321
+ rewriteGroupId: `${tx.txId}:0`,
583322
+ ...isRewrite && !structuralRewrite ? { preserveExistingRevisions: true } : {}
583323
+ } : {},
582671
583324
  ...trackedTextStampForMode(this.context, `${tx.txId}:${index2}`, options, edit.on, edit.newText)
582672
583325
  }));
582673
583326
  if (kernelEdits.length === 1 && !kernelEdits[0].rewriteGroupId) {
@@ -584447,6 +585100,7 @@ var init_adapter7 = __esm(() => {
584447
585100
  init_adapter5();
584448
585101
  init_story_surface();
584449
585102
  init_textbox_story();
585103
+ init_structural_rewrite_span();
584450
585104
  init_runtime2();
584451
585105
  init_adapter6();
584452
585106
  init_xml();
@@ -592992,17 +593646,18 @@ function readTrackedChangeRefs(context, createdRefs, story) {
592992
593646
  if (trackedChangeRefs.length === 0)
592993
593647
  return [];
592994
593648
  const { logical } = buildCachedTrackedChangeLogicalView(context);
592995
- return trackedChangeRefs.map((ref5) => {
593649
+ const projected = trackedChangeRefs.flatMap((ref5) => {
592996
593650
  const byContributingRsid = Array.from(logical.byId.values()).find((entry) => entry.contributingRsids.includes(ref5.entityId) || entry.sourceIds.rsids.includes(ref5.entityId));
592997
- const byWordId = Array.from(logical.byId.values()).find((entry) => entry.sourceIds.wordIdInsert === ref5.entityId || entry.sourceIds.wordIdDelete === ref5.entityId || entry.sourceIds.wordIdOther.includes(ref5.entityId));
592998
- const entityId = logical.byId.get(ref5.entityId)?.id ?? logical.rsidToLogicalId.get(ref5.entityId) ?? logical.formattingKeyToLogicalId.get(ref5.entityId) ?? logical.structuralKeyToLogicalId.get(ref5.entityId) ?? byContributingRsid?.id ?? byWordId?.id ?? ref5.entityId;
592999
- return {
593651
+ const directlyProjected = logical.byId.get(ref5.entityId)?.id ?? logical.rsidToLogicalId.get(ref5.entityId) ?? logical.formattingKeyToLogicalId.get(ref5.entityId) ?? logical.structuralKeyToLogicalId.get(ref5.entityId) ?? byContributingRsid?.id;
593652
+ const entityIds = directlyProjected ? [directlyProjected] : projectTrackedStructuralEntityIds(context, [ref5.entityId]);
593653
+ return entityIds.map((entityId) => ({
593000
593654
  kind: "entity",
593001
593655
  entityType: "trackedChange",
593002
593656
  entityId,
593003
593657
  ...story ? { story } : {}
593004
- };
593658
+ }));
593005
593659
  });
593660
+ return projected.filter((ref5, index) => projected.findIndex((candidate) => candidate.entityId === ref5.entityId) === index);
593006
593661
  }
593007
593662
  function createBlocksListAccumulator(input, indexEntryCount, inlineModelDiagnosticsBefore) {
593008
593663
  const offset = Math.max(0, input?.offset ?? 0);
@@ -593990,6 +594645,7 @@ var init_adapter10 = __esm(() => {
593990
594645
  init_document_reader();
593991
594646
  init_visible_text();
593992
594647
  init_text_mutation_diagnostics();
594648
+ init_receipt_entities();
593993
594649
  init_block_numbering();
593994
594650
  init_formatting();
593995
594651
  init_table_info();
@@ -617276,14 +617932,24 @@ class V2ContentControlsAdapter {
617276
617932
  }
617277
617933
  const sdtXml = trackedStamp ? wrapTrackedStructuralXml({ innerXml: baseSdtXml, kind: "ins", stamp: trackedStamp }) : baseSdtXml;
617278
617934
  let nextXml;
617935
+ let targetBlockIds2 = [];
617279
617936
  if (input.target) {
617280
617937
  const destination = this.requireControl(input.target, loaded);
617281
617938
  nextXml = `${part.xml.slice(0, destination.end)}${sdtXml}${part.xml.slice(destination.end)}`;
617282
617939
  } else if (input.at) {
617283
617940
  if (input.kind === "block") {
617284
617941
  const at = input.at;
617942
+ const wholeBlocks = resolveWholeBlockSelection(part.xml, part.paragraphs, at);
617943
+ if (wholeBlocks.kind === "failure") {
617944
+ return { success: false, failure: { code: wholeBlocks.code, message: wholeBlocks.message } };
617945
+ }
617285
617946
  const anchor = at.start.kind === "text" ? findParagraphById2(part.xml, at.start.blockId) : null;
617286
- if (anchor && at.start.kind === "text" && at.end.kind === "text" && at.start.offset !== at.end.offset && input.content === undefined && input.html === undefined && input.json === undefined) {
617947
+ if (wholeBlocks.kind === "ok") {
617948
+ const selectedXml = part.xml.slice(wholeBlocks.start, wholeBlocks.end);
617949
+ const wrapped = replaceSdtContentInTemplate(sdtXml, buildInnerXml(selectedXml));
617950
+ nextXml = replaceRange2(part.xml, wholeBlocks.start, wholeBlocks.end, wrapped);
617951
+ targetBlockIds2 = wholeBlocks.blockIds;
617952
+ } else if (anchor && at.start.kind === "text" && at.end.kind === "text" && at.start.offset !== at.end.offset && input.content === undefined && input.html === undefined && input.json === undefined) {
617287
617953
  const splitMarker = "<sd-content-control-split/>";
617288
617954
  let selected = "";
617289
617955
  const split = replaceTextRangeInParagraph2(anchor.xml, at.start.offset, at.end.offset, (text4) => {
@@ -617304,8 +617970,11 @@ class V2ContentControlsAdapter {
617304
617970
  right = right.replace(/w14:paraId="[^"]+"/, `w14:paraId="${allocateSplitId()}"`);
617305
617971
  const wrapped = replaceSdtContentInTemplate(sdtXml, buildInnerXml(buildContentXml(selected, "block", allocateSplitId)));
617306
617972
  nextXml = replaceRange2(part.xml, anchor.start, anchor.end, (keepLeft ? left : "") + wrapped + (keepRight ? right : ""));
617973
+ targetBlockIds2 = [at.start.blockId];
617307
617974
  } else {
617308
617975
  nextXml = insertBlockContentControlAtSelection(part.xml, part.paragraphs, input.at, sdtXml);
617976
+ if (at.start.kind === "text")
617977
+ targetBlockIds2 = [at.start.blockId];
617309
617978
  }
617310
617979
  } else {
617311
617980
  const wrapped = wrapSelectionInXml(this.context, part.xml, input.at, sdtXml, input.kind, input.content ?? "", input.content !== undefined, repeatingSectionItemId ? (text4) => buildInnerXml(buildContentXml(text4, input.kind, createParaIdAllocator(this.context))) : undefined);
@@ -617332,7 +618001,7 @@ class V2ContentControlsAdapter {
617332
618001
  return this.validateDryRun(input, options, target);
617333
618002
  return this.commitDocument(nextXml, "content-control-create", input, options, target, {
617334
618003
  partUri: part.partUri,
617335
- storySurface: { family: "storyBlocks", contentControlRewrite: true, targetBlockIds: [] },
618004
+ storySurface: { family: "storyBlocks", contentControlRewrite: true, targetBlockIds: targetBlockIds2 },
617336
618005
  preserveRenderCommit: true,
617337
618006
  extraPerPart: plannedContent.perPart,
617338
618007
  semanticStyleDependencies: plannedContent.semanticStyleDependencies,
@@ -617702,6 +618371,19 @@ class V2ContentControlsAdapter {
617702
618371
  }
617703
618372
  }
617704
618373
  if (at) {
618374
+ const wholeBlocks = resolveWholeBlockSelection(part.xml, part.paragraphs, at);
618375
+ if (wholeBlocks.kind === "failure") {
618376
+ throw operationError(wholeBlocks.code, wholeBlocks.message);
618377
+ }
618378
+ if (wholeBlocks.kind === "ok") {
618379
+ if (input.kind !== "block") {
618380
+ throw operationError("INVALID_TARGET", "A whole-block selection requires a block content control.");
618381
+ }
618382
+ if (input.content !== undefined || input.html !== undefined || input.json !== undefined) {
618383
+ throw operationError("CAPABILITY_UNAVAILABLE", "Replacing a whole-block selection while creating a content control is not supported.");
618384
+ }
618385
+ return part;
618386
+ }
617705
618387
  if (at.start.kind !== "text" || at.end.kind !== "text" || at.start.blockId !== at.end.blockId) {
617706
618388
  throw operationError("CAPABILITY_UNAVAILABLE", "Content-control creation requires a selection within one paragraph.");
617707
618389
  }
@@ -619636,6 +620318,35 @@ function wrapSelectionInXml(context, documentXml, target, sdtXml, kind, replacem
619636
620318
  }
619637
620319
  };
619638
620320
  }
620321
+ if (kind === "inline" && !hasReplacementContent && selectedTextRunCount(para.xml, target.start.offset, target.end.offset) > 1) {
620322
+ const template = splitSdtTemplateAroundContent(sdtXml);
620323
+ if (!template) {
620324
+ return {
620325
+ ok: false,
620326
+ failure: {
620327
+ code: "CAPABILITY_UNAVAILABLE",
620328
+ message: "Content-control template does not expose wrappable content."
620329
+ }
620330
+ };
620331
+ }
620332
+ const wrappedRuns = wrapRangeWithMarkupInParagraphXml({
620333
+ paragraphXml: para.xml,
620334
+ rangeStart: target.start.offset,
620335
+ rangeEnd: target.end.offset,
620336
+ open: template.open,
620337
+ close: template.close
620338
+ });
620339
+ if (wrappedRuns.ok) {
620340
+ return { ok: true, xml: replaceRange2(documentXml, para.start, para.end, wrappedRuns.xml) };
620341
+ }
620342
+ return {
620343
+ ok: false,
620344
+ failure: {
620345
+ code: "CAPABILITY_UNAVAILABLE",
620346
+ message: "Content-control selection spans unsupported inline structures."
620347
+ }
620348
+ };
620349
+ }
619639
620350
  const wrapped = replaceTextRangeInParagraph2(para.xml, target.start.offset, target.end.offset, (selected) => {
619640
620351
  const text4 = hasReplacementContent ? replacementContent : selected;
619641
620352
  return replaceSdtContentInTemplate(sdtXml, buildReplacementContentXml2(text4));
@@ -619644,6 +620355,27 @@ function wrapSelectionInXml(context, documentXml, target, sdtXml, kind, replacem
619644
620355
  return { ok: false, failure: { code: "CAPABILITY_UNAVAILABLE", message: "Content-control selection spans unsupported inline structures." } };
619645
620356
  return { ok: true, xml: replaceRange2(documentXml, para.start, para.end, wrapped) };
619646
620357
  }
620358
+ function selectedTextRunCount(paragraphXml, start, end) {
620359
+ const runs = new Set;
620360
+ for (const piece of parseParagraphInlineMap(paragraphXml).leaves()) {
620361
+ if (piece.kind === "text" && piece.textRole === "visible" && piece.visibleStart < end && piece.visibleEnd > start) {
620362
+ runs.add(piece.runCharStart);
620363
+ }
620364
+ }
620365
+ return runs.size;
620366
+ }
620367
+ function splitSdtTemplateAroundContent(sdtXml) {
620368
+ const sdtRange = findFirstSdtElementRange(sdtXml);
620369
+ if (!sdtRange)
620370
+ return null;
620371
+ const contentRange = findDirectSdtChildRange(sdtXml.slice(sdtRange.start, sdtRange.end), "sdtContent");
620372
+ if (!contentRange)
620373
+ return null;
620374
+ return {
620375
+ open: sdtXml.slice(0, sdtRange.start + contentRange.openEnd),
620376
+ close: sdtXml.slice(sdtRange.start + contentRange.closeStart)
620377
+ };
620378
+ }
619647
620379
  function insertBlockContentControlAtSelection(documentXml, paragraphs, target, sdtXml) {
619648
620380
  if (target?.kind !== "selection" || target.start?.kind !== "text" || target.end?.kind !== "text") {
619649
620381
  throw operationError("INVALID_TARGET", "A text selection is required.");
@@ -619658,6 +620390,98 @@ function insertBlockContentControlAtSelection(documentXml, paragraphs, target, s
619658
620390
  }
619659
620391
  return `${documentXml.slice(0, anchor.end)}${sdtXml}${documentXml.slice(anchor.end)}`;
619660
620392
  }
620393
+ function resolveWholeBlockSelection(documentXml, paragraphs, target) {
620394
+ let startBlockId;
620395
+ let endBlockId;
620396
+ let textOffsets = null;
620397
+ if (target.start.kind === "text" && target.end.kind === "text") {
620398
+ if (target.start.blockId === target.end.blockId)
620399
+ return { kind: "not-applicable" };
620400
+ if (target.coordinateSpace === "tracked") {
620401
+ return {
620402
+ kind: "failure",
620403
+ code: "CAPABILITY_UNAVAILABLE",
620404
+ message: "text-range-cross-paragraph-tracked-coordinate-unsupported"
620405
+ };
620406
+ }
620407
+ startBlockId = target.start.blockId;
620408
+ endBlockId = target.end.blockId;
620409
+ textOffsets = { start: target.start.offset, end: target.end.offset };
620410
+ } else if (target.start.kind === "nodeEdge" && target.end.kind === "nodeEdge") {
620411
+ if (target.start.edge !== "before" || target.end.edge !== "after") {
620412
+ return {
620413
+ kind: "failure",
620414
+ code: "INVALID_TARGET",
620415
+ message: "Whole-block content-control selections must start before the first block and end after the last block."
620416
+ };
620417
+ }
620418
+ const supportedNodeTypes = new Set(["paragraph", "heading", "listItem"]);
620419
+ if (!supportedNodeTypes.has(target.start.node.nodeType) || !supportedNodeTypes.has(target.end.node.nodeType)) {
620420
+ return {
620421
+ kind: "failure",
620422
+ code: "CAPABILITY_UNAVAILABLE",
620423
+ message: "Whole-block content-control selections support paragraph, heading, and list-item boundaries."
620424
+ };
620425
+ }
620426
+ startBlockId = target.start.node.nodeId;
620427
+ endBlockId = target.end.node.nodeId;
620428
+ } else {
620429
+ return { kind: "not-applicable" };
620430
+ }
620431
+ const matchingStart = paragraphs.filter((paragraph4) => paragraph4.blockId === startBlockId);
620432
+ const matchingEnd = paragraphs.filter((paragraph4) => paragraph4.blockId === endBlockId);
620433
+ if (matchingStart.length === 0 || matchingEnd.length === 0) {
620434
+ return { kind: "failure", code: "TARGET_NOT_FOUND", message: "A content-control selection boundary was not found." };
620435
+ }
620436
+ if (matchingStart.length !== 1 || matchingEnd.length !== 1) {
620437
+ return { kind: "failure", code: "INVALID_TARGET", message: "Content-control selection boundaries must identify unique blocks." };
620438
+ }
620439
+ const startParagraph = matchingStart[0];
620440
+ const endParagraph = matchingEnd[0];
620441
+ const startIndex = paragraphs.indexOf(startParagraph);
620442
+ const endIndex = paragraphs.indexOf(endParagraph);
620443
+ if (startIndex > endIndex) {
620444
+ return { kind: "failure", code: "INVALID_TARGET", message: "Content-control selection boundaries are reversed." };
620445
+ }
620446
+ if (textOffsets && (textOffsets.start !== 0 || textOffsets.end !== endParagraph.textLength)) {
620447
+ return {
620448
+ kind: "failure",
620449
+ code: "CAPABILITY_UNAVAILABLE",
620450
+ message: "A multi-block content-control selection must include the complete first and last blocks."
620451
+ };
620452
+ }
620453
+ const parsed = collectXmlElementRanges(documentXml);
620454
+ if (parsed.errors.length > 0) {
620455
+ return { kind: "failure", code: "PRECONDITION_FAILED", message: "The target story XML could not be parsed safely." };
620456
+ }
620457
+ const paragraphRanges = parsed.ranges.filter((range) => range.tag.localName === "p");
620458
+ const startRange = paragraphRanges.find((range) => range.start === startParagraph.start && range.end === startParagraph.end);
620459
+ const endRange = paragraphRanges.find((range) => range.start === endParagraph.start && range.end === endParagraph.end);
620460
+ if (!startRange || !endRange) {
620461
+ return { kind: "failure", code: "INVALID_TARGET", message: "Content-control selection boundaries are not complete paragraphs." };
620462
+ }
620463
+ const directParent = (child) => parsed.ranges.filter((range) => range.start < child.start && range.end > child.end).sort((left, right) => left.end - left.start - (right.end - right.start))[0];
620464
+ const startParent = directParent(startRange);
620465
+ const endParent = directParent(endRange);
620466
+ const supportedParents = new Set(["body", "hdr", "ftr", "tc", "sdtContent"]);
620467
+ if (!startParent || !endParent || startParent.start !== endParent.start || startParent.end !== endParent.end || !supportedParents.has(startParent.tag.localName)) {
620468
+ return {
620469
+ kind: "failure",
620470
+ code: "INVALID_TARGET",
620471
+ message: "Content-control selection boundaries must share one block-level container."
620472
+ };
620473
+ }
620474
+ const selectedXml = documentXml.slice(startParagraph.start, endParagraph.end);
620475
+ if (/<w:sectPr\b/.test(selectedXml)) {
620476
+ return { kind: "failure", code: "INVALID_TARGET", message: "A content control cannot wrap a section boundary." };
620477
+ }
620478
+ return {
620479
+ kind: "ok",
620480
+ start: startParagraph.start,
620481
+ end: endParagraph.end,
620482
+ blockIds: paragraphs.slice(startIndex, endIndex + 1).map((paragraph4) => paragraph4.blockId)
620483
+ };
620484
+ }
619661
620485
  function replaceSdtContentInTemplate(sdtXml, contentXml) {
619662
620486
  const sdtRange = findFirstSdtElementRange(sdtXml);
619663
620487
  if (!sdtRange)
@@ -619815,6 +620639,7 @@ var init_adapter12 = __esm(() => {
619815
620639
  init_visible_text();
619816
620640
  init_xml();
619817
620641
  init_tracked_pr_change();
620642
+ init_inline();
619818
620643
  init_tracked_structural_wrapper();
619819
620644
  init_adapter7();
619820
620645
  init_rich_fragment_apply();
@@ -651496,7 +652321,16 @@ async function compileOrderedTextProgram(context, sourceSteps, story, evaluatedR
651496
652321
  for (const match of matches.slice().reverse()) {
651497
652322
  const replacement = sourceStep.op === "text.delete" ? "" : replacementTextForMatch(sourceStep, match.text, match.groups);
651498
652323
  if (replacement !== match.text) {
651499
- const spans = paragraph4.coordinateSpace !== "tracked" ? planTextReplacement(match.text, replacement) : [{ start: 0, end: match.text.length, text: replacement }];
652324
+ let spans = paragraph4.coordinateSpace !== "tracked" ? planTextReplacement(match.text, replacement) : [{ start: 0, end: match.text.length, text: replacement }];
652325
+ if (sourceStep.op === "text.rewrite" && paragraph4.coordinateSpace !== "tracked" && currentText === paragraph4.originalText && spans.length > 1) {
652326
+ const paragraphBytes = getSDDocumentSessionInternalPartRange(context.session, paragraph4.seedRange.partUri, paragraph4.seedRange.paragraphByteStart ?? paragraph4.seedRange.startByte, paragraph4.seedRange.paragraphByteEnd ?? paragraph4.seedRange.endByte);
652327
+ if (paragraphBytes) {
652328
+ spans = planTrackedRewriteReplacement(match.text, replacement, {
652329
+ paragraphXml: TD103.decode(paragraphBytes),
652330
+ startOffset: match.from
652331
+ });
652332
+ }
652333
+ }
651500
652334
  for (const span of spans.slice().reverse()) {
651501
652335
  replaceStagedText(paragraph4, match.from + span.start, match.from + span.end, span.text, sourceStep.id, sourceStepOrder, preserveReviewOrigins);
651502
652336
  }
@@ -652683,6 +653517,7 @@ var init_engine3 = __esm(() => {
652683
653517
  init_query_adapter();
652684
653518
  init_within();
652685
653519
  init_tracked_text_search();
653520
+ init_structural_rewrite_span();
652686
653521
  init_adapter7();
652687
653522
  init_adapter27();
652688
653523
  init_adapter6();
@@ -708378,12 +709213,45 @@ function syncTrackedDecisionTableOverlaysFromSession(session, prepared, storyId,
708378
709213
  if (!bytes)
708379
709214
  throw new Error(`tracked-change sync could not read ${partUri}`);
708380
709215
  const tableMap = getStoryTablesMap(doc2);
709216
+ const targetBlockIds2 = new Set(prepared.backendExtensions.storySurface?.targetBlockIds ?? []);
709217
+ for (const ref5 of [
709218
+ ...prepared.semanticDelta.createdRefs,
709219
+ ...prepared.semanticDelta.updatedRefs,
709220
+ ...prepared.semanticDelta.invalidatedRefs
709221
+ ]) {
709222
+ if (ref5.kind === "block")
709223
+ targetBlockIds2.add(ref5.nodeId);
709224
+ if (ref5.kind === "text")
709225
+ targetBlockIds2.add(ref5.blockId);
709226
+ }
709227
+ for (const shift of prepared.semanticDelta.textRangeShifts) {
709228
+ if (shift.blockId)
709229
+ targetBlockIds2.add(shift.blockId);
709230
+ }
709231
+ const scopedTextDecision = prepared.source.kind === "trackedChangeDecide" && prepared.source.targets.every((target) => (!target.structural || target.structural.entityKey.includes("|paragraph-mark-insertion|") || target.structural.entityKey.includes("|paragraph-mark-deletion|")) && !target.derivedStructural && !target.formatting && !target.partial && !target.moveRangeMarkers) && targetBlockIds2.size > 0;
709232
+ const affectedTableIds = new Set;
709233
+ if (targetBlockIds2.size > 0) {
709234
+ for (const table of currentCatalog.tables) {
709235
+ if (currentIndex.entries.some((entry) => targetBlockIds2.has(entry.blockId) && entry.byteStart >= table.tableByteStart && entry.byteEnd <= table.tableByteEnd)) {
709236
+ affectedTableIds.add(table.tableNodeId);
709237
+ }
709238
+ }
709239
+ for (const [tableNodeId, overlay] of tableMap) {
709240
+ if (!(overlay instanceof YMap))
709241
+ continue;
709242
+ const tableBlocks = overlay.get("tableBlocks");
709243
+ if (tableBlocks instanceof YArray && tableBlocks.toArray().some((blockId) => targetBlockIds2.has(blockId))) {
709244
+ affectedTableIds.add(tableNodeId);
709245
+ }
709246
+ }
709247
+ }
709248
+ const shouldSyncTable = (tableNodeId) => !scopedTextDecision || affectedTableIds.has(tableNodeId);
708381
709249
  const skipMissingTableOverlay = isRejectedStructureUndo(prepared);
708382
709250
  const liveTableIds = new Set(currentCatalog.tables.map((table) => table.tableNodeId));
708383
709251
  const liveBlockIds = new Set(currentIndex.entries.map((entry) => entry.blockId));
708384
709252
  resolveStoryShardScope(doc2).doc.transact(() => {
708385
709253
  for (const [tableNodeId, overlay] of tableMap) {
708386
- if (liveTableIds.has(tableNodeId) || !(overlay instanceof YMap))
709254
+ if (!shouldSyncTable(tableNodeId) || liveTableIds.has(tableNodeId) || !(overlay instanceof YMap))
708387
709255
  continue;
708388
709256
  const tableBlocks = overlay.get("tableBlocks");
708389
709257
  if (tableBlocks instanceof YArray && !tableBlocks.toArray().some((blockId) => liveBlockIds.has(blockId))) {
@@ -708391,11 +709259,16 @@ function syncTrackedDecisionTableOverlaysFromSession(session, prepared, storyId,
708391
709259
  }
708392
709260
  }
708393
709261
  for (const table of currentCatalog.tables) {
708394
- const existingOverlay = tableMap.get(table.tableNodeId) instanceof YMap;
709262
+ const currentOverlay = tableMap.get(table.tableNodeId);
709263
+ const tableXml = TD108.decode(bytes.slice(table.tableByteStart, table.tableByteEnd));
709264
+ const existingOverlay = currentOverlay instanceof YMap;
709265
+ const tableCoordinatesChanged = currentOverlay instanceof YMap && (currentOverlay.get("sourceByteStart") !== table.tableByteStart || currentOverlay.get("sourceByteEnd") !== table.tableByteEnd);
709266
+ const tableXmlChanged = currentOverlay instanceof YMap && currentOverlay.get("xml") !== tableXml;
709267
+ if (!shouldSyncTable(table.tableNodeId) && !tableCoordinatesChanged && !tableXmlChanged)
709268
+ continue;
708395
709269
  if (!existingOverlay && skipMissingTableOverlay)
708396
709270
  continue;
708397
709271
  const affectedBlockIds = currentIndex.entries.filter((entry) => entry.byteStart >= table.tableByteStart && entry.byteEnd <= table.tableByteEnd).map((entry) => entry.blockId);
708398
- const tableXml = TD108.decode(bytes.slice(table.tableByteStart, table.tableByteEnd));
708399
709272
  const sourceXmlStart = byteOffsetToCharOffset(bytes, table.tableByteStart);
708400
709273
  writeTableOverlayState({
708401
709274
  tableMap,
@@ -709918,6 +710791,8 @@ function usesTrackedDecisionSessionSync(prepared, extension2, options) {
709918
710791
  return true;
709919
710792
  if (hasPreparedCommentRefRemaps(prepared))
709920
710793
  return true;
710794
+ if (prepared.source.kind === "trackedChangeDecide" && prepared.source.targets.some((target) => (target.moveRangeMarkers?.ids.length ?? 0) > 0))
710795
+ return true;
709921
710796
  if (!extension2.trackedTextDecide) {
709922
710797
  if (prepared.source.kind !== "trackedChangeDecide")
709923
710798
  return false;