@venite/components 0.16.7 → 0.16.13

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 (729) hide show
  1. package/dist/cjs/_commonjsHelpers-bcc1208a.js +25 -0
  2. package/dist/cjs/animation-34a434a2.js +957 -0
  3. package/dist/cjs/app-globals-60a4f972.js +7 -0
  4. package/dist/cjs/book-1a92678a.js +287 -0
  5. package/dist/cjs/change-cdb1e8c0.js +16 -0
  6. package/dist/cjs/cubic-bezier-f3b34d27.js +91 -0
  7. package/dist/cjs/cursor-81bfd01e.js +12 -0
  8. package/dist/cjs/focus-visible-5621d6b1.js +45 -0
  9. package/dist/cjs/framework-delegate-84d33ff0.js +37 -0
  10. package/dist/cjs/gesture-controller-5bd9d825.js +193 -0
  11. package/dist/cjs/haptic-88c261ab.js +49 -0
  12. package/dist/cjs/hardware-back-button-8c2f48d2.js +59 -0
  13. package/dist/cjs/heading-5afc2b24.js +21 -0
  14. package/dist/cjs/helpers-41dfb43a.js +110 -0
  15. package/dist/cjs/image-3bee3e73.js +21 -0
  16. package/dist/cjs/index-1a73a70c.js +211 -0
  17. package/dist/cjs/index-4b7e4228.js +135 -0
  18. package/dist/cjs/index-7aa21373.js +92 -0
  19. package/dist/cjs/index-8197bb45.js +441 -0
  20. package/dist/{ldf/index-ea7a35b9.js → cjs/index-8fe0df8d.js} +213 -1242
  21. package/dist/cjs/index-c5bdf2bc.js +167 -0
  22. package/dist/cjs/index-de13bd01.js +463 -0
  23. package/dist/cjs/index-e4c51e4d.js +307 -0
  24. package/dist/cjs/index.cjs.js +8 -0
  25. package/dist/cjs/input-shims-9c2d56bd.js +357 -0
  26. package/dist/cjs/ion-action-sheet.cjs.entry.js +230 -0
  27. package/dist/cjs/ion-alert.cjs.entry.js +386 -0
  28. package/dist/cjs/ion-app.cjs.entry.js +60 -0
  29. package/dist/cjs/ion-avatar.cjs.entry.js +25 -0
  30. package/dist/cjs/ion-back-button.cjs.entry.js +79 -0
  31. package/dist/cjs/ion-backdrop.cjs.entry.js +67 -0
  32. package/dist/cjs/ion-badge.cjs.entry.js +27 -0
  33. package/dist/cjs/ion-button_13.cjs.entry.js +1786 -0
  34. package/dist/cjs/ion-card-content_6.cjs.entry.js +405 -0
  35. package/dist/cjs/ion-card-subtitle.cjs.entry.js +27 -0
  36. package/dist/cjs/ion-card_2.cjs.entry.js +91 -0
  37. package/dist/cjs/ion-checkbox_3.cjs.entry.js +234 -0
  38. package/dist/cjs/ion-chip.cjs.entry.js +31 -0
  39. package/dist/cjs/ion-datetime_2.cjs.entry.js +1125 -0
  40. package/dist/cjs/ion-fab-button.cjs.entry.js +74 -0
  41. package/dist/cjs/ion-fab-list.cjs.entry.js +45 -0
  42. package/dist/cjs/ion-fab.cjs.entry.js +74 -0
  43. package/dist/cjs/ion-footer.cjs.entry.js +43 -0
  44. package/dist/cjs/ion-img.cjs.entry.js +72 -0
  45. package/dist/cjs/ion-infinite-scroll-content.cjs.entry.js +37 -0
  46. package/dist/cjs/ion-infinite-scroll.cjs.entry.js +206 -0
  47. package/dist/cjs/ion-input_2.cjs.entry.js +2645 -0
  48. package/dist/cjs/ion-item-divider.cjs.entry.js +36 -0
  49. package/dist/cjs/ion-item-group.cjs.entry.js +31 -0
  50. package/dist/cjs/ion-item-option.cjs.entry.js +55 -0
  51. package/dist/cjs/ion-item-options.cjs.entry.js +47 -0
  52. package/dist/cjs/ion-item-sliding.cjs.entry.js +359 -0
  53. package/dist/cjs/ion-list-header.cjs.entry.js +28 -0
  54. package/dist/cjs/ion-loading.cjs.entry.js +213 -0
  55. package/dist/cjs/ion-menu-button.cjs.entry.js +61 -0
  56. package/dist/cjs/ion-menu-toggle.cjs.entry.js +47 -0
  57. package/dist/cjs/ion-menu.cjs.entry.js +456 -0
  58. package/dist/cjs/ion-modal.cjs.entry.js +488 -0
  59. package/dist/cjs/ion-nav-link.cjs.entry.js +44 -0
  60. package/dist/cjs/ion-nav.cjs.entry.js +812 -0
  61. package/dist/cjs/ion-note.cjs.entry.js +27 -0
  62. package/dist/cjs/ion-picker-column.cjs.entry.js +327 -0
  63. package/dist/cjs/ion-picker.cjs.entry.js +214 -0
  64. package/dist/cjs/ion-popover.cjs.entry.js +363 -0
  65. package/dist/cjs/ion-progress-bar.cjs.entry.js +67 -0
  66. package/dist/cjs/ion-radio_2.cjs.entry.js +149 -0
  67. package/dist/cjs/ion-range.cjs.entry.js +395 -0
  68. package/dist/cjs/ion-refresher-content.cjs.entry.js +40 -0
  69. package/dist/cjs/ion-refresher.cjs.entry.js +832 -0
  70. package/dist/cjs/ion-reorder-group.cjs.entry.js +281 -0
  71. package/dist/cjs/ion-reorder.cjs.entry.js +31 -0
  72. package/dist/cjs/ion-route-redirect.cjs.entry.js +24 -0
  73. package/dist/cjs/ion-route.cjs.entry.js +49 -0
  74. package/dist/cjs/ion-router-link.cjs.entry.js +35 -0
  75. package/dist/cjs/ion-router-outlet.cjs.entry.js +160 -0
  76. package/dist/cjs/ion-router.cjs.entry.js +631 -0
  77. package/dist/cjs/ion-segment_16.cjs.entry.js +2507 -0
  78. package/dist/cjs/ion-select-popover.cjs.entry.js +33 -0
  79. package/dist/cjs/ion-select_2.cjs.entry.js +444 -0
  80. package/dist/cjs/ion-slide.cjs.entry.js +25 -0
  81. package/dist/cjs/ion-slides.cjs.entry.js +404 -0
  82. package/dist/cjs/ion-spinner.cjs.entry.js +60 -0
  83. package/dist/cjs/ion-split-pane.cjs.entry.js +150 -0
  84. package/dist/cjs/ion-tab-bar.cjs.entry.js +58 -0
  85. package/dist/cjs/ion-tab-button.cjs.entry.js +99 -0
  86. package/dist/cjs/ion-tab.cjs.entry.js +58 -0
  87. package/dist/cjs/ion-tabs.cjs.entry.js +155 -0
  88. package/dist/cjs/ion-text.cjs.entry.js +22 -0
  89. package/dist/cjs/ion-textarea.cjs.entry.js +217 -0
  90. package/dist/cjs/ion-thumbnail.cjs.entry.js +20 -0
  91. package/dist/cjs/ion-toast.cjs.entry.js +280 -0
  92. package/dist/cjs/ion-virtual-scroll.cjs.entry.js +544 -0
  93. package/dist/cjs/ionic-global-581fb4f8.js +204 -0
  94. package/dist/cjs/ios.transition-7244ac4e.js +459 -0
  95. package/dist/cjs/ldf-day-name_5.cjs.entry.js +5682 -0
  96. package/dist/cjs/ldf-editable-add-block-menu.cjs.entry.js +573 -0
  97. package/dist/cjs/ldf-editable-condition-piece.cjs.entry.js +220 -0
  98. package/dist/cjs/ldf-editable-condition.cjs.entry.js +106 -0
  99. package/dist/cjs/ldf-editable-filter-documents.cjs.entry.js +152 -0
  100. package/dist/cjs/ldf-editable-lookup_2.cjs.entry.js +496 -0
  101. package/dist/cjs/ldf-editable-metadata.cjs.entry.js +186 -0
  102. package/dist/cjs/ldf-editable-preference-option.cjs.entry.js +72 -0
  103. package/dist/cjs/ldf-editable-preference.cjs.entry.js +89 -0
  104. package/dist/cjs/ldf-editable-preferences.cjs.entry.js +200 -0
  105. package/dist/cjs/ldf-editable-string-list.cjs.entry.js +134 -0
  106. package/dist/cjs/ldf-editor-cursors.cjs.entry.js +276 -0
  107. package/dist/cjs/ldf-editor.cjs.entry.js +238 -0
  108. package/dist/cjs/ldf.cjs.js +22 -0
  109. package/dist/cjs/loader.cjs.js +24 -0
  110. package/dist/cjs/locale-d4e925b1.js +8 -0
  111. package/dist/cjs/md.transition-d86b1ef0.js +62 -0
  112. package/dist/cjs/menu-toggle-util-293e388b.js +11 -0
  113. package/dist/cjs/option-24f3d13a.js +167 -0
  114. package/dist/cjs/overlays-eb464d6d.js +228 -0
  115. package/dist/cjs/preference-a4bd51c4.js +23 -0
  116. package/dist/cjs/refrain-91fb446b.js +21 -0
  117. package/dist/cjs/rubric-5b467a6a.js +1220 -0
  118. package/dist/cjs/specific-class-a1112e78.js +38 -0
  119. package/dist/cjs/spinner-configs-b0bec093.js +112 -0
  120. package/dist/cjs/status-tap-7afb25f5.js +25 -0
  121. package/dist/cjs/swipe-back-f887168e.js +52 -0
  122. package/dist/cjs/swiper.bundle-cb0f61f7.js +6246 -0
  123. package/dist/cjs/tap-click-e0af5237.js +169 -0
  124. package/dist/cjs/text-5edb80f3.js +18 -0
  125. package/dist/cjs/theme-81caa5b0.js +47 -0
  126. package/dist/collection/collection-manifest.json +146 -0
  127. package/dist/collection/components/bible-reading/bible-reading.css +84 -0
  128. package/dist/collection/components/bible-reading/bible-reading.i18n.en.json +13 -0
  129. package/dist/collection/components/bible-reading/bible-reading.i18n.es.json +4 -0
  130. package/dist/collection/components/bible-reading/bible-reading.js +328 -0
  131. package/dist/collection/components/bible-reading/dist/bible-reading.js +354 -0
  132. package/dist/collection/components/bible-reading/fetch-reading.js +17 -0
  133. package/dist/collection/components/day-name/day-name.css +18 -0
  134. package/dist/collection/components/day-name/day-name.i18n.en.json +4 -0
  135. package/dist/{ldf/ldf-day-name.entry.js → collection/components/day-name/day-name.js} +54 -27
  136. package/dist/collection/components/editable-add-block/editable-add-block.css +93 -0
  137. package/dist/collection/components/editable-add-block/editable-add-block.i18n.en.json +5 -0
  138. package/dist/collection/components/editable-add-block/editable-add-block.js +135 -0
  139. package/dist/collection/components/editable-add-block-menu/dist/menu-options.js +230 -0
  140. package/dist/collection/components/editable-add-block-menu/editable-add-block-menu.css +33 -0
  141. package/dist/collection/components/editable-add-block-menu/editable-add-block-menu.i18n.en.json +48 -0
  142. package/dist/collection/components/editable-add-block-menu/editable-add-block-menu.js +101 -0
  143. package/dist/collection/components/editable-add-block-menu/menu-options.js +423 -0
  144. package/dist/collection/components/editable-antiphon-field/editable-antiphon-field.i18n.en.json +11 -0
  145. package/dist/collection/components/editable-antiphon-field/editable-antiphon-field.js +332 -0
  146. package/dist/collection/components/editable-antiphon-field/ldf-editable-antiphon-field.css +7 -0
  147. package/dist/collection/components/editable-boolean/editable-boolean.js +117 -0
  148. package/dist/collection/components/editable-condition/editable-condition.i18n.en.json +7 -0
  149. package/dist/collection/components/editable-condition/editable-condition.js +192 -0
  150. package/dist/collection/components/editable-condition-piece/dist/editable-condition-piece.js +257 -0
  151. package/dist/collection/components/editable-condition-piece/editable-condition-piece.css +34 -0
  152. package/dist/collection/components/editable-condition-piece/editable-condition-piece.i18n.en.json +21 -0
  153. package/dist/collection/components/editable-condition-piece/editable-condition-piece.js +233 -0
  154. package/dist/collection/components/editable-condition-piece/except-only-strings.js +12 -0
  155. package/dist/collection/components/editable-condition-piece/except-only.js +20 -0
  156. package/dist/collection/components/editable-delete/editable-delete.i18n.en.json +6 -0
  157. package/dist/collection/components/editable-delete/editable-delete.js +175 -0
  158. package/dist/collection/components/editable-filter-documents/dist/editable-filter-documents.js +242 -0
  159. package/dist/collection/components/editable-filter-documents/editable-filter-documents.css +11 -0
  160. package/dist/collection/components/editable-filter-documents/editable-filter-documents.i18n.en.json +9 -0
  161. package/dist/collection/components/editable-filter-documents/editable-filter-documents.js +294 -0
  162. package/dist/collection/components/editable-lookup/editable-lookup.js +210 -0
  163. package/dist/collection/components/editable-metadata/editable-metadata.css +44 -0
  164. package/dist/collection/components/editable-metadata/editable-metadata.i18n.en.json +51 -0
  165. package/dist/collection/components/editable-metadata/editable-metadata.js +261 -0
  166. package/dist/collection/components/editable-metadata-buttons/dist/editable-metadata-buttons.js +444 -0
  167. package/dist/collection/components/editable-metadata-buttons/editable-metadata-buttons.css +37 -0
  168. package/dist/collection/components/editable-metadata-buttons/editable-metadata-buttons.i18n.en.json +31 -0
  169. package/dist/collection/components/editable-metadata-buttons/editable-metadata-buttons.js +433 -0
  170. package/dist/collection/components/editable-metadata-metadata-fields/dist/editable-metadata-metadata-fields.js +399 -0
  171. package/dist/collection/components/editable-metadata-metadata-fields/editable-metadata-metadata-fields.i18n.en.json +48 -0
  172. package/dist/collection/components/editable-metadata-metadata-fields/editable-metadata-metadata-fields.js +438 -0
  173. package/dist/collection/components/editable-preference/editable-preference.i18n.en.json +8 -0
  174. package/dist/collection/components/editable-preference/editable-preference.js +166 -0
  175. package/dist/collection/components/editable-preference-option/editable-preference-option.i18n.en.json +9 -0
  176. package/dist/collection/components/editable-preference-option/editable-preference-option.js +128 -0
  177. package/dist/collection/components/editable-preferences/dist/editable-preferences.js +281 -0
  178. package/dist/collection/components/editable-preferences/editable-preferences.css +3 -0
  179. package/dist/collection/components/editable-preferences/editable-preferences.i18n.en.json +10 -0
  180. package/dist/collection/components/editable-preferences/editable-preferences.js +230 -0
  181. package/dist/collection/components/editable-preferences/preference-tree.js +24 -0
  182. package/dist/collection/components/editable-select/dist/editable-select.js +69 -0
  183. package/dist/collection/components/editable-select/editable-select.css +0 -0
  184. package/dist/collection/components/editable-select/editable-select.js +157 -0
  185. package/dist/collection/components/editable-string-list/dist/editable-string-list.js +207 -0
  186. package/dist/collection/components/editable-string-list/editable-string-list.css +21 -0
  187. package/dist/collection/components/editable-string-list/editable-string-list.i18n.en.json +18 -0
  188. package/dist/collection/components/editable-string-list/editable-string-list.js +194 -0
  189. package/dist/collection/components/editable-text/dist/editable-text.js +300 -0
  190. package/dist/collection/components/editable-text/dist/handle-input.js +52 -0
  191. package/dist/collection/components/editable-text/editable-text.css +53 -0
  192. package/dist/collection/components/editable-text/editable-text.i18n.en.json +3 -0
  193. package/dist/collection/components/editable-text/editable-text.js +473 -0
  194. package/dist/collection/components/editable-text/handle-input.js +47 -0
  195. package/dist/collection/components/editor/dist/editor.js +403 -0
  196. package/dist/collection/components/editor/editor.css +41 -0
  197. package/dist/collection/components/editor/editor.js +579 -0
  198. package/dist/collection/components/editor-cursors/editor-cursors.css +43 -0
  199. package/dist/collection/components/editor-cursors/editor-cursors.js +228 -0
  200. package/dist/collection/components/heading/dist/heading.js +210 -0
  201. package/dist/collection/components/heading/editable-node.js +2 -0
  202. package/dist/collection/components/heading/heading.css +96 -0
  203. package/dist/collection/components/heading/heading.i18n.en.json +4 -0
  204. package/dist/collection/components/heading/heading.js +198 -0
  205. package/dist/collection/components/image/image.css +75 -0
  206. package/dist/collection/components/image/image.i18n.en.json +4 -0
  207. package/dist/collection/components/image/image.js +303 -0
  208. package/dist/collection/components/label-bar/label-bar.css +40 -0
  209. package/dist/collection/components/label-bar/label-bar.js +49 -0
  210. package/dist/collection/components/liturgical-document/condition-node.js +86 -0
  211. package/dist/collection/components/liturgical-document/dist/liturgical-document.js +341 -0
  212. package/dist/collection/components/liturgical-document/liturgical-document.css +73 -0
  213. package/dist/collection/components/liturgical-document/liturgical-document.i18n.en.json +45 -0
  214. package/dist/collection/components/liturgical-document/liturgical-document.js +465 -0
  215. package/dist/collection/components/liturgical-document/lookup-node.js +80 -0
  216. package/dist/collection/components/liturgy/liturgy.js +138 -0
  217. package/dist/collection/components/meditation/dist/meditation.js +345 -0
  218. package/dist/collection/components/meditation/meditation.css +63 -0
  219. package/dist/collection/components/meditation/meditation.i18n.en.json +8 -0
  220. package/dist/collection/components/meditation/meditation.js +409 -0
  221. package/dist/collection/components/option/dist/option.js +318 -0
  222. package/dist/collection/components/option/option.css +8 -0
  223. package/dist/collection/components/option/option.i18n.en.json +3 -0
  224. package/dist/{ldf/ldf-option.entry.js → collection/components/option/option.js} +214 -31
  225. package/dist/collection/components/prayers-and-thanksgivings/dist/prayers-and-thanksgivings.js +258 -0
  226. package/dist/collection/components/prayers-and-thanksgivings/prayers-and-thanksgivings.css +3 -0
  227. package/dist/collection/components/prayers-and-thanksgivings/prayers-and-thanksgivings.i18n.en.json +3 -0
  228. package/dist/collection/components/prayers-and-thanksgivings/prayers-and-thanksgivings.js +265 -0
  229. package/dist/collection/components/psalm/dist/psalm.js +383 -0
  230. package/dist/collection/components/psalm/psalm.css +152 -0
  231. package/dist/collection/components/psalm/psalm.i18n.en.json +10 -0
  232. package/dist/collection/components/psalm/psalm.js +361 -0
  233. package/dist/collection/components/refrain/refrain.css +42 -0
  234. package/dist/collection/components/refrain/refrain.js +105 -0
  235. package/dist/collection/components/responsive-prayer/responsive-prayer.css +83 -0
  236. package/dist/collection/components/responsive-prayer/responsive-prayer.i18n.en.json +7 -0
  237. package/dist/collection/components/responsive-prayer/responsive-prayer.js +215 -0
  238. package/dist/collection/components/rubric/rubric.css +9 -0
  239. package/dist/collection/components/rubric/rubric.js +104 -0
  240. package/dist/collection/components/string/dist/string.js +194 -0
  241. package/dist/collection/components/string/string.css +60 -0
  242. package/dist/{ldf/ldf-string.entry.js → collection/components/string/string.js} +179 -18
  243. package/dist/collection/components/text/dist/text.js +234 -0
  244. package/dist/collection/components/text/text.css +52 -0
  245. package/dist/collection/components/text/text.i18n.en.json +7 -0
  246. package/dist/collection/components/text/text.i18n.es.json +3 -0
  247. package/dist/collection/components/text/text.js +224 -0
  248. package/dist/collection/i18n/bible-reading.i18n.en.json +13 -0
  249. package/dist/collection/i18n/bible-reading.i18n.es.json +4 -0
  250. package/dist/collection/i18n/day-name.i18n.en.json +4 -0
  251. package/dist/collection/i18n/editable-add-block-menu.i18n.en.json +48 -0
  252. package/dist/collection/i18n/editable-add-block.i18n.en.json +5 -0
  253. package/dist/collection/i18n/editable-antiphon-field.i18n.en.json +11 -0
  254. package/dist/collection/i18n/editable-condition-piece.i18n.en.json +21 -0
  255. package/dist/collection/i18n/editable-condition.i18n.en.json +7 -0
  256. package/dist/collection/i18n/editable-delete.i18n.en.json +6 -0
  257. package/dist/collection/i18n/editable-filter-documents.i18n.en.json +9 -0
  258. package/dist/collection/i18n/editable-metadata-buttons.i18n.en.json +31 -0
  259. package/dist/collection/i18n/editable-metadata-metadata-fields.i18n.en.json +48 -0
  260. package/dist/collection/i18n/editable-metadata.i18n.en.json +51 -0
  261. package/dist/collection/i18n/editable-preference-option.i18n.en.json +9 -0
  262. package/dist/collection/i18n/editable-preference.i18n.en.json +8 -0
  263. package/dist/collection/i18n/editable-preferences.i18n.en.json +10 -0
  264. package/dist/collection/i18n/editable-string-list.i18n.en.json +18 -0
  265. package/dist/collection/i18n/editable-text.i18n.en.json +3 -0
  266. package/dist/collection/i18n/heading.i18n.en.json +4 -0
  267. package/dist/collection/i18n/image.i18n.en.json +4 -0
  268. package/dist/collection/i18n/liturgical-document.i18n.en.json +45 -0
  269. package/dist/collection/i18n/meditation.i18n.en.json +8 -0
  270. package/dist/collection/i18n/option.i18n.en.json +3 -0
  271. package/dist/collection/i18n/prayers-and-thanksgivings.i18n.en.json +3 -0
  272. package/dist/collection/i18n/psalm.i18n.en.json +10 -0
  273. package/dist/collection/i18n/responsive-prayer.i18n.en.json +7 -0
  274. package/dist/collection/i18n/text.i18n.en.json +7 -0
  275. package/dist/collection/i18n/text.i18n.es.json +3 -0
  276. package/dist/collection/index.js +2 -0
  277. package/dist/collection/interfaces/add-option-to-doc.js +1 -0
  278. package/dist/collection/interfaces/dist/menu-option.js +9 -0
  279. package/dist/collection/interfaces/index.js +2 -0
  280. package/dist/collection/interfaces/menu-option.js +2 -0
  281. package/dist/collection/utils/element-from-path.js +14 -0
  282. package/dist/{ldf/locale-d595f8f6.js → collection/utils/locale.js} +2 -4
  283. package/dist/esm/_commonjsHelpers-ba3f0406.js +21 -0
  284. package/dist/{ldf/animation-6b850b6a.js → esm/animation-7a1025d0.js} +1 -1
  285. package/dist/{ldf/app-globals-d4376e8c.js → esm/app-globals-729b03cf.js} +1 -1
  286. package/dist/esm/book-31b8cdde.js +282 -0
  287. package/dist/esm/change-ea574d32.js +14 -0
  288. package/dist/{ldf → esm}/cubic-bezier-89113939.js +0 -0
  289. package/dist/esm/cursor-0e47f111.js +10 -0
  290. package/dist/{ldf → esm}/focus-visible-571e113e.js +0 -0
  291. package/dist/{ldf → esm}/framework-delegate-7af2c551.js +0 -0
  292. package/dist/esm/gesture-controller-5bf8565e.js +191 -0
  293. package/dist/{ldf/haptic-0d102c16.js → esm/haptic-fc16a4d8.js} +0 -24
  294. package/dist/{ldf → esm}/hardware-back-button-b3b61715.js +0 -0
  295. package/dist/esm/heading-cc5ffa8a.js +19 -0
  296. package/dist/{ldf/helpers-e9bf4204.js → esm/helpers-8c93393b.js} +0 -3
  297. package/dist/esm/image-c6a3f0c5.js +19 -0
  298. package/dist/{ldf/index-dd274afe.js → esm/index-1bf6d100.js} +3 -31
  299. package/dist/{ldf/index-4505cc02.js → esm/index-734a6b69.js} +2 -2
  300. package/dist/{ldf/index-9b41fcc6.js → esm/index-82044e24.js} +3 -190
  301. package/dist/{ldf → esm}/index-86d5f3ab.js +0 -0
  302. package/dist/{ldf/index-fc8c2f30.js → esm/index-9579282b.js} +3 -3
  303. package/dist/{ldf → esm}/index-c7ecbd63.js +0 -0
  304. package/dist/{ldf/index-7845c707.js → esm/index-f08f6130.js} +1 -6
  305. package/dist/esm/index-f0f6a379.js +1765 -0
  306. package/dist/esm/index.js +4 -0
  307. package/dist/{ldf/input-shims-b58afc2a.js → esm/input-shims-a4ad2743.js} +5 -7
  308. package/dist/{ldf → esm}/ion-action-sheet.entry.js +5 -5
  309. package/dist/{ldf → esm}/ion-alert.entry.js +5 -5
  310. package/dist/{ldf → esm}/ion-app.entry.js +6 -6
  311. package/dist/{ldf → esm}/ion-avatar.entry.js +2 -2
  312. package/dist/{ldf → esm}/ion-back-button.entry.js +2 -2
  313. package/dist/{ldf → esm}/ion-backdrop.entry.js +3 -3
  314. package/dist/{ldf → esm}/ion-badge.entry.js +2 -2
  315. package/dist/esm/ion-button_13.entry.js +1770 -0
  316. package/dist/esm/ion-card-content_6.entry.js +396 -0
  317. package/dist/{ldf → esm}/ion-card-subtitle.entry.js +2 -2
  318. package/dist/{ldf/ion-card.entry.js → esm/ion-card_2.entry.js} +27 -3
  319. package/dist/{ldf/ion-checkbox.entry.js → esm/ion-checkbox_3.entry.js} +123 -4
  320. package/dist/{ldf → esm}/ion-chip.entry.js +2 -2
  321. package/dist/{ldf/ion-datetime.entry.js → esm/ion-datetime_2.entry.js} +152 -6
  322. package/dist/{ldf → esm}/ion-fab-button.entry.js +3 -3
  323. package/dist/{ldf → esm}/ion-fab-list.entry.js +2 -2
  324. package/dist/{ldf → esm}/ion-fab.entry.js +2 -2
  325. package/dist/{ldf → esm}/ion-footer.entry.js +2 -2
  326. package/dist/{ldf → esm}/ion-img.entry.js +2 -2
  327. package/dist/{ldf → esm}/ion-infinite-scroll-content.entry.js +2 -2
  328. package/dist/{ldf → esm}/ion-infinite-scroll.entry.js +2 -2
  329. package/dist/{ldf/ldf-editable-text.entry.js → esm/ion-input_2.entry.js} +222 -12
  330. package/dist/{ldf → esm}/ion-item-divider.entry.js +2 -2
  331. package/dist/{ldf → esm}/ion-item-group.entry.js +2 -2
  332. package/dist/{ldf → esm}/ion-item-option.entry.js +2 -2
  333. package/dist/{ldf → esm}/ion-item-options.entry.js +3 -3
  334. package/dist/{ldf → esm}/ion-item-sliding.entry.js +4 -4
  335. package/dist/{ldf → esm}/ion-list-header.entry.js +2 -2
  336. package/dist/{ldf → esm}/ion-loading.entry.js +5 -5
  337. package/dist/{ldf → esm}/ion-menu-button.entry.js +6 -6
  338. package/dist/{ldf → esm}/ion-menu-toggle.entry.js +6 -6
  339. package/dist/{ldf → esm}/ion-menu.entry.js +7 -11
  340. package/dist/{ldf → esm}/ion-modal.entry.js +8 -7
  341. package/dist/{ldf → esm}/ion-nav-link.entry.js +1 -1
  342. package/dist/{ldf → esm}/ion-nav.entry.js +5 -9
  343. package/dist/{ldf → esm}/ion-note.entry.js +2 -2
  344. package/dist/{ldf → esm}/ion-picker-column.entry.js +5 -5
  345. package/dist/{ldf → esm}/ion-picker.entry.js +5 -5
  346. package/dist/{ldf → esm}/ion-popover.entry.js +6 -6
  347. package/dist/{ldf → esm}/ion-progress-bar.entry.js +3 -3
  348. package/dist/{ldf/ion-radio.entry.js → esm/ion-radio_2.entry.js} +57 -4
  349. package/dist/{ldf → esm}/ion-range.entry.js +4 -4
  350. package/dist/{ldf → esm}/ion-refresher-content.entry.js +2 -2
  351. package/dist/{ldf → esm}/ion-refresher.entry.js +7 -57
  352. package/dist/{ldf → esm}/ion-reorder-group.entry.js +4 -4
  353. package/dist/{ldf → esm}/ion-reorder.entry.js +2 -2
  354. package/dist/{ldf → esm}/ion-route-redirect.entry.js +1 -1
  355. package/dist/{ldf → esm}/ion-route.entry.js +1 -1
  356. package/dist/{ldf → esm}/ion-router-link.entry.js +2 -2
  357. package/dist/{ldf → esm}/ion-router-outlet.entry.js +4 -4
  358. package/dist/{ldf → esm}/ion-router.entry.js +2 -2
  359. package/dist/esm/ion-segment_16.entry.js +2488 -0
  360. package/dist/{ldf → esm}/ion-select-popover.entry.js +3 -3
  361. package/dist/{ldf/ion-select.entry.js → esm/ion-select_2.entry.js} +24 -5
  362. package/dist/{ldf → esm}/ion-slide.entry.js +2 -2
  363. package/dist/{ldf → esm}/ion-slides.entry.js +3 -3
  364. package/dist/{ldf → esm}/ion-spinner.entry.js +2 -2
  365. package/dist/{ldf → esm}/ion-split-pane.entry.js +2 -8
  366. package/dist/{ldf → esm}/ion-tab-bar.entry.js +2 -2
  367. package/dist/{ldf → esm}/ion-tab-button.entry.js +2 -2
  368. package/dist/{ldf → esm}/ion-tab.entry.js +1 -9
  369. package/dist/{ldf → esm}/ion-tabs.entry.js +1 -1
  370. package/dist/{ldf → esm}/ion-text.entry.js +2 -2
  371. package/dist/{ldf → esm}/ion-textarea.entry.js +5 -5
  372. package/dist/{ldf → esm}/ion-thumbnail.entry.js +2 -2
  373. package/dist/{ldf → esm}/ion-toast.entry.js +5 -5
  374. package/dist/{ldf → esm}/ion-virtual-scroll.entry.js +1 -1
  375. package/dist/{ldf/ionic-global-98eeb119.js → esm/ionic-global-ef89a0a5.js} +1 -2
  376. package/dist/{ldf/ios.transition-1d534d59.js → esm/ios.transition-b1be0863.js} +4 -4
  377. package/dist/{ldf/ldf-text.entry.js → esm/ldf-day-name_5.entry.js} +508 -126
  378. package/dist/{ldf → esm}/ldf-editable-add-block-menu.entry.js +9 -4
  379. package/dist/{ldf → esm}/ldf-editable-condition-piece.entry.js +24 -4
  380. package/dist/{ldf → esm}/ldf-editable-condition.entry.js +4 -4
  381. package/dist/{ldf → esm}/ldf-editable-filter-documents.entry.js +32 -4
  382. package/dist/{ldf/ldf-editable-metadata-metadata-fields.entry.js → esm/ldf-editable-lookup_2.entry.js} +121 -5
  383. package/dist/{ldf → esm}/ldf-editable-metadata.entry.js +10 -4
  384. package/dist/{ldf → esm}/ldf-editable-preference-option.entry.js +5 -4
  385. package/dist/{ldf → esm}/ldf-editable-preference.entry.js +5 -4
  386. package/dist/{ldf → esm}/ldf-editable-preferences.entry.js +20 -17
  387. package/dist/{ldf → esm}/ldf-editable-string-list.entry.js +4 -4
  388. package/dist/{ldf → esm}/ldf-editor-cursors.entry.js +5 -9
  389. package/dist/{ldf → esm}/ldf-editor.entry.js +6 -4
  390. package/dist/esm/ldf.js +20 -0
  391. package/dist/esm/loader.js +20 -0
  392. package/dist/esm/locale-ec8e14e6.js +6 -0
  393. package/dist/{ldf/md.transition-a8cd439c.js → esm/md.transition-1763f475.js} +4 -4
  394. package/dist/{ldf/menu-toggle-util-9f807d31.js → esm/menu-toggle-util-29e61ff3.js} +1 -1
  395. package/dist/esm/option-da8390ad.js +164 -0
  396. package/dist/{ldf/overlays-10805282.js → esm/overlays-06b43b65.js} +2 -2
  397. package/dist/esm/polyfills/core-js.js +11 -0
  398. package/dist/esm/polyfills/css-shim.js +1 -0
  399. package/dist/esm/polyfills/dom.js +79 -0
  400. package/dist/esm/polyfills/es5-html-element.js +1 -0
  401. package/dist/esm/polyfills/index.js +34 -0
  402. package/dist/esm/polyfills/system.js +6 -0
  403. package/dist/esm/preference-d070d4cb.js +20 -0
  404. package/dist/esm/refrain-75a412cb.js +19 -0
  405. package/dist/esm/rubric-91bf7fed.js +1213 -0
  406. package/dist/esm/specific-class-ef83cfb6.js +36 -0
  407. package/dist/{ldf → esm}/spinner-configs-5dd6891e.js +0 -0
  408. package/dist/{ldf/status-tap-b8afd87d.js → esm/status-tap-7458bd71.js} +1 -1
  409. package/dist/{ldf/swipe-back-2b2f4e51.js → esm/swipe-back-762284df.js} +3 -2
  410. package/dist/{ldf/swiper.bundle-49d79db9.js → esm/swiper.bundle-13b9da83.js} +2 -2
  411. package/dist/{ldf/tap-click-fccc5499.js → esm/tap-click-9b3d603b.js} +1 -1
  412. package/dist/esm/text-ed75fbd4.js +16 -0
  413. package/dist/{ldf → esm}/theme-74c22054.js +0 -0
  414. package/dist/index.cjs.js +1 -0
  415. package/dist/index.js +1 -0
  416. package/dist/ldf/index.esm.js +1 -4
  417. package/dist/ldf/ldf.css +3 -122
  418. package/dist/ldf/ldf.esm.js +1 -123
  419. package/dist/ldf/p-018e57db.entry.js +1 -0
  420. package/dist/ldf/p-03389897.js +1 -0
  421. package/dist/ldf/p-03afc8cb.entry.js +1 -0
  422. package/dist/ldf/p-04715bf0.entry.js +1 -0
  423. package/dist/ldf/p-0491d1d2.js +1 -0
  424. package/dist/ldf/p-07d6d3ad.entry.js +1 -0
  425. package/dist/ldf/p-08584ccc.entry.js +1 -0
  426. package/dist/ldf/p-0873a34a.entry.js +1 -0
  427. package/dist/ldf/p-0ab55cf6.js +1 -0
  428. package/dist/ldf/p-1482a707.js +1 -0
  429. package/dist/ldf/p-177ede88.js +1 -0
  430. package/dist/ldf/p-1902f41e.entry.js +1 -0
  431. package/dist/ldf/p-1a8e2899.entry.js +1 -0
  432. package/dist/ldf/p-1c8cc5bf.entry.js +1 -0
  433. package/dist/ldf/p-1ff665a7.entry.js +1 -0
  434. package/dist/ldf/p-21e2f0a3.entry.js +1 -0
  435. package/dist/ldf/p-23af1bc3.entry.js +1 -0
  436. package/dist/ldf/p-25a736f1.entry.js +1 -0
  437. package/dist/ldf/p-2ae548b3.entry.js +1 -0
  438. package/dist/ldf/p-2c36a583.entry.js +1 -0
  439. package/dist/ldf/p-302dc0d5.entry.js +1 -0
  440. package/dist/ldf/p-327b14ac.entry.js +1 -0
  441. package/dist/ldf/p-32f7ba8e.entry.js +1 -0
  442. package/dist/ldf/p-3545fcdc.entry.js +1 -0
  443. package/dist/ldf/p-374118d7.entry.js +1 -0
  444. package/dist/ldf/p-380f8655.entry.js +1 -0
  445. package/dist/ldf/p-3c9930ff.entry.js +1 -0
  446. package/dist/ldf/p-3ca74c80.js +8 -0
  447. package/dist/ldf/p-3e8ff66b.js +1 -0
  448. package/dist/ldf/p-3f39c2ad.entry.js +1 -0
  449. package/dist/ldf/p-3f8ef67b.entry.js +1 -0
  450. package/dist/ldf/p-402c811f.js +1 -0
  451. package/dist/ldf/p-430c418a.entry.js +1 -0
  452. package/dist/ldf/p-476327d6.js +1 -0
  453. package/dist/ldf/p-48e44122.js +1 -0
  454. package/dist/ldf/p-4a4380fa.entry.js +1 -0
  455. package/dist/ldf/p-4aa9a6f2.js +1 -0
  456. package/dist/ldf/p-4b80de48.js +1 -0
  457. package/dist/ldf/p-4e0b3c0f.entry.js +1 -0
  458. package/dist/ldf/p-5066eaa5.js +1 -0
  459. package/dist/ldf/p-52656429.entry.js +1 -0
  460. package/dist/ldf/p-55d797c1.js +1 -0
  461. package/dist/ldf/p-59340423.entry.js +1 -0
  462. package/dist/ldf/p-594fa9d4.entry.js +1 -0
  463. package/dist/ldf/p-5b43e6be.js +1 -0
  464. package/dist/ldf/p-5b51185b.js +1 -0
  465. package/dist/ldf/p-5be7ff17.entry.js +1 -0
  466. package/dist/ldf/p-5ea6de28.entry.js +1 -0
  467. package/dist/ldf/p-63b5daf6.entry.js +1 -0
  468. package/dist/ldf/p-65563763.entry.js +1 -0
  469. package/dist/ldf/p-65d26c45.js +1 -0
  470. package/dist/ldf/p-65ea7ab3.entry.js +1 -0
  471. package/dist/ldf/p-66a7385e.entry.js +1 -0
  472. package/dist/ldf/p-6857574d.js +1 -0
  473. package/dist/ldf/p-69f85ad3.entry.js +1 -0
  474. package/dist/ldf/p-6fe24d85.entry.js +1 -0
  475. package/dist/ldf/p-70e47f8b.entry.js +1 -0
  476. package/dist/ldf/p-714cf0b2.js +1 -0
  477. package/dist/ldf/p-718ae824.js +1 -0
  478. package/dist/ldf/p-78da8fe1.js +1 -0
  479. package/dist/ldf/p-79a526a1.entry.js +1 -0
  480. package/dist/ldf/p-7abeb82c.entry.js +1 -0
  481. package/dist/ldf/p-7efa633b.entry.js +1 -0
  482. package/dist/ldf/p-800a115c.entry.js +1 -0
  483. package/dist/ldf/p-84f38db6.entry.js +1 -0
  484. package/dist/ldf/p-8767a74e.entry.js +1 -0
  485. package/dist/ldf/p-88dbd8b6.js +1 -0
  486. package/dist/ldf/p-8932ec85.entry.js +1 -0
  487. package/dist/ldf/p-8c2727db.entry.js +1 -0
  488. package/dist/ldf/p-8ec26587.js +1 -0
  489. package/dist/ldf/p-8f67abb8.js +3 -0
  490. package/dist/ldf/p-9155f066.js +1 -0
  491. package/dist/ldf/p-978e2c6d.js +1 -0
  492. package/dist/ldf/p-991c0877.js +1 -0
  493. package/dist/ldf/p-9bd5d1d4.entry.js +1 -0
  494. package/dist/ldf/p-9c1973a6.entry.js +1 -0
  495. package/dist/ldf/p-9c397c49.entry.js +1 -0
  496. package/dist/ldf/p-9e2c172e.entry.js +1 -0
  497. package/dist/ldf/p-a1729dbd.js +1 -0
  498. package/dist/ldf/p-ac7a17ce.entry.js +1 -0
  499. package/dist/ldf/p-acbbd1ec.js +1 -0
  500. package/dist/ldf/p-afc1a02c.js +1 -0
  501. package/dist/ldf/p-b1242016.js +1 -0
  502. package/dist/ldf/p-b62e8f49.js +1 -0
  503. package/dist/ldf/p-b7388aec.entry.js +1 -0
  504. package/dist/ldf/p-b78336d7.entry.js +1 -0
  505. package/dist/ldf/p-ba021918.entry.js +1 -0
  506. package/dist/ldf/p-bdcf2b02.entry.js +1 -0
  507. package/dist/ldf/p-c1df632d.entry.js +1 -0
  508. package/dist/ldf/p-c3042920.entry.js +1 -0
  509. package/dist/ldf/p-c3807857.entry.js +1 -0
  510. package/dist/ldf/p-c3841978.entry.js +1 -0
  511. package/dist/ldf/p-c41e055c.entry.js +1 -0
  512. package/dist/ldf/p-c60a875b.js +1 -0
  513. package/dist/ldf/p-c6163f81.entry.js +1 -0
  514. package/dist/ldf/p-c6a8f4aa.js +1 -0
  515. package/dist/ldf/p-c6b42618.entry.js +1 -0
  516. package/dist/ldf/p-c74d3fd0.entry.js +1 -0
  517. package/dist/ldf/p-c82dd468.entry.js +1 -0
  518. package/dist/ldf/p-ca698b8f.entry.js +1 -0
  519. package/dist/ldf/p-cbfbb80c.entry.js +1 -0
  520. package/dist/ldf/p-d195c957.entry.js +1 -0
  521. package/dist/ldf/p-d282d4f9.js +1 -0
  522. package/dist/ldf/p-d7966e9b.entry.js +1 -0
  523. package/dist/ldf/p-d7f8c770.js +1 -0
  524. package/dist/ldf/p-d9c1c1f6.js +1 -0
  525. package/dist/ldf/p-dc445c36.entry.js +1 -0
  526. package/dist/ldf/p-dd99e42a.entry.js +1 -0
  527. package/dist/ldf/p-de5bb5ad.js +1 -0
  528. package/dist/ldf/p-e0e12ae3.entry.js +1 -0
  529. package/dist/ldf/p-e215fd02.entry.js +1 -0
  530. package/dist/ldf/p-e4be11ad.entry.js +1 -0
  531. package/dist/ldf/p-e4f0cd91.entry.js +1 -0
  532. package/dist/ldf/p-e911e60d.js +1 -0
  533. package/dist/ldf/p-ea66c343.entry.js +1 -0
  534. package/dist/ldf/p-ec5eecdc.entry.js +1 -0
  535. package/dist/ldf/p-ed3327fa.js +1 -0
  536. package/dist/ldf/p-f0de7628.entry.js +1 -0
  537. package/dist/ldf/p-f2ce126e.js +1 -0
  538. package/dist/ldf/p-f3a0c163.js +1 -0
  539. package/dist/ldf/p-fa191f47.entry.js +1 -0
  540. package/dist/ldf/p-fe59a676.entry.js +1 -0
  541. package/dist/node_modules/@ionic/core/dist/collection/components/action-sheet/action-sheet.ios.css +363 -0
  542. package/dist/node_modules/@ionic/core/dist/collection/components/action-sheet/action-sheet.md.css +285 -0
  543. package/dist/node_modules/@ionic/core/dist/collection/components/alert/alert.ios.css +483 -0
  544. package/dist/node_modules/@ionic/core/dist/collection/components/alert/alert.md.css +501 -0
  545. package/dist/node_modules/@ionic/core/dist/collection/components/app/app.css +7 -0
  546. package/dist/node_modules/@ionic/core/dist/collection/components/avatar/avatar.ios.css +22 -0
  547. package/dist/node_modules/@ionic/core/dist/collection/components/avatar/avatar.md.css +22 -0
  548. package/dist/node_modules/@ionic/core/dist/collection/components/back-button/back-button.ios.css +277 -0
  549. package/dist/node_modules/@ionic/core/dist/collection/components/back-button/back-button.md.css +305 -0
  550. package/dist/node_modules/@ionic/core/dist/collection/components/backdrop/backdrop.ios.css +26 -0
  551. package/dist/node_modules/@ionic/core/dist/collection/components/backdrop/backdrop.md.css +26 -0
  552. package/dist/node_modules/@ionic/core/dist/collection/components/badge/badge.ios.css +58 -0
  553. package/dist/node_modules/@ionic/core/dist/collection/components/badge/badge.md.css +62 -0
  554. package/dist/node_modules/@ionic/core/dist/collection/components/button/button.ios.css +440 -0
  555. package/dist/node_modules/@ionic/core/dist/collection/components/button/button.md.css +428 -0
  556. package/dist/node_modules/@ionic/core/dist/collection/components/buttons/buttons.ios.css +128 -0
  557. package/dist/node_modules/@ionic/core/dist/collection/components/buttons/buttons.md.css +151 -0
  558. package/dist/node_modules/@ionic/core/dist/collection/components/card/card.ios.css +101 -0
  559. package/dist/node_modules/@ionic/core/dist/collection/components/card/card.md.css +95 -0
  560. package/dist/node_modules/@ionic/core/dist/collection/components/card-content/card-content.ios.css +61 -0
  561. package/dist/node_modules/@ionic/core/dist/collection/components/card-content/card-content.md.css +63 -0
  562. package/dist/node_modules/@ionic/core/dist/collection/components/card-header/card-header.ios.css +37 -0
  563. package/dist/node_modules/@ionic/core/dist/collection/components/card-header/card-header.md.css +35 -0
  564. package/dist/node_modules/@ionic/core/dist/collection/components/card-subtitle/card-subtitle.ios.css +28 -0
  565. package/dist/node_modules/@ionic/core/dist/collection/components/card-subtitle/card-subtitle.md.css +26 -0
  566. package/dist/node_modules/@ionic/core/dist/collection/components/card-title/card-title.ios.css +27 -0
  567. package/dist/node_modules/@ionic/core/dist/collection/components/card-title/card-title.md.css +27 -0
  568. package/dist/node_modules/@ionic/core/dist/collection/components/checkbox/checkbox.ios.css +147 -0
  569. package/dist/node_modules/@ionic/core/dist/collection/components/checkbox/checkbox.md.css +150 -0
  570. package/dist/node_modules/@ionic/core/dist/collection/components/chip/chip.ios.css +194 -0
  571. package/dist/node_modules/@ionic/core/dist/collection/components/chip/chip.md.css +194 -0
  572. package/dist/node_modules/@ionic/core/dist/collection/components/col/col.css +108 -0
  573. package/dist/node_modules/@ionic/core/dist/collection/components/content/content.css +167 -0
  574. package/dist/node_modules/@ionic/core/dist/collection/components/datetime/datetime.ios.css +106 -0
  575. package/dist/node_modules/@ionic/core/dist/collection/components/datetime/datetime.md.css +106 -0
  576. package/dist/node_modules/@ionic/core/dist/collection/components/fab/fab.css +61 -0
  577. package/dist/node_modules/@ionic/core/dist/collection/components/fab-button/fab-button.ios.css +324 -0
  578. package/dist/node_modules/@ionic/core/dist/collection/components/fab-button/fab-button.md.css +293 -0
  579. package/dist/node_modules/@ionic/core/dist/collection/components/fab-list/fab-list.css +116 -0
  580. package/dist/node_modules/@ionic/core/dist/collection/components/footer/footer.ios.css +33 -0
  581. package/dist/node_modules/@ionic/core/dist/collection/components/footer/footer.md.css +37 -0
  582. package/dist/node_modules/@ionic/core/dist/collection/components/grid/grid.css +151 -0
  583. package/dist/node_modules/@ionic/core/dist/collection/components/header/header.ios.css +92 -0
  584. package/dist/node_modules/@ionic/core/dist/collection/components/header/header.md.css +40 -0
  585. package/dist/node_modules/@ionic/core/dist/collection/components/img/img.css +12 -0
  586. package/dist/node_modules/@ionic/core/dist/collection/components/infinite-scroll/infinite-scroll.css +8 -0
  587. package/dist/node_modules/@ionic/core/dist/collection/components/infinite-scroll-content/infinite-scroll-content.ios.css +54 -0
  588. package/dist/node_modules/@ionic/core/dist/collection/components/infinite-scroll-content/infinite-scroll-content.md.css +54 -0
  589. package/dist/node_modules/@ionic/core/dist/collection/components/input/input.ios.css +172 -0
  590. package/dist/node_modules/@ionic/core/dist/collection/components/input/input.md.css +172 -0
  591. package/dist/node_modules/@ionic/core/dist/collection/components/item/item.ios.css +563 -0
  592. package/dist/node_modules/@ionic/core/dist/collection/components/item/item.md.css +630 -0
  593. package/dist/node_modules/@ionic/core/dist/collection/components/item-divider/item-divider.ios.css +204 -0
  594. package/dist/node_modules/@ionic/core/dist/collection/components/item-divider/item-divider.md.css +297 -0
  595. package/dist/node_modules/@ionic/core/dist/collection/components/item-group/item-group.ios.css +3 -0
  596. package/dist/node_modules/@ionic/core/dist/collection/components/item-group/item-group.md.css +3 -0
  597. package/dist/node_modules/@ionic/core/dist/collection/components/item-option/item-option.ios.css +186 -0
  598. package/dist/node_modules/@ionic/core/dist/collection/components/item-option/item-option.md.css +180 -0
  599. package/dist/node_modules/@ionic/core/dist/collection/components/item-options/item-options.ios.css +88 -0
  600. package/dist/node_modules/@ionic/core/dist/collection/components/item-options/item-options.md.css +85 -0
  601. package/dist/node_modules/@ionic/core/dist/collection/components/item-sliding/item-sliding.css +42 -0
  602. package/dist/node_modules/@ionic/core/dist/collection/components/label/label.ios.css +152 -0
  603. package/dist/node_modules/@ionic/core/dist/collection/components/label/label.md.css +163 -0
  604. package/dist/node_modules/@ionic/core/dist/collection/components/list/list.ios.css +91 -0
  605. package/dist/node_modules/@ionic/core/dist/collection/components/list/list.md.css +114 -0
  606. package/dist/node_modules/@ionic/core/dist/collection/components/list-header/list-header.ios.css +118 -0
  607. package/dist/node_modules/@ionic/core/dist/collection/components/list-header/list-header.md.css +94 -0
  608. package/dist/node_modules/@ionic/core/dist/collection/components/loading/loading.ios.css +113 -0
  609. package/dist/node_modules/@ionic/core/dist/collection/components/loading/loading.md.css +104 -0
  610. package/dist/node_modules/@ionic/core/dist/collection/components/menu/menu.ios.css +131 -0
  611. package/dist/node_modules/@ionic/core/dist/collection/components/menu/menu.md.css +127 -0
  612. package/dist/node_modules/@ionic/core/dist/collection/components/menu-button/menu-button.ios.css +175 -0
  613. package/dist/node_modules/@ionic/core/dist/collection/components/menu-button/menu-button.md.css +178 -0
  614. package/dist/node_modules/@ionic/core/dist/collection/components/menu-toggle/menu-toggle.css +3 -0
  615. package/dist/node_modules/@ionic/core/dist/collection/components/modal/modal.ios.css +158 -0
  616. package/dist/node_modules/@ionic/core/dist/collection/components/modal/modal.md.css +104 -0
  617. package/dist/node_modules/@ionic/core/dist/collection/components/nav/nav.css +10 -0
  618. package/dist/node_modules/@ionic/core/dist/collection/components/note/note.ios.css +16 -0
  619. package/dist/node_modules/@ionic/core/dist/collection/components/note/note.md.css +17 -0
  620. package/dist/node_modules/@ionic/core/dist/collection/components/picker/picker.ios.css +216 -0
  621. package/dist/node_modules/@ionic/core/dist/collection/components/picker/picker.md.css +203 -0
  622. package/dist/node_modules/@ionic/core/dist/collection/components/picker-column/picker-column.ios.css +122 -0
  623. package/dist/node_modules/@ionic/core/dist/collection/components/picker-column/picker-column.md.css +123 -0
  624. package/dist/node_modules/@ionic/core/dist/collection/components/popover/popover.ios.css +117 -0
  625. package/dist/node_modules/@ionic/core/dist/collection/components/popover/popover.md.css +82 -0
  626. package/dist/node_modules/@ionic/core/dist/collection/components/progress-bar/progress-bar.ios.css +191 -0
  627. package/dist/node_modules/@ionic/core/dist/collection/components/progress-bar/progress-bar.md.css +191 -0
  628. package/dist/node_modules/@ionic/core/dist/collection/components/radio/radio.ios.css +151 -0
  629. package/dist/node_modules/@ionic/core/dist/collection/components/radio/radio.md.css +152 -0
  630. package/dist/node_modules/@ionic/core/dist/collection/components/range/range.ios.css +275 -0
  631. package/dist/node_modules/@ionic/core/dist/collection/components/range/range.md.css +320 -0
  632. package/dist/node_modules/@ionic/core/dist/collection/components/refresher/refresher.ios.css +177 -0
  633. package/dist/node_modules/@ionic/core/dist/collection/components/refresher/refresher.md.css +210 -0
  634. package/dist/node_modules/@ionic/core/dist/collection/components/reorder/reorder.ios.css +15 -0
  635. package/dist/node_modules/@ionic/core/dist/collection/components/reorder/reorder.md.css +15 -0
  636. package/dist/node_modules/@ionic/core/dist/collection/components/reorder-group/reorder-group.css +33 -0
  637. package/dist/node_modules/@ionic/core/dist/collection/components/ripple-effect/ripple-effect.css +58 -0
  638. package/dist/node_modules/@ionic/core/dist/collection/components/router-link/router-link.css +29 -0
  639. package/dist/node_modules/@ionic/core/dist/collection/components/router-outlet/route-outlet.css +10 -0
  640. package/dist/node_modules/@ionic/core/dist/collection/components/row/row.css +4 -0
  641. package/dist/node_modules/@ionic/core/dist/collection/components/searchbar/searchbar.ios.css +348 -0
  642. package/dist/node_modules/@ionic/core/dist/collection/components/searchbar/searchbar.md.css +279 -0
  643. package/dist/node_modules/@ionic/core/dist/collection/components/segment/segment.ios.css +64 -0
  644. package/dist/node_modules/@ionic/core/dist/collection/components/segment/segment.md.css +35 -0
  645. package/dist/node_modules/@ionic/core/dist/collection/components/segment-button/segment-button.ios.css +442 -0
  646. package/dist/node_modules/@ionic/core/dist/collection/components/segment-button/segment-button.md.css +424 -0
  647. package/dist/node_modules/@ionic/core/dist/collection/components/select/select.ios.css +123 -0
  648. package/dist/node_modules/@ionic/core/dist/collection/components/select/select.md.css +123 -0
  649. package/dist/node_modules/@ionic/core/dist/collection/components/select-option/select-option.css +3 -0
  650. package/dist/node_modules/@ionic/core/dist/collection/components/select-popover/select-popover.css +14 -0
  651. package/dist/node_modules/@ionic/core/dist/collection/components/skeleton-text/skeleton-text.css +53 -0
  652. package/dist/node_modules/@ionic/core/dist/collection/components/slide/slide.css +31 -0
  653. package/dist/node_modules/@ionic/core/dist/collection/components/slides/slides.ios.css +764 -0
  654. package/dist/node_modules/@ionic/core/dist/collection/components/slides/slides.md.css +764 -0
  655. package/dist/node_modules/@ionic/core/dist/collection/components/spinner/spinner.css +154 -0
  656. package/dist/node_modules/@ionic/core/dist/collection/components/split-pane/split-pane.ios.css +108 -0
  657. package/dist/node_modules/@ionic/core/dist/collection/components/split-pane/split-pane.md.css +108 -0
  658. package/dist/node_modules/@ionic/core/dist/collection/components/tab/tab.css +4 -0
  659. package/dist/node_modules/@ionic/core/dist/collection/components/tab-bar/tab-bar.ios.css +96 -0
  660. package/dist/node_modules/@ionic/core/dist/collection/components/tab-bar/tab-bar.md.css +81 -0
  661. package/dist/node_modules/@ionic/core/dist/collection/components/tab-button/tab-button.ios.css +308 -0
  662. package/dist/node_modules/@ionic/core/dist/collection/components/tab-button/tab-button.md.css +331 -0
  663. package/dist/node_modules/@ionic/core/dist/collection/components/tabs/tabs.css +19 -0
  664. package/dist/node_modules/@ionic/core/dist/collection/components/text/text.css +3 -0
  665. package/dist/node_modules/@ionic/core/dist/collection/components/textarea/textarea.ios.css +142 -0
  666. package/dist/node_modules/@ionic/core/dist/collection/components/textarea/textarea.md.css +146 -0
  667. package/dist/node_modules/@ionic/core/dist/collection/components/thumbnail/thumbnail.css +21 -0
  668. package/dist/node_modules/@ionic/core/dist/collection/components/title/title.ios.css +110 -0
  669. package/dist/node_modules/@ionic/core/dist/collection/components/title/title.md.css +55 -0
  670. package/dist/node_modules/@ionic/core/dist/collection/components/toast/toast.ios.css +249 -0
  671. package/dist/node_modules/@ionic/core/dist/collection/components/toast/toast.md.css +282 -0
  672. package/dist/node_modules/@ionic/core/dist/collection/components/toggle/toggle.ios.css +214 -0
  673. package/dist/node_modules/@ionic/core/dist/collection/components/toggle/toggle.md.css +211 -0
  674. package/dist/node_modules/@ionic/core/dist/collection/components/toolbar/toolbar.ios.css +174 -0
  675. package/dist/node_modules/@ionic/core/dist/collection/components/toolbar/toolbar.md.css +167 -0
  676. package/dist/node_modules/@ionic/core/dist/collection/components/virtual-scroll/virtual-scroll.css +21 -0
  677. package/dist/node_modules/ionicons/dist/collection/components/icon/icon.css +101 -0
  678. package/package.json +2 -2
  679. package/dist/ldf/_commonjsHelpers-8fe71198.js +0 -44
  680. package/dist/ldf/css-shim-5630fd5e.js +0 -4
  681. package/dist/ldf/dom-bd0bf1dc.js +0 -73
  682. package/dist/ldf/index-f441adec.js +0 -2901
  683. package/dist/ldf/index-f4e3260e.js +0 -36
  684. package/dist/ldf/ion-button.entry.js +0 -109
  685. package/dist/ldf/ion-buttons.entry.js +0 -38
  686. package/dist/ldf/ion-card-content.entry.js +0 -26
  687. package/dist/ldf/ion-card-header.entry.js +0 -29
  688. package/dist/ldf/ion-card-title.entry.js +0 -23
  689. package/dist/ldf/ion-col.entry.js +0 -114
  690. package/dist/ldf/ion-content.entry.js +0 -299
  691. package/dist/ldf/ion-grid.entry.js +0 -24
  692. package/dist/ldf/ion-header.entry.js +0 -255
  693. package/dist/ldf/ion-icon.entry.js +0 -172
  694. package/dist/ldf/ion-input.entry.js +0 -216
  695. package/dist/ldf/ion-item.entry.js +0 -119
  696. package/dist/ldf/ion-label.entry.js +0 -51
  697. package/dist/ldf/ion-list.entry.js +0 -48
  698. package/dist/ldf/ion-radio-group.entry.js +0 -57
  699. package/dist/ldf/ion-ripple-effect.entry.js +0 -89
  700. package/dist/ldf/ion-row.entry.js +0 -16
  701. package/dist/ldf/ion-searchbar.entry.js +0 -326
  702. package/dist/ldf/ion-segment-button.entry.js +0 -88
  703. package/dist/ldf/ion-segment.entry.js +0 -296
  704. package/dist/ldf/ion-select-option.entry.js +0 -23
  705. package/dist/ldf/ion-skeleton-text.entry.js +0 -29
  706. package/dist/ldf/ion-title.entry.js +0 -44
  707. package/dist/ldf/ion-toggle.entry.js +0 -152
  708. package/dist/ldf/ion-toolbar.entry.js +0 -67
  709. package/dist/ldf/ldf-bible-reading.entry.js +0 -252
  710. package/dist/ldf/ldf-editable-add-block.entry.js +0 -49
  711. package/dist/ldf/ldf-editable-antiphon-field.entry.js +0 -223
  712. package/dist/ldf/ldf-editable-boolean.entry.js +0 -42
  713. package/dist/ldf/ldf-editable-delete.entry.js +0 -97
  714. package/dist/ldf/ldf-editable-lookup.entry.js +0 -115
  715. package/dist/ldf/ldf-editable-metadata-buttons.entry.js +0 -293
  716. package/dist/ldf/ldf-editable-select.entry.js +0 -33
  717. package/dist/ldf/ldf-heading.entry.js +0 -124
  718. package/dist/ldf/ldf-image.entry.js +0 -195
  719. package/dist/ldf/ldf-label-bar.entry.js +0 -22
  720. package/dist/ldf/ldf-liturgical-document.entry.js +0 -462
  721. package/dist/ldf/ldf-liturgy.entry.js +0 -49
  722. package/dist/ldf/ldf-meditation.entry.js +0 -180
  723. package/dist/ldf/ldf-prayers-and-thanksgivings.entry.js +0 -136
  724. package/dist/ldf/ldf-psalm.entry.js +0 -267
  725. package/dist/ldf/ldf-refrain.entry.js +0 -42
  726. package/dist/ldf/ldf-responsive-prayer.entry.js +0 -137
  727. package/dist/ldf/ldf-rubric.entry.js +0 -41
  728. package/dist/ldf/shadow-css-10669ec3.js +0 -383
  729. package/dist/ldf/utils-8d15f916.js +0 -91
@@ -0,0 +1,2645 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-8fe0df8d.js');
6
+ const ionicGlobal = require('./ionic-global-581fb4f8.js');
7
+ const helpers = require('./helpers-41dfb43a.js');
8
+ const theme = require('./theme-81caa5b0.js');
9
+ const index$1 = require('./index-7aa21373.js');
10
+ require('./book-1a92678a.js');
11
+ const cursor = require('./cursor-81bfd01e.js');
12
+ const change = require('./change-cdb1e8c0.js');
13
+ const _commonjsHelpers = require('./_commonjsHelpers-bcc1208a.js');
14
+ const locale = require('./locale-d4e925b1.js');
15
+
16
+ const inputIosCss = ".sc-ion-input-ios-h{--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:.5;--padding-top:0;--padding-end:0;--padding-bottom:0;--padding-start:0;--background:transparent;--color:initial;display:flex;position:relative;flex:1;align-items:center;width:100%;padding:0 !important;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);z-index:2}ion-item.sc-ion-input-ios-h:not(.item-label),ion-item:not(.item-label) .sc-ion-input-ios-h{--padding-start:0}.ion-color.sc-ion-input-ios-h{color:var(--ion-color-base)}.native-input.sc-ion-input-ios{border-radius:var(--border-radius);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:inline-block;flex:1;width:100%;max-width:100%;max-height:100%;border:0;outline:none;background:transparent;box-sizing:border-box;appearance:none}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.native-input.sc-ion-input-ios{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.native-input.sc-ion-input-ios::placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-ios:-webkit-autofill{background-color:transparent}.native-input.sc-ion-input-ios:invalid{box-shadow:none}.native-input.sc-ion-input-ios::-ms-clear{display:none}.native-input[disabled].sc-ion-input-ios{opacity:0.4}.cloned-input.sc-ion-input-ios{left:0;top:0;position:absolute;pointer-events:none}[dir=rtl].sc-ion-input-ios .cloned-input.sc-ion-input-ios,[dir=rtl].sc-ion-input-ios-h .cloned-input.sc-ion-input-ios,[dir=rtl] .sc-ion-input-ios-h .cloned-input.sc-ion-input-ios{left:unset;right:unset;right:0}.input-clear-icon.sc-ion-input-ios{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;background-position:center;border:0;outline:none;background-color:transparent;background-repeat:no-repeat;visibility:hidden;appearance:none}.has-focus.has-value.sc-ion-input-ios-h .input-clear-icon.sc-ion-input-ios{visibility:visible}.has-focus.sc-ion-input-ios-h{pointer-events:none}.has-focus.sc-ion-input-ios-h input.sc-ion-input-ios,.has-focus.sc-ion-input-ios-h a.sc-ion-input-ios,.has-focus.sc-ion-input-ios-h button.sc-ion-input-ios{pointer-events:auto}.sc-ion-input-ios-h{--padding-top:10px;--padding-end:10px;--padding-bottom:10px;--padding-start:0;font-size:inherit}.item-label-stacked.sc-ion-input-ios-h,.item-label-stacked .sc-ion-input-ios-h,.item-label-floating.sc-ion-input-ios-h,.item-label-floating .sc-ion-input-ios-h{--padding-top:8px;--padding-bottom:8px;--padding-start:0px}.input-clear-icon.sc-ion-input-ios{background-image:url(\"data:image/svg+xml;charset=utf-8,<svg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'><path%20fill='var(--ion-color-step-600,%20%23666666)'%20d='M403.1,108.9c-81.2-81.2-212.9-81.2-294.2,0s-81.2,212.9,0,294.2c81.2,81.2,212.9,81.2,294.2,0S484.3,190.1,403.1,108.9z%20M352,340.2L340.2,352l-84.4-84.2l-84,83.8L160,339.8l84-83.8l-84-83.8l11.8-11.8l84,83.8l84.4-84.2l11.8,11.8L267.6,256L352,340.2z'/></svg>\");width:30px;height:30px;background-size:18px}";
17
+
18
+ const inputMdCss = ".sc-ion-input-md-h{--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:.5;--padding-top:0;--padding-end:0;--padding-bottom:0;--padding-start:0;--background:transparent;--color:initial;display:flex;position:relative;flex:1;align-items:center;width:100%;padding:0 !important;background:var(--background);color:var(--color);font-family:var(--ion-font-family, inherit);z-index:2}ion-item.sc-ion-input-md-h:not(.item-label),ion-item:not(.item-label) .sc-ion-input-md-h{--padding-start:0}.ion-color.sc-ion-input-md-h{color:var(--ion-color-base)}.native-input.sc-ion-input-md{border-radius:var(--border-radius);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-indent:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:inline-block;flex:1;width:100%;max-width:100%;max-height:100%;border:0;outline:none;background:transparent;box-sizing:border-box;appearance:none}@supports (margin-inline-start: 0) or (-webkit-margin-start: 0){.native-input.sc-ion-input-md{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.native-input.sc-ion-input-md::placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-md:-webkit-autofill{background-color:transparent}.native-input.sc-ion-input-md:invalid{box-shadow:none}.native-input.sc-ion-input-md::-ms-clear{display:none}.native-input[disabled].sc-ion-input-md{opacity:0.4}.cloned-input.sc-ion-input-md{left:0;top:0;position:absolute;pointer-events:none}[dir=rtl].sc-ion-input-md .cloned-input.sc-ion-input-md,[dir=rtl].sc-ion-input-md-h .cloned-input.sc-ion-input-md,[dir=rtl] .sc-ion-input-md-h .cloned-input.sc-ion-input-md{left:unset;right:unset;right:0}.input-clear-icon.sc-ion-input-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;background-position:center;border:0;outline:none;background-color:transparent;background-repeat:no-repeat;visibility:hidden;appearance:none}.has-focus.has-value.sc-ion-input-md-h .input-clear-icon.sc-ion-input-md{visibility:visible}.has-focus.sc-ion-input-md-h{pointer-events:none}.has-focus.sc-ion-input-md-h input.sc-ion-input-md,.has-focus.sc-ion-input-md-h a.sc-ion-input-md,.has-focus.sc-ion-input-md-h button.sc-ion-input-md{pointer-events:auto}.sc-ion-input-md-h{--padding-top:10px;--padding-end:0;--padding-bottom:10px;--padding-start:8px;font-size:inherit}.item-label-stacked.sc-ion-input-md-h,.item-label-stacked .sc-ion-input-md-h,.item-label-floating.sc-ion-input-md-h,.item-label-floating .sc-ion-input-md-h{--padding-top:8px;--padding-bottom:8px;--padding-start:0}.input-clear-icon.sc-ion-input-md{background-image:url(\"data:image/svg+xml;charset=utf-8,<svg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'><polygon%20fill='var(--ion-color-step-600,%20%23666666)'%20points='405,136.798%20375.202,107%20256,226.202%20136.798,107%20107,136.798%20226.202,256%20107,375.202%20136.798,405%20256,285.798%20375.202,405%20405,375.202%20285.798,256'/></svg>\");width:30px;height:30px;background-size:22px}";
19
+
20
+ const Input = class {
21
+ constructor(hostRef) {
22
+ index.registerInstance(this, hostRef);
23
+ this.ionInput = index.createEvent(this, "ionInput", 7);
24
+ this.ionChange = index.createEvent(this, "ionChange", 7);
25
+ this.ionBlur = index.createEvent(this, "ionBlur", 7);
26
+ this.ionFocus = index.createEvent(this, "ionFocus", 7);
27
+ this.ionStyle = index.createEvent(this, "ionStyle", 7);
28
+ this.inputId = `ion-input-${inputIds++}`;
29
+ this.didBlurAfterEdit = false;
30
+ this.hasFocus = false;
31
+ /**
32
+ * Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.
33
+ */
34
+ this.autocapitalize = 'off';
35
+ /**
36
+ * Indicates whether the value of the control can be automatically completed by the browser.
37
+ */
38
+ this.autocomplete = 'off';
39
+ /**
40
+ * Whether auto correction should be enabled when the user is entering/editing the text value.
41
+ */
42
+ this.autocorrect = 'off';
43
+ /**
44
+ * This Boolean attribute lets you specify that a form control should have input focus when the page loads.
45
+ */
46
+ this.autofocus = false;
47
+ /**
48
+ * If `true`, a clear icon will appear in the input when there is a value. Clicking it clears the input.
49
+ */
50
+ this.clearInput = false;
51
+ /**
52
+ * Set the amount of time, in milliseconds, to wait to trigger the `ionChange` event after each keystroke.
53
+ */
54
+ this.debounce = 0;
55
+ /**
56
+ * If `true`, the user cannot interact with the input.
57
+ */
58
+ this.disabled = false;
59
+ /**
60
+ * The name of the control, which is submitted with the form data.
61
+ */
62
+ this.name = this.inputId;
63
+ /**
64
+ * If `true`, the user cannot modify the value.
65
+ */
66
+ this.readonly = false;
67
+ /**
68
+ * If `true`, the user must fill in a value before submitting a form.
69
+ */
70
+ this.required = false;
71
+ /**
72
+ * If `true`, the element will have its spelling and grammar checked.
73
+ */
74
+ this.spellcheck = false;
75
+ /**
76
+ * The type of control to display. The default type is text.
77
+ */
78
+ this.type = 'text';
79
+ /**
80
+ * The value of the input.
81
+ */
82
+ this.value = '';
83
+ this.onInput = (ev) => {
84
+ const input = ev.target;
85
+ if (input) {
86
+ this.value = input.value || '';
87
+ }
88
+ this.ionInput.emit(ev);
89
+ };
90
+ this.onBlur = () => {
91
+ this.hasFocus = false;
92
+ this.focusChanged();
93
+ this.emitStyle();
94
+ this.ionBlur.emit();
95
+ };
96
+ this.onFocus = () => {
97
+ this.hasFocus = true;
98
+ this.focusChanged();
99
+ this.emitStyle();
100
+ this.ionFocus.emit();
101
+ };
102
+ this.onKeydown = (ev) => {
103
+ if (this.shouldClearOnEdit()) {
104
+ // Did the input value change after it was blurred and edited?
105
+ // Do not clear if user is hitting Enter to submit form
106
+ if (this.didBlurAfterEdit && this.hasValue() && ev.key !== 'Enter') {
107
+ // Clear the input
108
+ this.clearTextInput();
109
+ }
110
+ // Reset the flag
111
+ this.didBlurAfterEdit = false;
112
+ }
113
+ };
114
+ this.clearTextInput = (ev) => {
115
+ if (this.clearInput && !this.readonly && !this.disabled && ev) {
116
+ ev.preventDefault();
117
+ ev.stopPropagation();
118
+ }
119
+ this.value = '';
120
+ /**
121
+ * This is needed for clearOnEdit
122
+ * Otherwise the value will not be cleared
123
+ * if user is inside the input
124
+ */
125
+ if (this.nativeInput) {
126
+ this.nativeInput.value = '';
127
+ }
128
+ };
129
+ }
130
+ debounceChanged() {
131
+ this.ionChange = helpers.debounceEvent(this.ionChange, this.debounce);
132
+ }
133
+ disabledChanged() {
134
+ this.emitStyle();
135
+ }
136
+ /**
137
+ * Update the native input element when the value changes
138
+ */
139
+ valueChanged() {
140
+ this.emitStyle();
141
+ this.ionChange.emit({ value: this.value == null ? this.value : this.value.toString() });
142
+ }
143
+ connectedCallback() {
144
+ this.emitStyle();
145
+ this.debounceChanged();
146
+ {
147
+ document.dispatchEvent(new CustomEvent('ionInputDidLoad', {
148
+ detail: this.el
149
+ }));
150
+ }
151
+ }
152
+ disconnectedCallback() {
153
+ {
154
+ document.dispatchEvent(new CustomEvent('ionInputDidUnload', {
155
+ detail: this.el
156
+ }));
157
+ }
158
+ }
159
+ /**
160
+ * Sets focus on the specified `ion-input`. Use this method instead of the global
161
+ * `input.focus()`.
162
+ */
163
+ async setFocus() {
164
+ if (this.nativeInput) {
165
+ this.nativeInput.focus();
166
+ }
167
+ }
168
+ /**
169
+ * Returns the native `<input>` element used under the hood.
170
+ */
171
+ getInputElement() {
172
+ return Promise.resolve(this.nativeInput);
173
+ }
174
+ shouldClearOnEdit() {
175
+ const { type, clearOnEdit } = this;
176
+ return (clearOnEdit === undefined)
177
+ ? type === 'password'
178
+ : clearOnEdit;
179
+ }
180
+ getValue() {
181
+ return typeof this.value === 'number' ? this.value.toString() :
182
+ (this.value || '').toString();
183
+ }
184
+ emitStyle() {
185
+ this.ionStyle.emit({
186
+ 'interactive': true,
187
+ 'input': true,
188
+ 'has-placeholder': this.placeholder != null,
189
+ 'has-value': this.hasValue(),
190
+ 'has-focus': this.hasFocus,
191
+ 'interactive-disabled': this.disabled,
192
+ });
193
+ }
194
+ focusChanged() {
195
+ // If clearOnEdit is enabled and the input blurred but has a value, set a flag
196
+ if (!this.hasFocus && this.shouldClearOnEdit() && this.hasValue()) {
197
+ this.didBlurAfterEdit = true;
198
+ }
199
+ }
200
+ hasValue() {
201
+ return this.getValue().length > 0;
202
+ }
203
+ render() {
204
+ const mode = ionicGlobal.getIonMode(this);
205
+ const value = this.getValue();
206
+ const labelId = this.inputId + '-lbl';
207
+ const label = helpers.findItemLabel(this.el);
208
+ if (label) {
209
+ label.id = labelId;
210
+ }
211
+ return (index.h(index.Host, { "aria-disabled": this.disabled ? 'true' : null, class: Object.assign(Object.assign({}, theme.createColorClasses(this.color)), { [mode]: true, 'has-value': this.hasValue(), 'has-focus': this.hasFocus }) }, index.h("input", { class: "native-input", ref: input => this.nativeInput = input, "aria-labelledby": labelId, disabled: this.disabled, accept: this.accept, autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, multiple: this.multiple, name: this.name, pattern: this.pattern, placeholder: this.placeholder || '', readOnly: this.readonly, required: this.required, spellCheck: this.spellcheck, step: this.step, size: this.size, type: this.type, value: value, onInput: this.onInput, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeydown }), (this.clearInput && !this.readonly && !this.disabled) && index.h("button", { type: "button", class: "input-clear-icon", tabindex: "-1", onTouchStart: this.clearTextInput, onMouseDown: this.clearTextInput })));
212
+ }
213
+ get el() { return index.getElement(this); }
214
+ static get watchers() { return {
215
+ "debounce": ["debounceChanged"],
216
+ "disabled": ["disabledChanged"],
217
+ "value": ["valueChanged"]
218
+ }; }
219
+ };
220
+ let inputIds = 0;
221
+ Input.style = {
222
+ ios: inputIosCss,
223
+ md: inputMdCss
224
+ };
225
+
226
+ var diffMatchPatch = _commonjsHelpers.createCommonjsModule(function (module) {
227
+ /**
228
+ * Diff Match and Patch
229
+ * Copyright 2018 The diff-match-patch Authors.
230
+ * https://github.com/google/diff-match-patch
231
+ *
232
+ * Licensed under the Apache License, Version 2.0 (the "License");
233
+ * you may not use this file except in compliance with the License.
234
+ * You may obtain a copy of the License at
235
+ *
236
+ * http://www.apache.org/licenses/LICENSE-2.0
237
+ *
238
+ * Unless required by applicable law or agreed to in writing, software
239
+ * distributed under the License is distributed on an "AS IS" BASIS,
240
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
241
+ * See the License for the specific language governing permissions and
242
+ * limitations under the License.
243
+ */
244
+
245
+ /**
246
+ * @fileoverview Computes the difference between two texts to create a patch.
247
+ * Applies the patch onto another text, allowing for errors.
248
+ * @author fraser@google.com (Neil Fraser)
249
+ */
250
+
251
+ /**
252
+ * Class containing the diff, match and patch methods.
253
+ * @constructor
254
+ */
255
+ function diff_match_patch() {
256
+
257
+ // Defaults.
258
+ // Redefine these in your program to override the defaults.
259
+
260
+ // Number of seconds to map a diff before giving up (0 for infinity).
261
+ this.Diff_Timeout = 1.0;
262
+ // Cost of an empty edit operation in terms of edit characters.
263
+ this.Diff_EditCost = 4;
264
+ // At what point is no match declared (0.0 = perfection, 1.0 = very loose).
265
+ this.Match_Threshold = 0.5;
266
+ // How far to search for a match (0 = exact location, 1000+ = broad match).
267
+ // A match this many characters away from the expected location will add
268
+ // 1.0 to the score (0.0 is a perfect match).
269
+ this.Match_Distance = 1000;
270
+ // When deleting a large block of text (over ~64 characters), how close do
271
+ // the contents have to be to match the expected contents. (0.0 = perfection,
272
+ // 1.0 = very loose). Note that Match_Threshold controls how closely the
273
+ // end points of a delete need to match.
274
+ this.Patch_DeleteThreshold = 0.5;
275
+ // Chunk size for context length.
276
+ this.Patch_Margin = 4;
277
+
278
+ // The number of bits in an int.
279
+ this.Match_MaxBits = 32;
280
+ }
281
+
282
+
283
+ // DIFF FUNCTIONS
284
+
285
+
286
+ /**
287
+ * The data structure representing a diff is an array of tuples:
288
+ * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
289
+ * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
290
+ */
291
+ var DIFF_DELETE = -1;
292
+ var DIFF_INSERT = 1;
293
+ var DIFF_EQUAL = 0;
294
+
295
+
296
+ /**
297
+ * Find the differences between two texts. Simplifies the problem by stripping
298
+ * any common prefix or suffix off the texts before diffing.
299
+ * @param {string} text1 Old string to be diffed.
300
+ * @param {string} text2 New string to be diffed.
301
+ * @param {boolean=} opt_checklines Optional speedup flag. If present and false,
302
+ * then don't run a line-level diff first to identify the changed areas.
303
+ * Defaults to true, which does a faster, slightly less optimal diff.
304
+ * @param {number} opt_deadline Optional time when the diff should be complete
305
+ * by. Used internally for recursive calls. Users should set DiffTimeout
306
+ * instead.
307
+ * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
308
+ */
309
+ diff_match_patch.prototype.diff_main = function(text1, text2, opt_checklines,
310
+ opt_deadline) {
311
+ // Set a deadline by which time the diff must be complete.
312
+ if (typeof opt_deadline == 'undefined') {
313
+ if (this.Diff_Timeout <= 0) {
314
+ opt_deadline = Number.MAX_VALUE;
315
+ } else {
316
+ opt_deadline = (new Date).getTime() + this.Diff_Timeout * 1000;
317
+ }
318
+ }
319
+ var deadline = opt_deadline;
320
+
321
+ // Check for null inputs.
322
+ if (text1 == null || text2 == null) {
323
+ throw new Error('Null input. (diff_main)');
324
+ }
325
+
326
+ // Check for equality (speedup).
327
+ if (text1 == text2) {
328
+ if (text1) {
329
+ return [[DIFF_EQUAL, text1]];
330
+ }
331
+ return [];
332
+ }
333
+
334
+ if (typeof opt_checklines == 'undefined') {
335
+ opt_checklines = true;
336
+ }
337
+ var checklines = opt_checklines;
338
+
339
+ // Trim off common prefix (speedup).
340
+ var commonlength = this.diff_commonPrefix(text1, text2);
341
+ var commonprefix = text1.substring(0, commonlength);
342
+ text1 = text1.substring(commonlength);
343
+ text2 = text2.substring(commonlength);
344
+
345
+ // Trim off common suffix (speedup).
346
+ commonlength = this.diff_commonSuffix(text1, text2);
347
+ var commonsuffix = text1.substring(text1.length - commonlength);
348
+ text1 = text1.substring(0, text1.length - commonlength);
349
+ text2 = text2.substring(0, text2.length - commonlength);
350
+
351
+ // Compute the diff on the middle block.
352
+ var diffs = this.diff_compute_(text1, text2, checklines, deadline);
353
+
354
+ // Restore the prefix and suffix.
355
+ if (commonprefix) {
356
+ diffs.unshift([DIFF_EQUAL, commonprefix]);
357
+ }
358
+ if (commonsuffix) {
359
+ diffs.push([DIFF_EQUAL, commonsuffix]);
360
+ }
361
+ this.diff_cleanupMerge(diffs);
362
+ return diffs;
363
+ };
364
+
365
+
366
+ /**
367
+ * Find the differences between two texts. Assumes that the texts do not
368
+ * have any common prefix or suffix.
369
+ * @param {string} text1 Old string to be diffed.
370
+ * @param {string} text2 New string to be diffed.
371
+ * @param {boolean} checklines Speedup flag. If false, then don't run a
372
+ * line-level diff first to identify the changed areas.
373
+ * If true, then run a faster, slightly less optimal diff.
374
+ * @param {number} deadline Time when the diff should be complete by.
375
+ * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
376
+ * @private
377
+ */
378
+ diff_match_patch.prototype.diff_compute_ = function(text1, text2, checklines,
379
+ deadline) {
380
+ var diffs;
381
+
382
+ if (!text1) {
383
+ // Just add some text (speedup).
384
+ return [[DIFF_INSERT, text2]];
385
+ }
386
+
387
+ if (!text2) {
388
+ // Just delete some text (speedup).
389
+ return [[DIFF_DELETE, text1]];
390
+ }
391
+
392
+ var longtext = text1.length > text2.length ? text1 : text2;
393
+ var shorttext = text1.length > text2.length ? text2 : text1;
394
+ var i = longtext.indexOf(shorttext);
395
+ if (i != -1) {
396
+ // Shorter text is inside the longer text (speedup).
397
+ diffs = [[DIFF_INSERT, longtext.substring(0, i)],
398
+ [DIFF_EQUAL, shorttext],
399
+ [DIFF_INSERT, longtext.substring(i + shorttext.length)]];
400
+ // Swap insertions for deletions if diff is reversed.
401
+ if (text1.length > text2.length) {
402
+ diffs[0][0] = diffs[2][0] = DIFF_DELETE;
403
+ }
404
+ return diffs;
405
+ }
406
+
407
+ if (shorttext.length == 1) {
408
+ // Single character string.
409
+ // After the previous speedup, the character can't be an equality.
410
+ return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
411
+ }
412
+
413
+ // Check to see if the problem can be split in two.
414
+ var hm = this.diff_halfMatch_(text1, text2);
415
+ if (hm) {
416
+ // A half-match was found, sort out the return data.
417
+ var text1_a = hm[0];
418
+ var text1_b = hm[1];
419
+ var text2_a = hm[2];
420
+ var text2_b = hm[3];
421
+ var mid_common = hm[4];
422
+ // Send both pairs off for separate processing.
423
+ var diffs_a = this.diff_main(text1_a, text2_a, checklines, deadline);
424
+ var diffs_b = this.diff_main(text1_b, text2_b, checklines, deadline);
425
+ // Merge the results.
426
+ return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
427
+ }
428
+
429
+ if (checklines && text1.length > 100 && text2.length > 100) {
430
+ return this.diff_lineMode_(text1, text2, deadline);
431
+ }
432
+
433
+ return this.diff_bisect_(text1, text2, deadline);
434
+ };
435
+
436
+
437
+ /**
438
+ * Do a quick line-level diff on both strings, then rediff the parts for
439
+ * greater accuracy.
440
+ * This speedup can produce non-minimal diffs.
441
+ * @param {string} text1 Old string to be diffed.
442
+ * @param {string} text2 New string to be diffed.
443
+ * @param {number} deadline Time when the diff should be complete by.
444
+ * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
445
+ * @private
446
+ */
447
+ diff_match_patch.prototype.diff_lineMode_ = function(text1, text2, deadline) {
448
+ // Scan the text on a line-by-line basis first.
449
+ var a = this.diff_linesToChars_(text1, text2);
450
+ text1 = a.chars1;
451
+ text2 = a.chars2;
452
+ var linearray = a.lineArray;
453
+
454
+ var diffs = this.diff_main(text1, text2, false, deadline);
455
+
456
+ // Convert the diff back to original text.
457
+ this.diff_charsToLines_(diffs, linearray);
458
+ // Eliminate freak matches (e.g. blank lines)
459
+ this.diff_cleanupSemantic(diffs);
460
+
461
+ // Rediff any replacement blocks, this time character-by-character.
462
+ // Add a dummy entry at the end.
463
+ diffs.push([DIFF_EQUAL, '']);
464
+ var pointer = 0;
465
+ var count_delete = 0;
466
+ var count_insert = 0;
467
+ var text_delete = '';
468
+ var text_insert = '';
469
+ while (pointer < diffs.length) {
470
+ switch (diffs[pointer][0]) {
471
+ case DIFF_INSERT:
472
+ count_insert++;
473
+ text_insert += diffs[pointer][1];
474
+ break;
475
+ case DIFF_DELETE:
476
+ count_delete++;
477
+ text_delete += diffs[pointer][1];
478
+ break;
479
+ case DIFF_EQUAL:
480
+ // Upon reaching an equality, check for prior redundancies.
481
+ if (count_delete >= 1 && count_insert >= 1) {
482
+ // Delete the offending records and add the merged ones.
483
+ diffs.splice(pointer - count_delete - count_insert,
484
+ count_delete + count_insert);
485
+ pointer = pointer - count_delete - count_insert;
486
+ var a = this.diff_main(text_delete, text_insert, false, deadline);
487
+ for (var j = a.length - 1; j >= 0; j--) {
488
+ diffs.splice(pointer, 0, a[j]);
489
+ }
490
+ pointer = pointer + a.length;
491
+ }
492
+ count_insert = 0;
493
+ count_delete = 0;
494
+ text_delete = '';
495
+ text_insert = '';
496
+ break;
497
+ }
498
+ pointer++;
499
+ }
500
+ diffs.pop(); // Remove the dummy entry at the end.
501
+
502
+ return diffs;
503
+ };
504
+
505
+
506
+ /**
507
+ * Find the 'middle snake' of a diff, split the problem in two
508
+ * and return the recursively constructed diff.
509
+ * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
510
+ * @param {string} text1 Old string to be diffed.
511
+ * @param {string} text2 New string to be diffed.
512
+ * @param {number} deadline Time at which to bail if not yet complete.
513
+ * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
514
+ * @private
515
+ */
516
+ diff_match_patch.prototype.diff_bisect_ = function(text1, text2, deadline) {
517
+ // Cache the text lengths to prevent multiple calls.
518
+ var text1_length = text1.length;
519
+ var text2_length = text2.length;
520
+ var max_d = Math.ceil((text1_length + text2_length) / 2);
521
+ var v_offset = max_d;
522
+ var v_length = 2 * max_d;
523
+ var v1 = new Array(v_length);
524
+ var v2 = new Array(v_length);
525
+ // Setting all elements to -1 is faster in Chrome & Firefox than mixing
526
+ // integers and undefined.
527
+ for (var x = 0; x < v_length; x++) {
528
+ v1[x] = -1;
529
+ v2[x] = -1;
530
+ }
531
+ v1[v_offset + 1] = 0;
532
+ v2[v_offset + 1] = 0;
533
+ var delta = text1_length - text2_length;
534
+ // If the total number of characters is odd, then the front path will collide
535
+ // with the reverse path.
536
+ var front = (delta % 2 != 0);
537
+ // Offsets for start and end of k loop.
538
+ // Prevents mapping of space beyond the grid.
539
+ var k1start = 0;
540
+ var k1end = 0;
541
+ var k2start = 0;
542
+ var k2end = 0;
543
+ for (var d = 0; d < max_d; d++) {
544
+ // Bail out if deadline is reached.
545
+ if ((new Date()).getTime() > deadline) {
546
+ break;
547
+ }
548
+
549
+ // Walk the front path one step.
550
+ for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
551
+ var k1_offset = v_offset + k1;
552
+ var x1;
553
+ if (k1 == -d || (k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1])) {
554
+ x1 = v1[k1_offset + 1];
555
+ } else {
556
+ x1 = v1[k1_offset - 1] + 1;
557
+ }
558
+ var y1 = x1 - k1;
559
+ while (x1 < text1_length && y1 < text2_length &&
560
+ text1.charAt(x1) == text2.charAt(y1)) {
561
+ x1++;
562
+ y1++;
563
+ }
564
+ v1[k1_offset] = x1;
565
+ if (x1 > text1_length) {
566
+ // Ran off the right of the graph.
567
+ k1end += 2;
568
+ } else if (y1 > text2_length) {
569
+ // Ran off the bottom of the graph.
570
+ k1start += 2;
571
+ } else if (front) {
572
+ var k2_offset = v_offset + delta - k1;
573
+ if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {
574
+ // Mirror x2 onto top-left coordinate system.
575
+ var x2 = text1_length - v2[k2_offset];
576
+ if (x1 >= x2) {
577
+ // Overlap detected.
578
+ return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);
579
+ }
580
+ }
581
+ }
582
+ }
583
+
584
+ // Walk the reverse path one step.
585
+ for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
586
+ var k2_offset = v_offset + k2;
587
+ var x2;
588
+ if (k2 == -d || (k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1])) {
589
+ x2 = v2[k2_offset + 1];
590
+ } else {
591
+ x2 = v2[k2_offset - 1] + 1;
592
+ }
593
+ var y2 = x2 - k2;
594
+ while (x2 < text1_length && y2 < text2_length &&
595
+ text1.charAt(text1_length - x2 - 1) ==
596
+ text2.charAt(text2_length - y2 - 1)) {
597
+ x2++;
598
+ y2++;
599
+ }
600
+ v2[k2_offset] = x2;
601
+ if (x2 > text1_length) {
602
+ // Ran off the left of the graph.
603
+ k2end += 2;
604
+ } else if (y2 > text2_length) {
605
+ // Ran off the top of the graph.
606
+ k2start += 2;
607
+ } else if (!front) {
608
+ var k1_offset = v_offset + delta - k2;
609
+ if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {
610
+ var x1 = v1[k1_offset];
611
+ var y1 = v_offset + x1 - k1_offset;
612
+ // Mirror x2 onto top-left coordinate system.
613
+ x2 = text1_length - x2;
614
+ if (x1 >= x2) {
615
+ // Overlap detected.
616
+ return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);
617
+ }
618
+ }
619
+ }
620
+ }
621
+ }
622
+ // Diff took too long and hit the deadline or
623
+ // number of diffs equals number of characters, no commonality at all.
624
+ return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
625
+ };
626
+
627
+
628
+ /**
629
+ * Given the location of the 'middle snake', split the diff in two parts
630
+ * and recurse.
631
+ * @param {string} text1 Old string to be diffed.
632
+ * @param {string} text2 New string to be diffed.
633
+ * @param {number} x Index of split point in text1.
634
+ * @param {number} y Index of split point in text2.
635
+ * @param {number} deadline Time at which to bail if not yet complete.
636
+ * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
637
+ * @private
638
+ */
639
+ diff_match_patch.prototype.diff_bisectSplit_ = function(text1, text2, x, y,
640
+ deadline) {
641
+ var text1a = text1.substring(0, x);
642
+ var text2a = text2.substring(0, y);
643
+ var text1b = text1.substring(x);
644
+ var text2b = text2.substring(y);
645
+
646
+ // Compute both diffs serially.
647
+ var diffs = this.diff_main(text1a, text2a, false, deadline);
648
+ var diffsb = this.diff_main(text1b, text2b, false, deadline);
649
+
650
+ return diffs.concat(diffsb);
651
+ };
652
+
653
+
654
+ /**
655
+ * Split two texts into an array of strings. Reduce the texts to a string of
656
+ * hashes where each Unicode character represents one line.
657
+ * @param {string} text1 First string.
658
+ * @param {string} text2 Second string.
659
+ * @return {{chars1: string, chars2: string, lineArray: !Array.<string>}}
660
+ * An object containing the encoded text1, the encoded text2 and
661
+ * the array of unique strings.
662
+ * The zeroth element of the array of unique strings is intentionally blank.
663
+ * @private
664
+ */
665
+ diff_match_patch.prototype.diff_linesToChars_ = function(text1, text2) {
666
+ var lineArray = []; // e.g. lineArray[4] == 'Hello\n'
667
+ var lineHash = {}; // e.g. lineHash['Hello\n'] == 4
668
+
669
+ // '\x00' is a valid character, but various debuggers don't like it.
670
+ // So we'll insert a junk entry to avoid generating a null character.
671
+ lineArray[0] = '';
672
+
673
+ /**
674
+ * Split a text into an array of strings. Reduce the texts to a string of
675
+ * hashes where each Unicode character represents one line.
676
+ * Modifies linearray and linehash through being a closure.
677
+ * @param {string} text String to encode.
678
+ * @return {string} Encoded string.
679
+ * @private
680
+ */
681
+ function diff_linesToCharsMunge_(text) {
682
+ var chars = '';
683
+ // Walk the text, pulling out a substring for each line.
684
+ // text.split('\n') would would temporarily double our memory footprint.
685
+ // Modifying text would create many large strings to garbage collect.
686
+ var lineStart = 0;
687
+ var lineEnd = -1;
688
+ // Keeping our own length variable is faster than looking it up.
689
+ var lineArrayLength = lineArray.length;
690
+ while (lineEnd < text.length - 1) {
691
+ lineEnd = text.indexOf('\n', lineStart);
692
+ if (lineEnd == -1) {
693
+ lineEnd = text.length - 1;
694
+ }
695
+ var line = text.substring(lineStart, lineEnd + 1);
696
+ lineStart = lineEnd + 1;
697
+
698
+ if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) :
699
+ (lineHash[line] !== undefined)) {
700
+ chars += String.fromCharCode(lineHash[line]);
701
+ } else {
702
+ chars += String.fromCharCode(lineArrayLength);
703
+ lineHash[line] = lineArrayLength;
704
+ lineArray[lineArrayLength++] = line;
705
+ }
706
+ }
707
+ return chars;
708
+ }
709
+
710
+ var chars1 = diff_linesToCharsMunge_(text1);
711
+ var chars2 = diff_linesToCharsMunge_(text2);
712
+ return {chars1: chars1, chars2: chars2, lineArray: lineArray};
713
+ };
714
+
715
+
716
+ /**
717
+ * Rehydrate the text in a diff from a string of line hashes to real lines of
718
+ * text.
719
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
720
+ * @param {!Array.<string>} lineArray Array of unique strings.
721
+ * @private
722
+ */
723
+ diff_match_patch.prototype.diff_charsToLines_ = function(diffs, lineArray) {
724
+ for (var x = 0; x < diffs.length; x++) {
725
+ var chars = diffs[x][1];
726
+ var text = [];
727
+ for (var y = 0; y < chars.length; y++) {
728
+ text[y] = lineArray[chars.charCodeAt(y)];
729
+ }
730
+ diffs[x][1] = text.join('');
731
+ }
732
+ };
733
+
734
+
735
+ /**
736
+ * Determine the common prefix of two strings.
737
+ * @param {string} text1 First string.
738
+ * @param {string} text2 Second string.
739
+ * @return {number} The number of characters common to the start of each
740
+ * string.
741
+ */
742
+ diff_match_patch.prototype.diff_commonPrefix = function(text1, text2) {
743
+ // Quick check for common null cases.
744
+ if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {
745
+ return 0;
746
+ }
747
+ // Binary search.
748
+ // Performance analysis: http://neil.fraser.name/news/2007/10/09/
749
+ var pointermin = 0;
750
+ var pointermax = Math.min(text1.length, text2.length);
751
+ var pointermid = pointermax;
752
+ var pointerstart = 0;
753
+ while (pointermin < pointermid) {
754
+ if (text1.substring(pointerstart, pointermid) ==
755
+ text2.substring(pointerstart, pointermid)) {
756
+ pointermin = pointermid;
757
+ pointerstart = pointermin;
758
+ } else {
759
+ pointermax = pointermid;
760
+ }
761
+ pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
762
+ }
763
+ return pointermid;
764
+ };
765
+
766
+
767
+ /**
768
+ * Determine the common suffix of two strings.
769
+ * @param {string} text1 First string.
770
+ * @param {string} text2 Second string.
771
+ * @return {number} The number of characters common to the end of each string.
772
+ */
773
+ diff_match_patch.prototype.diff_commonSuffix = function(text1, text2) {
774
+ // Quick check for common null cases.
775
+ if (!text1 || !text2 ||
776
+ text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {
777
+ return 0;
778
+ }
779
+ // Binary search.
780
+ // Performance analysis: http://neil.fraser.name/news/2007/10/09/
781
+ var pointermin = 0;
782
+ var pointermax = Math.min(text1.length, text2.length);
783
+ var pointermid = pointermax;
784
+ var pointerend = 0;
785
+ while (pointermin < pointermid) {
786
+ if (text1.substring(text1.length - pointermid, text1.length - pointerend) ==
787
+ text2.substring(text2.length - pointermid, text2.length - pointerend)) {
788
+ pointermin = pointermid;
789
+ pointerend = pointermin;
790
+ } else {
791
+ pointermax = pointermid;
792
+ }
793
+ pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
794
+ }
795
+ return pointermid;
796
+ };
797
+
798
+
799
+ /**
800
+ * Determine if the suffix of one string is the prefix of another.
801
+ * @param {string} text1 First string.
802
+ * @param {string} text2 Second string.
803
+ * @return {number} The number of characters common to the end of the first
804
+ * string and the start of the second string.
805
+ * @private
806
+ */
807
+ diff_match_patch.prototype.diff_commonOverlap_ = function(text1, text2) {
808
+ // Cache the text lengths to prevent multiple calls.
809
+ var text1_length = text1.length;
810
+ var text2_length = text2.length;
811
+ // Eliminate the null case.
812
+ if (text1_length == 0 || text2_length == 0) {
813
+ return 0;
814
+ }
815
+ // Truncate the longer string.
816
+ if (text1_length > text2_length) {
817
+ text1 = text1.substring(text1_length - text2_length);
818
+ } else if (text1_length < text2_length) {
819
+ text2 = text2.substring(0, text1_length);
820
+ }
821
+ var text_length = Math.min(text1_length, text2_length);
822
+ // Quick check for the worst case.
823
+ if (text1 == text2) {
824
+ return text_length;
825
+ }
826
+
827
+ // Start by looking for a single character match
828
+ // and increase length until no match is found.
829
+ // Performance analysis: http://neil.fraser.name/news/2010/11/04/
830
+ var best = 0;
831
+ var length = 1;
832
+ while (true) {
833
+ var pattern = text1.substring(text_length - length);
834
+ var found = text2.indexOf(pattern);
835
+ if (found == -1) {
836
+ return best;
837
+ }
838
+ length += found;
839
+ if (found == 0 || text1.substring(text_length - length) ==
840
+ text2.substring(0, length)) {
841
+ best = length;
842
+ length++;
843
+ }
844
+ }
845
+ };
846
+
847
+
848
+ /**
849
+ * Do the two texts share a substring which is at least half the length of the
850
+ * longer text?
851
+ * This speedup can produce non-minimal diffs.
852
+ * @param {string} text1 First string.
853
+ * @param {string} text2 Second string.
854
+ * @return {Array.<string>} Five element Array, containing the prefix of
855
+ * text1, the suffix of text1, the prefix of text2, the suffix of
856
+ * text2 and the common middle. Or null if there was no match.
857
+ * @private
858
+ */
859
+ diff_match_patch.prototype.diff_halfMatch_ = function(text1, text2) {
860
+ if (this.Diff_Timeout <= 0) {
861
+ // Don't risk returning a non-optimal diff if we have unlimited time.
862
+ return null;
863
+ }
864
+ var longtext = text1.length > text2.length ? text1 : text2;
865
+ var shorttext = text1.length > text2.length ? text2 : text1;
866
+ if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
867
+ return null; // Pointless.
868
+ }
869
+ var dmp = this; // 'this' becomes 'window' in a closure.
870
+
871
+ /**
872
+ * Does a substring of shorttext exist within longtext such that the substring
873
+ * is at least half the length of longtext?
874
+ * Closure, but does not reference any external variables.
875
+ * @param {string} longtext Longer string.
876
+ * @param {string} shorttext Shorter string.
877
+ * @param {number} i Start index of quarter length substring within longtext.
878
+ * @return {Array.<string>} Five element Array, containing the prefix of
879
+ * longtext, the suffix of longtext, the prefix of shorttext, the suffix
880
+ * of shorttext and the common middle. Or null if there was no match.
881
+ * @private
882
+ */
883
+ function diff_halfMatchI_(longtext, shorttext, i) {
884
+ // Start with a 1/4 length substring at position i as a seed.
885
+ var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
886
+ var j = -1;
887
+ var best_common = '';
888
+ var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
889
+ while ((j = shorttext.indexOf(seed, j + 1)) != -1) {
890
+ var prefixLength = dmp.diff_commonPrefix(longtext.substring(i),
891
+ shorttext.substring(j));
892
+ var suffixLength = dmp.diff_commonSuffix(longtext.substring(0, i),
893
+ shorttext.substring(0, j));
894
+ if (best_common.length < suffixLength + prefixLength) {
895
+ best_common = shorttext.substring(j - suffixLength, j) +
896
+ shorttext.substring(j, j + prefixLength);
897
+ best_longtext_a = longtext.substring(0, i - suffixLength);
898
+ best_longtext_b = longtext.substring(i + prefixLength);
899
+ best_shorttext_a = shorttext.substring(0, j - suffixLength);
900
+ best_shorttext_b = shorttext.substring(j + prefixLength);
901
+ }
902
+ }
903
+ if (best_common.length * 2 >= longtext.length) {
904
+ return [best_longtext_a, best_longtext_b,
905
+ best_shorttext_a, best_shorttext_b, best_common];
906
+ } else {
907
+ return null;
908
+ }
909
+ }
910
+
911
+ // First check if the second quarter is the seed for a half-match.
912
+ var hm1 = diff_halfMatchI_(longtext, shorttext,
913
+ Math.ceil(longtext.length / 4));
914
+ // Check again based on the third quarter.
915
+ var hm2 = diff_halfMatchI_(longtext, shorttext,
916
+ Math.ceil(longtext.length / 2));
917
+ var hm;
918
+ if (!hm1 && !hm2) {
919
+ return null;
920
+ } else if (!hm2) {
921
+ hm = hm1;
922
+ } else if (!hm1) {
923
+ hm = hm2;
924
+ } else {
925
+ // Both matched. Select the longest.
926
+ hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
927
+ }
928
+
929
+ // A half-match was found, sort out the return data.
930
+ var text1_a, text1_b, text2_a, text2_b;
931
+ if (text1.length > text2.length) {
932
+ text1_a = hm[0];
933
+ text1_b = hm[1];
934
+ text2_a = hm[2];
935
+ text2_b = hm[3];
936
+ } else {
937
+ text2_a = hm[0];
938
+ text2_b = hm[1];
939
+ text1_a = hm[2];
940
+ text1_b = hm[3];
941
+ }
942
+ var mid_common = hm[4];
943
+ return [text1_a, text1_b, text2_a, text2_b, mid_common];
944
+ };
945
+
946
+
947
+ /**
948
+ * Reduce the number of edits by eliminating semantically trivial equalities.
949
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
950
+ */
951
+ diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
952
+ var changes = false;
953
+ var equalities = []; // Stack of indices where equalities are found.
954
+ var equalitiesLength = 0; // Keeping our own length var is faster in JS.
955
+ /** @type {?string} */
956
+ var lastequality = null;
957
+ // Always equal to diffs[equalities[equalitiesLength - 1]][1]
958
+ var pointer = 0; // Index of current position.
959
+ // Number of characters that changed prior to the equality.
960
+ var length_insertions1 = 0;
961
+ var length_deletions1 = 0;
962
+ // Number of characters that changed after the equality.
963
+ var length_insertions2 = 0;
964
+ var length_deletions2 = 0;
965
+ while (pointer < diffs.length) {
966
+ if (diffs[pointer][0] == DIFF_EQUAL) { // Equality found.
967
+ equalities[equalitiesLength++] = pointer;
968
+ length_insertions1 = length_insertions2;
969
+ length_deletions1 = length_deletions2;
970
+ length_insertions2 = 0;
971
+ length_deletions2 = 0;
972
+ lastequality = diffs[pointer][1];
973
+ } else { // An insertion or deletion.
974
+ if (diffs[pointer][0] == DIFF_INSERT) {
975
+ length_insertions2 += diffs[pointer][1].length;
976
+ } else {
977
+ length_deletions2 += diffs[pointer][1].length;
978
+ }
979
+ // Eliminate an equality that is smaller or equal to the edits on both
980
+ // sides of it.
981
+ if (lastequality && (lastequality.length <=
982
+ Math.max(length_insertions1, length_deletions1)) &&
983
+ (lastequality.length <= Math.max(length_insertions2,
984
+ length_deletions2))) {
985
+ // Duplicate record.
986
+ diffs.splice(equalities[equalitiesLength - 1], 0,
987
+ [DIFF_DELETE, lastequality]);
988
+ // Change second copy to insert.
989
+ diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
990
+ // Throw away the equality we just deleted.
991
+ equalitiesLength--;
992
+ // Throw away the previous equality (it needs to be reevaluated).
993
+ equalitiesLength--;
994
+ pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
995
+ length_insertions1 = 0; // Reset the counters.
996
+ length_deletions1 = 0;
997
+ length_insertions2 = 0;
998
+ length_deletions2 = 0;
999
+ lastequality = null;
1000
+ changes = true;
1001
+ }
1002
+ }
1003
+ pointer++;
1004
+ }
1005
+
1006
+ // Normalize the diff.
1007
+ if (changes) {
1008
+ this.diff_cleanupMerge(diffs);
1009
+ }
1010
+ this.diff_cleanupSemanticLossless(diffs);
1011
+
1012
+ // Find any overlaps between deletions and insertions.
1013
+ // e.g: <del>abcxxx</del><ins>xxxdef</ins>
1014
+ // -> <del>abc</del>xxx<ins>def</ins>
1015
+ // e.g: <del>xxxabc</del><ins>defxxx</ins>
1016
+ // -> <ins>def</ins>xxx<del>abc</del>
1017
+ // Only extract an overlap if it is as big as the edit ahead or behind it.
1018
+ pointer = 1;
1019
+ while (pointer < diffs.length) {
1020
+ if (diffs[pointer - 1][0] == DIFF_DELETE &&
1021
+ diffs[pointer][0] == DIFF_INSERT) {
1022
+ var deletion = diffs[pointer - 1][1];
1023
+ var insertion = diffs[pointer][1];
1024
+ var overlap_length1 = this.diff_commonOverlap_(deletion, insertion);
1025
+ var overlap_length2 = this.diff_commonOverlap_(insertion, deletion);
1026
+ if (overlap_length1 >= overlap_length2) {
1027
+ if (overlap_length1 >= deletion.length / 2 ||
1028
+ overlap_length1 >= insertion.length / 2) {
1029
+ // Overlap found. Insert an equality and trim the surrounding edits.
1030
+ diffs.splice(pointer, 0,
1031
+ [DIFF_EQUAL, insertion.substring(0, overlap_length1)]);
1032
+ diffs[pointer - 1][1] =
1033
+ deletion.substring(0, deletion.length - overlap_length1);
1034
+ diffs[pointer + 1][1] = insertion.substring(overlap_length1);
1035
+ pointer++;
1036
+ }
1037
+ } else {
1038
+ if (overlap_length2 >= deletion.length / 2 ||
1039
+ overlap_length2 >= insertion.length / 2) {
1040
+ // Reverse overlap found.
1041
+ // Insert an equality and swap and trim the surrounding edits.
1042
+ diffs.splice(pointer, 0,
1043
+ [DIFF_EQUAL, deletion.substring(0, overlap_length2)]);
1044
+ diffs[pointer - 1][0] = DIFF_INSERT;
1045
+ diffs[pointer - 1][1] =
1046
+ insertion.substring(0, insertion.length - overlap_length2);
1047
+ diffs[pointer + 1][0] = DIFF_DELETE;
1048
+ diffs[pointer + 1][1] =
1049
+ deletion.substring(overlap_length2);
1050
+ pointer++;
1051
+ }
1052
+ }
1053
+ pointer++;
1054
+ }
1055
+ pointer++;
1056
+ }
1057
+ };
1058
+
1059
+
1060
+ /**
1061
+ * Look for single edits surrounded on both sides by equalities
1062
+ * which can be shifted sideways to align the edit to a word boundary.
1063
+ * e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came.
1064
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
1065
+ */
1066
+ diff_match_patch.prototype.diff_cleanupSemanticLossless = function(diffs) {
1067
+ /**
1068
+ * Given two strings, compute a score representing whether the internal
1069
+ * boundary falls on logical boundaries.
1070
+ * Scores range from 6 (best) to 0 (worst).
1071
+ * Closure, but does not reference any external variables.
1072
+ * @param {string} one First string.
1073
+ * @param {string} two Second string.
1074
+ * @return {number} The score.
1075
+ * @private
1076
+ */
1077
+ function diff_cleanupSemanticScore_(one, two) {
1078
+ if (!one || !two) {
1079
+ // Edges are the best.
1080
+ return 6;
1081
+ }
1082
+
1083
+ // Each port of this function behaves slightly differently due to
1084
+ // subtle differences in each language's definition of things like
1085
+ // 'whitespace'. Since this function's purpose is largely cosmetic,
1086
+ // the choice has been made to use each language's native features
1087
+ // rather than force total conformity.
1088
+ var char1 = one.charAt(one.length - 1);
1089
+ var char2 = two.charAt(0);
1090
+ var nonAlphaNumeric1 = char1.match(diff_match_patch.nonAlphaNumericRegex_);
1091
+ var nonAlphaNumeric2 = char2.match(diff_match_patch.nonAlphaNumericRegex_);
1092
+ var whitespace1 = nonAlphaNumeric1 &&
1093
+ char1.match(diff_match_patch.whitespaceRegex_);
1094
+ var whitespace2 = nonAlphaNumeric2 &&
1095
+ char2.match(diff_match_patch.whitespaceRegex_);
1096
+ var lineBreak1 = whitespace1 &&
1097
+ char1.match(diff_match_patch.linebreakRegex_);
1098
+ var lineBreak2 = whitespace2 &&
1099
+ char2.match(diff_match_patch.linebreakRegex_);
1100
+ var blankLine1 = lineBreak1 &&
1101
+ one.match(diff_match_patch.blanklineEndRegex_);
1102
+ var blankLine2 = lineBreak2 &&
1103
+ two.match(diff_match_patch.blanklineStartRegex_);
1104
+
1105
+ if (blankLine1 || blankLine2) {
1106
+ // Five points for blank lines.
1107
+ return 5;
1108
+ } else if (lineBreak1 || lineBreak2) {
1109
+ // Four points for line breaks.
1110
+ return 4;
1111
+ } else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) {
1112
+ // Three points for end of sentences.
1113
+ return 3;
1114
+ } else if (whitespace1 || whitespace2) {
1115
+ // Two points for whitespace.
1116
+ return 2;
1117
+ } else if (nonAlphaNumeric1 || nonAlphaNumeric2) {
1118
+ // One point for non-alphanumeric.
1119
+ return 1;
1120
+ }
1121
+ return 0;
1122
+ }
1123
+
1124
+ var pointer = 1;
1125
+ // Intentionally ignore the first and last element (don't need checking).
1126
+ while (pointer < diffs.length - 1) {
1127
+ if (diffs[pointer - 1][0] == DIFF_EQUAL &&
1128
+ diffs[pointer + 1][0] == DIFF_EQUAL) {
1129
+ // This is a single edit surrounded by equalities.
1130
+ var equality1 = diffs[pointer - 1][1];
1131
+ var edit = diffs[pointer][1];
1132
+ var equality2 = diffs[pointer + 1][1];
1133
+
1134
+ // First, shift the edit as far left as possible.
1135
+ var commonOffset = this.diff_commonSuffix(equality1, edit);
1136
+ if (commonOffset) {
1137
+ var commonString = edit.substring(edit.length - commonOffset);
1138
+ equality1 = equality1.substring(0, equality1.length - commonOffset);
1139
+ edit = commonString + edit.substring(0, edit.length - commonOffset);
1140
+ equality2 = commonString + equality2;
1141
+ }
1142
+
1143
+ // Second, step character by character right, looking for the best fit.
1144
+ var bestEquality1 = equality1;
1145
+ var bestEdit = edit;
1146
+ var bestEquality2 = equality2;
1147
+ var bestScore = diff_cleanupSemanticScore_(equality1, edit) +
1148
+ diff_cleanupSemanticScore_(edit, equality2);
1149
+ while (edit.charAt(0) === equality2.charAt(0)) {
1150
+ equality1 += edit.charAt(0);
1151
+ edit = edit.substring(1) + equality2.charAt(0);
1152
+ equality2 = equality2.substring(1);
1153
+ var score = diff_cleanupSemanticScore_(equality1, edit) +
1154
+ diff_cleanupSemanticScore_(edit, equality2);
1155
+ // The >= encourages trailing rather than leading whitespace on edits.
1156
+ if (score >= bestScore) {
1157
+ bestScore = score;
1158
+ bestEquality1 = equality1;
1159
+ bestEdit = edit;
1160
+ bestEquality2 = equality2;
1161
+ }
1162
+ }
1163
+
1164
+ if (diffs[pointer - 1][1] != bestEquality1) {
1165
+ // We have an improvement, save it back to the diff.
1166
+ if (bestEquality1) {
1167
+ diffs[pointer - 1][1] = bestEquality1;
1168
+ } else {
1169
+ diffs.splice(pointer - 1, 1);
1170
+ pointer--;
1171
+ }
1172
+ diffs[pointer][1] = bestEdit;
1173
+ if (bestEquality2) {
1174
+ diffs[pointer + 1][1] = bestEquality2;
1175
+ } else {
1176
+ diffs.splice(pointer + 1, 1);
1177
+ pointer--;
1178
+ }
1179
+ }
1180
+ }
1181
+ pointer++;
1182
+ }
1183
+ };
1184
+
1185
+ // Define some regex patterns for matching boundaries.
1186
+ diff_match_patch.nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/;
1187
+ diff_match_patch.whitespaceRegex_ = /\s/;
1188
+ diff_match_patch.linebreakRegex_ = /[\r\n]/;
1189
+ diff_match_patch.blanklineEndRegex_ = /\n\r?\n$/;
1190
+ diff_match_patch.blanklineStartRegex_ = /^\r?\n\r?\n/;
1191
+
1192
+ /**
1193
+ * Reduce the number of edits by eliminating operationally trivial equalities.
1194
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
1195
+ */
1196
+ diff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {
1197
+ var changes = false;
1198
+ var equalities = []; // Stack of indices where equalities are found.
1199
+ var equalitiesLength = 0; // Keeping our own length var is faster in JS.
1200
+ /** @type {?string} */
1201
+ var lastequality = null;
1202
+ // Always equal to diffs[equalities[equalitiesLength - 1]][1]
1203
+ var pointer = 0; // Index of current position.
1204
+ // Is there an insertion operation before the last equality.
1205
+ var pre_ins = false;
1206
+ // Is there a deletion operation before the last equality.
1207
+ var pre_del = false;
1208
+ // Is there an insertion operation after the last equality.
1209
+ var post_ins = false;
1210
+ // Is there a deletion operation after the last equality.
1211
+ var post_del = false;
1212
+ while (pointer < diffs.length) {
1213
+ if (diffs[pointer][0] == DIFF_EQUAL) { // Equality found.
1214
+ if (diffs[pointer][1].length < this.Diff_EditCost &&
1215
+ (post_ins || post_del)) {
1216
+ // Candidate found.
1217
+ equalities[equalitiesLength++] = pointer;
1218
+ pre_ins = post_ins;
1219
+ pre_del = post_del;
1220
+ lastequality = diffs[pointer][1];
1221
+ } else {
1222
+ // Not a candidate, and can never become one.
1223
+ equalitiesLength = 0;
1224
+ lastequality = null;
1225
+ }
1226
+ post_ins = post_del = false;
1227
+ } else { // An insertion or deletion.
1228
+ if (diffs[pointer][0] == DIFF_DELETE) {
1229
+ post_del = true;
1230
+ } else {
1231
+ post_ins = true;
1232
+ }
1233
+ /*
1234
+ * Five types to be split:
1235
+ * <ins>A</ins><del>B</del>XY<ins>C</ins><del>D</del>
1236
+ * <ins>A</ins>X<ins>C</ins><del>D</del>
1237
+ * <ins>A</ins><del>B</del>X<ins>C</ins>
1238
+ * <ins>A</del>X<ins>C</ins><del>D</del>
1239
+ * <ins>A</ins><del>B</del>X<del>C</del>
1240
+ */
1241
+ if (lastequality && ((pre_ins && pre_del && post_ins && post_del) ||
1242
+ ((lastequality.length < this.Diff_EditCost / 2) &&
1243
+ (pre_ins + pre_del + post_ins + post_del) == 3))) {
1244
+ // Duplicate record.
1245
+ diffs.splice(equalities[equalitiesLength - 1], 0,
1246
+ [DIFF_DELETE, lastequality]);
1247
+ // Change second copy to insert.
1248
+ diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
1249
+ equalitiesLength--; // Throw away the equality we just deleted;
1250
+ lastequality = null;
1251
+ if (pre_ins && pre_del) {
1252
+ // No changes made which could affect previous entry, keep going.
1253
+ post_ins = post_del = true;
1254
+ equalitiesLength = 0;
1255
+ } else {
1256
+ equalitiesLength--; // Throw away the previous equality.
1257
+ pointer = equalitiesLength > 0 ?
1258
+ equalities[equalitiesLength - 1] : -1;
1259
+ post_ins = post_del = false;
1260
+ }
1261
+ changes = true;
1262
+ }
1263
+ }
1264
+ pointer++;
1265
+ }
1266
+
1267
+ if (changes) {
1268
+ this.diff_cleanupMerge(diffs);
1269
+ }
1270
+ };
1271
+
1272
+
1273
+ /**
1274
+ * Reorder and merge like edit sections. Merge equalities.
1275
+ * Any edit section can move as long as it doesn't cross an equality.
1276
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
1277
+ */
1278
+ diff_match_patch.prototype.diff_cleanupMerge = function(diffs) {
1279
+ diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.
1280
+ var pointer = 0;
1281
+ var count_delete = 0;
1282
+ var count_insert = 0;
1283
+ var text_delete = '';
1284
+ var text_insert = '';
1285
+ var commonlength;
1286
+ while (pointer < diffs.length) {
1287
+ switch (diffs[pointer][0]) {
1288
+ case DIFF_INSERT:
1289
+ count_insert++;
1290
+ text_insert += diffs[pointer][1];
1291
+ pointer++;
1292
+ break;
1293
+ case DIFF_DELETE:
1294
+ count_delete++;
1295
+ text_delete += diffs[pointer][1];
1296
+ pointer++;
1297
+ break;
1298
+ case DIFF_EQUAL:
1299
+ // Upon reaching an equality, check for prior redundancies.
1300
+ if (count_delete + count_insert > 1) {
1301
+ if (count_delete !== 0 && count_insert !== 0) {
1302
+ // Factor out any common prefixies.
1303
+ commonlength = this.diff_commonPrefix(text_insert, text_delete);
1304
+ if (commonlength !== 0) {
1305
+ if ((pointer - count_delete - count_insert) > 0 &&
1306
+ diffs[pointer - count_delete - count_insert - 1][0] ==
1307
+ DIFF_EQUAL) {
1308
+ diffs[pointer - count_delete - count_insert - 1][1] +=
1309
+ text_insert.substring(0, commonlength);
1310
+ } else {
1311
+ diffs.splice(0, 0, [DIFF_EQUAL,
1312
+ text_insert.substring(0, commonlength)]);
1313
+ pointer++;
1314
+ }
1315
+ text_insert = text_insert.substring(commonlength);
1316
+ text_delete = text_delete.substring(commonlength);
1317
+ }
1318
+ // Factor out any common suffixies.
1319
+ commonlength = this.diff_commonSuffix(text_insert, text_delete);
1320
+ if (commonlength !== 0) {
1321
+ diffs[pointer][1] = text_insert.substring(text_insert.length -
1322
+ commonlength) + diffs[pointer][1];
1323
+ text_insert = text_insert.substring(0, text_insert.length -
1324
+ commonlength);
1325
+ text_delete = text_delete.substring(0, text_delete.length -
1326
+ commonlength);
1327
+ }
1328
+ }
1329
+ // Delete the offending records and add the merged ones.
1330
+ if (count_delete === 0) {
1331
+ diffs.splice(pointer - count_insert,
1332
+ count_delete + count_insert, [DIFF_INSERT, text_insert]);
1333
+ } else if (count_insert === 0) {
1334
+ diffs.splice(pointer - count_delete,
1335
+ count_delete + count_insert, [DIFF_DELETE, text_delete]);
1336
+ } else {
1337
+ diffs.splice(pointer - count_delete - count_insert,
1338
+ count_delete + count_insert, [DIFF_DELETE, text_delete],
1339
+ [DIFF_INSERT, text_insert]);
1340
+ }
1341
+ pointer = pointer - count_delete - count_insert +
1342
+ (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;
1343
+ } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {
1344
+ // Merge this equality with the previous one.
1345
+ diffs[pointer - 1][1] += diffs[pointer][1];
1346
+ diffs.splice(pointer, 1);
1347
+ } else {
1348
+ pointer++;
1349
+ }
1350
+ count_insert = 0;
1351
+ count_delete = 0;
1352
+ text_delete = '';
1353
+ text_insert = '';
1354
+ break;
1355
+ }
1356
+ }
1357
+ if (diffs[diffs.length - 1][1] === '') {
1358
+ diffs.pop(); // Remove the dummy entry at the end.
1359
+ }
1360
+
1361
+ // Second pass: look for single edits surrounded on both sides by equalities
1362
+ // which can be shifted sideways to eliminate an equality.
1363
+ // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
1364
+ var changes = false;
1365
+ pointer = 1;
1366
+ // Intentionally ignore the first and last element (don't need checking).
1367
+ while (pointer < diffs.length - 1) {
1368
+ if (diffs[pointer - 1][0] == DIFF_EQUAL &&
1369
+ diffs[pointer + 1][0] == DIFF_EQUAL) {
1370
+ // This is a single edit surrounded by equalities.
1371
+ if (diffs[pointer][1].substring(diffs[pointer][1].length -
1372
+ diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {
1373
+ // Shift the edit over the previous equality.
1374
+ diffs[pointer][1] = diffs[pointer - 1][1] +
1375
+ diffs[pointer][1].substring(0, diffs[pointer][1].length -
1376
+ diffs[pointer - 1][1].length);
1377
+ diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
1378
+ diffs.splice(pointer - 1, 1);
1379
+ changes = true;
1380
+ } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==
1381
+ diffs[pointer + 1][1]) {
1382
+ // Shift the edit over the next equality.
1383
+ diffs[pointer - 1][1] += diffs[pointer + 1][1];
1384
+ diffs[pointer][1] =
1385
+ diffs[pointer][1].substring(diffs[pointer + 1][1].length) +
1386
+ diffs[pointer + 1][1];
1387
+ diffs.splice(pointer + 1, 1);
1388
+ changes = true;
1389
+ }
1390
+ }
1391
+ pointer++;
1392
+ }
1393
+ // If shifts were made, the diff needs reordering and another shift sweep.
1394
+ if (changes) {
1395
+ this.diff_cleanupMerge(diffs);
1396
+ }
1397
+ };
1398
+
1399
+
1400
+ /**
1401
+ * loc is a location in text1, compute and return the equivalent location in
1402
+ * text2.
1403
+ * e.g. 'The cat' vs 'The big cat', 1->1, 5->8
1404
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
1405
+ * @param {number} loc Location within text1.
1406
+ * @return {number} Location within text2.
1407
+ */
1408
+ diff_match_patch.prototype.diff_xIndex = function(diffs, loc) {
1409
+ var chars1 = 0;
1410
+ var chars2 = 0;
1411
+ var last_chars1 = 0;
1412
+ var last_chars2 = 0;
1413
+ var x;
1414
+ for (x = 0; x < diffs.length; x++) {
1415
+ if (diffs[x][0] !== DIFF_INSERT) { // Equality or deletion.
1416
+ chars1 += diffs[x][1].length;
1417
+ }
1418
+ if (diffs[x][0] !== DIFF_DELETE) { // Equality or insertion.
1419
+ chars2 += diffs[x][1].length;
1420
+ }
1421
+ if (chars1 > loc) { // Overshot the location.
1422
+ break;
1423
+ }
1424
+ last_chars1 = chars1;
1425
+ last_chars2 = chars2;
1426
+ }
1427
+ // Was the location was deleted?
1428
+ if (diffs.length != x && diffs[x][0] === DIFF_DELETE) {
1429
+ return last_chars2;
1430
+ }
1431
+ // Add the remaining character length.
1432
+ return last_chars2 + (loc - last_chars1);
1433
+ };
1434
+
1435
+
1436
+ /**
1437
+ * Convert a diff array into a pretty HTML report.
1438
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
1439
+ * @return {string} HTML representation.
1440
+ */
1441
+ diff_match_patch.prototype.diff_prettyHtml = function(diffs) {
1442
+ var html = [];
1443
+ var pattern_amp = /&/g;
1444
+ var pattern_lt = /</g;
1445
+ var pattern_gt = />/g;
1446
+ var pattern_para = /\n/g;
1447
+ for (var x = 0; x < diffs.length; x++) {
1448
+ var op = diffs[x][0]; // Operation (insert, delete, equal)
1449
+ var data = diffs[x][1]; // Text of change.
1450
+ var text = data.replace(pattern_amp, '&amp;').replace(pattern_lt, '&lt;')
1451
+ .replace(pattern_gt, '&gt;').replace(pattern_para, '&para;<br>');
1452
+ switch (op) {
1453
+ case DIFF_INSERT:
1454
+ html[x] = '<ins style="background:#e6ffe6;">' + text + '</ins>';
1455
+ break;
1456
+ case DIFF_DELETE:
1457
+ html[x] = '<del style="background:#ffe6e6;">' + text + '</del>';
1458
+ break;
1459
+ case DIFF_EQUAL:
1460
+ html[x] = '<span>' + text + '</span>';
1461
+ break;
1462
+ }
1463
+ }
1464
+ return html.join('');
1465
+ };
1466
+
1467
+
1468
+ /**
1469
+ * Compute and return the source text (all equalities and deletions).
1470
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
1471
+ * @return {string} Source text.
1472
+ */
1473
+ diff_match_patch.prototype.diff_text1 = function(diffs) {
1474
+ var text = [];
1475
+ for (var x = 0; x < diffs.length; x++) {
1476
+ if (diffs[x][0] !== DIFF_INSERT) {
1477
+ text[x] = diffs[x][1];
1478
+ }
1479
+ }
1480
+ return text.join('');
1481
+ };
1482
+
1483
+
1484
+ /**
1485
+ * Compute and return the destination text (all equalities and insertions).
1486
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
1487
+ * @return {string} Destination text.
1488
+ */
1489
+ diff_match_patch.prototype.diff_text2 = function(diffs) {
1490
+ var text = [];
1491
+ for (var x = 0; x < diffs.length; x++) {
1492
+ if (diffs[x][0] !== DIFF_DELETE) {
1493
+ text[x] = diffs[x][1];
1494
+ }
1495
+ }
1496
+ return text.join('');
1497
+ };
1498
+
1499
+
1500
+ /**
1501
+ * Compute the Levenshtein distance; the number of inserted, deleted or
1502
+ * substituted characters.
1503
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
1504
+ * @return {number} Number of changes.
1505
+ */
1506
+ diff_match_patch.prototype.diff_levenshtein = function(diffs) {
1507
+ var levenshtein = 0;
1508
+ var insertions = 0;
1509
+ var deletions = 0;
1510
+ for (var x = 0; x < diffs.length; x++) {
1511
+ var op = diffs[x][0];
1512
+ var data = diffs[x][1];
1513
+ switch (op) {
1514
+ case DIFF_INSERT:
1515
+ insertions += data.length;
1516
+ break;
1517
+ case DIFF_DELETE:
1518
+ deletions += data.length;
1519
+ break;
1520
+ case DIFF_EQUAL:
1521
+ // A deletion and an insertion is one substitution.
1522
+ levenshtein += Math.max(insertions, deletions);
1523
+ insertions = 0;
1524
+ deletions = 0;
1525
+ break;
1526
+ }
1527
+ }
1528
+ levenshtein += Math.max(insertions, deletions);
1529
+ return levenshtein;
1530
+ };
1531
+
1532
+
1533
+ /**
1534
+ * Crush the diff into an encoded string which describes the operations
1535
+ * required to transform text1 into text2.
1536
+ * E.g. =3\t-2\t+ing -> Keep 3 chars, delete 2 chars, insert 'ing'.
1537
+ * Operations are tab-separated. Inserted text is escaped using %xx notation.
1538
+ * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
1539
+ * @return {string} Delta text.
1540
+ */
1541
+ diff_match_patch.prototype.diff_toDelta = function(diffs) {
1542
+ var text = [];
1543
+ for (var x = 0; x < diffs.length; x++) {
1544
+ switch (diffs[x][0]) {
1545
+ case DIFF_INSERT:
1546
+ text[x] = '+' + encodeURI(diffs[x][1]);
1547
+ break;
1548
+ case DIFF_DELETE:
1549
+ text[x] = '-' + diffs[x][1].length;
1550
+ break;
1551
+ case DIFF_EQUAL:
1552
+ text[x] = '=' + diffs[x][1].length;
1553
+ break;
1554
+ }
1555
+ }
1556
+ return text.join('\t').replace(/%20/g, ' ');
1557
+ };
1558
+
1559
+
1560
+ /**
1561
+ * Given the original text1, and an encoded string which describes the
1562
+ * operations required to transform text1 into text2, compute the full diff.
1563
+ * @param {string} text1 Source string for the diff.
1564
+ * @param {string} delta Delta text.
1565
+ * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.
1566
+ * @throws {!Error} If invalid input.
1567
+ */
1568
+ diff_match_patch.prototype.diff_fromDelta = function(text1, delta) {
1569
+ var diffs = [];
1570
+ var diffsLength = 0; // Keeping our own length var is faster in JS.
1571
+ var pointer = 0; // Cursor in text1
1572
+ var tokens = delta.split(/\t/g);
1573
+ for (var x = 0; x < tokens.length; x++) {
1574
+ // Each token begins with a one character parameter which specifies the
1575
+ // operation of this token (delete, insert, equality).
1576
+ var param = tokens[x].substring(1);
1577
+ switch (tokens[x].charAt(0)) {
1578
+ case '+':
1579
+ try {
1580
+ diffs[diffsLength++] = [DIFF_INSERT, decodeURI(param)];
1581
+ } catch (ex) {
1582
+ // Malformed URI sequence.
1583
+ throw new Error('Illegal escape in diff_fromDelta: ' + param);
1584
+ }
1585
+ break;
1586
+ case '-':
1587
+ // Fall through.
1588
+ case '=':
1589
+ var n = parseInt(param, 10);
1590
+ if (isNaN(n) || n < 0) {
1591
+ throw new Error('Invalid number in diff_fromDelta: ' + param);
1592
+ }
1593
+ var text = text1.substring(pointer, pointer += n);
1594
+ if (tokens[x].charAt(0) == '=') {
1595
+ diffs[diffsLength++] = [DIFF_EQUAL, text];
1596
+ } else {
1597
+ diffs[diffsLength++] = [DIFF_DELETE, text];
1598
+ }
1599
+ break;
1600
+ default:
1601
+ // Blank tokens are ok (from a trailing \t).
1602
+ // Anything else is an error.
1603
+ if (tokens[x]) {
1604
+ throw new Error('Invalid diff operation in diff_fromDelta: ' +
1605
+ tokens[x]);
1606
+ }
1607
+ }
1608
+ }
1609
+ if (pointer != text1.length) {
1610
+ throw new Error('Delta length (' + pointer +
1611
+ ') does not equal source text length (' + text1.length + ').');
1612
+ }
1613
+ return diffs;
1614
+ };
1615
+
1616
+
1617
+ // MATCH FUNCTIONS
1618
+
1619
+
1620
+ /**
1621
+ * Locate the best instance of 'pattern' in 'text' near 'loc'.
1622
+ * @param {string} text The text to search.
1623
+ * @param {string} pattern The pattern to search for.
1624
+ * @param {number} loc The location to search around.
1625
+ * @return {number} Best match index or -1.
1626
+ */
1627
+ diff_match_patch.prototype.match_main = function(text, pattern, loc) {
1628
+ // Check for null inputs.
1629
+ if (text == null || pattern == null || loc == null) {
1630
+ throw new Error('Null input. (match_main)');
1631
+ }
1632
+
1633
+ loc = Math.max(0, Math.min(loc, text.length));
1634
+ if (text == pattern) {
1635
+ // Shortcut (potentially not guaranteed by the algorithm)
1636
+ return 0;
1637
+ } else if (!text.length) {
1638
+ // Nothing to match.
1639
+ return -1;
1640
+ } else if (text.substring(loc, loc + pattern.length) == pattern) {
1641
+ // Perfect match at the perfect spot! (Includes case of null pattern)
1642
+ return loc;
1643
+ } else {
1644
+ // Do a fuzzy compare.
1645
+ return this.match_bitap_(text, pattern, loc);
1646
+ }
1647
+ };
1648
+
1649
+
1650
+ /**
1651
+ * Locate the best instance of 'pattern' in 'text' near 'loc' using the
1652
+ * Bitap algorithm.
1653
+ * @param {string} text The text to search.
1654
+ * @param {string} pattern The pattern to search for.
1655
+ * @param {number} loc The location to search around.
1656
+ * @return {number} Best match index or -1.
1657
+ * @private
1658
+ */
1659
+ diff_match_patch.prototype.match_bitap_ = function(text, pattern, loc) {
1660
+ if (pattern.length > this.Match_MaxBits) {
1661
+ throw new Error('Pattern too long for this browser.');
1662
+ }
1663
+
1664
+ // Initialise the alphabet.
1665
+ var s = this.match_alphabet_(pattern);
1666
+
1667
+ var dmp = this; // 'this' becomes 'window' in a closure.
1668
+
1669
+ /**
1670
+ * Compute and return the score for a match with e errors and x location.
1671
+ * Accesses loc and pattern through being a closure.
1672
+ * @param {number} e Number of errors in match.
1673
+ * @param {number} x Location of match.
1674
+ * @return {number} Overall score for match (0.0 = good, 1.0 = bad).
1675
+ * @private
1676
+ */
1677
+ function match_bitapScore_(e, x) {
1678
+ var accuracy = e / pattern.length;
1679
+ var proximity = Math.abs(loc - x);
1680
+ if (!dmp.Match_Distance) {
1681
+ // Dodge divide by zero error.
1682
+ return proximity ? 1.0 : accuracy;
1683
+ }
1684
+ return accuracy + (proximity / dmp.Match_Distance);
1685
+ }
1686
+
1687
+ // Highest score beyond which we give up.
1688
+ var score_threshold = this.Match_Threshold;
1689
+ // Is there a nearby exact match? (speedup)
1690
+ var best_loc = text.indexOf(pattern, loc);
1691
+ if (best_loc != -1) {
1692
+ score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold);
1693
+ // What about in the other direction? (speedup)
1694
+ best_loc = text.lastIndexOf(pattern, loc + pattern.length);
1695
+ if (best_loc != -1) {
1696
+ score_threshold =
1697
+ Math.min(match_bitapScore_(0, best_loc), score_threshold);
1698
+ }
1699
+ }
1700
+
1701
+ // Initialise the bit arrays.
1702
+ var matchmask = 1 << (pattern.length - 1);
1703
+ best_loc = -1;
1704
+
1705
+ var bin_min, bin_mid;
1706
+ var bin_max = pattern.length + text.length;
1707
+ var last_rd;
1708
+ for (var d = 0; d < pattern.length; d++) {
1709
+ // Scan for the best match; each iteration allows for one more error.
1710
+ // Run a binary search to determine how far from 'loc' we can stray at this
1711
+ // error level.
1712
+ bin_min = 0;
1713
+ bin_mid = bin_max;
1714
+ while (bin_min < bin_mid) {
1715
+ if (match_bitapScore_(d, loc + bin_mid) <= score_threshold) {
1716
+ bin_min = bin_mid;
1717
+ } else {
1718
+ bin_max = bin_mid;
1719
+ }
1720
+ bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min);
1721
+ }
1722
+ // Use the result from this iteration as the maximum for the next.
1723
+ bin_max = bin_mid;
1724
+ var start = Math.max(1, loc - bin_mid + 1);
1725
+ var finish = Math.min(loc + bin_mid, text.length) + pattern.length;
1726
+
1727
+ var rd = Array(finish + 2);
1728
+ rd[finish + 1] = (1 << d) - 1;
1729
+ for (var j = finish; j >= start; j--) {
1730
+ // The alphabet (s) is a sparse hash, so the following line generates
1731
+ // warnings.
1732
+ var charMatch = s[text.charAt(j - 1)];
1733
+ if (d === 0) { // First pass: exact match.
1734
+ rd[j] = ((rd[j + 1] << 1) | 1) & charMatch;
1735
+ } else { // Subsequent passes: fuzzy match.
1736
+ rd[j] = (((rd[j + 1] << 1) | 1) & charMatch) |
1737
+ (((last_rd[j + 1] | last_rd[j]) << 1) | 1) |
1738
+ last_rd[j + 1];
1739
+ }
1740
+ if (rd[j] & matchmask) {
1741
+ var score = match_bitapScore_(d, j - 1);
1742
+ // This match will almost certainly be better than any existing match.
1743
+ // But check anyway.
1744
+ if (score <= score_threshold) {
1745
+ // Told you so.
1746
+ score_threshold = score;
1747
+ best_loc = j - 1;
1748
+ if (best_loc > loc) {
1749
+ // When passing loc, don't exceed our current distance from loc.
1750
+ start = Math.max(1, 2 * loc - best_loc);
1751
+ } else {
1752
+ // Already passed loc, downhill from here on in.
1753
+ break;
1754
+ }
1755
+ }
1756
+ }
1757
+ }
1758
+ // No hope for a (better) match at greater error levels.
1759
+ if (match_bitapScore_(d + 1, loc) > score_threshold) {
1760
+ break;
1761
+ }
1762
+ last_rd = rd;
1763
+ }
1764
+ return best_loc;
1765
+ };
1766
+
1767
+
1768
+ /**
1769
+ * Initialise the alphabet for the Bitap algorithm.
1770
+ * @param {string} pattern The text to encode.
1771
+ * @return {!Object} Hash of character locations.
1772
+ * @private
1773
+ */
1774
+ diff_match_patch.prototype.match_alphabet_ = function(pattern) {
1775
+ var s = {};
1776
+ for (var i = 0; i < pattern.length; i++) {
1777
+ s[pattern.charAt(i)] = 0;
1778
+ }
1779
+ for (var i = 0; i < pattern.length; i++) {
1780
+ s[pattern.charAt(i)] |= 1 << (pattern.length - i - 1);
1781
+ }
1782
+ return s;
1783
+ };
1784
+
1785
+
1786
+ // PATCH FUNCTIONS
1787
+
1788
+
1789
+ /**
1790
+ * Increase the context until it is unique,
1791
+ * but don't let the pattern expand beyond Match_MaxBits.
1792
+ * @param {!diff_match_patch.patch_obj} patch The patch to grow.
1793
+ * @param {string} text Source text.
1794
+ * @private
1795
+ */
1796
+ diff_match_patch.prototype.patch_addContext_ = function(patch, text) {
1797
+ if (text.length == 0) {
1798
+ return;
1799
+ }
1800
+ var pattern = text.substring(patch.start2, patch.start2 + patch.length1);
1801
+ var padding = 0;
1802
+
1803
+ // Look for the first and last matches of pattern in text. If two different
1804
+ // matches are found, increase the pattern length.
1805
+ while (text.indexOf(pattern) != text.lastIndexOf(pattern) &&
1806
+ pattern.length < this.Match_MaxBits - this.Patch_Margin -
1807
+ this.Patch_Margin) {
1808
+ padding += this.Patch_Margin;
1809
+ pattern = text.substring(patch.start2 - padding,
1810
+ patch.start2 + patch.length1 + padding);
1811
+ }
1812
+ // Add one chunk for good luck.
1813
+ padding += this.Patch_Margin;
1814
+
1815
+ // Add the prefix.
1816
+ var prefix = text.substring(patch.start2 - padding, patch.start2);
1817
+ if (prefix) {
1818
+ patch.diffs.unshift([DIFF_EQUAL, prefix]);
1819
+ }
1820
+ // Add the suffix.
1821
+ var suffix = text.substring(patch.start2 + patch.length1,
1822
+ patch.start2 + patch.length1 + padding);
1823
+ if (suffix) {
1824
+ patch.diffs.push([DIFF_EQUAL, suffix]);
1825
+ }
1826
+
1827
+ // Roll back the start points.
1828
+ patch.start1 -= prefix.length;
1829
+ patch.start2 -= prefix.length;
1830
+ // Extend the lengths.
1831
+ patch.length1 += prefix.length + suffix.length;
1832
+ patch.length2 += prefix.length + suffix.length;
1833
+ };
1834
+
1835
+
1836
+ /**
1837
+ * Compute a list of patches to turn text1 into text2.
1838
+ * Use diffs if provided, otherwise compute it ourselves.
1839
+ * There are four ways to call this function, depending on what data is
1840
+ * available to the caller:
1841
+ * Method 1:
1842
+ * a = text1, b = text2
1843
+ * Method 2:
1844
+ * a = diffs
1845
+ * Method 3 (optimal):
1846
+ * a = text1, b = diffs
1847
+ * Method 4 (deprecated, use method 3):
1848
+ * a = text1, b = text2, c = diffs
1849
+ *
1850
+ * @param {string|!Array.<!diff_match_patch.Diff>} a text1 (methods 1,3,4) or
1851
+ * Array of diff tuples for text1 to text2 (method 2).
1852
+ * @param {string|!Array.<!diff_match_patch.Diff>} opt_b text2 (methods 1,4) or
1853
+ * Array of diff tuples for text1 to text2 (method 3) or undefined (method 2).
1854
+ * @param {string|!Array.<!diff_match_patch.Diff>} opt_c Array of diff tuples
1855
+ * for text1 to text2 (method 4) or undefined (methods 1,2,3).
1856
+ * @return {!Array.<!diff_match_patch.patch_obj>} Array of Patch objects.
1857
+ */
1858
+ diff_match_patch.prototype.patch_make = function(a, opt_b, opt_c) {
1859
+ var text1, diffs;
1860
+ if (typeof a == 'string' && typeof opt_b == 'string' &&
1861
+ typeof opt_c == 'undefined') {
1862
+ // Method 1: text1, text2
1863
+ // Compute diffs from text1 and text2.
1864
+ text1 = /** @type {string} */(a);
1865
+ diffs = this.diff_main(text1, /** @type {string} */(opt_b), true);
1866
+ if (diffs.length > 2) {
1867
+ this.diff_cleanupSemantic(diffs);
1868
+ this.diff_cleanupEfficiency(diffs);
1869
+ }
1870
+ } else if (a && typeof a == 'object' && typeof opt_b == 'undefined' &&
1871
+ typeof opt_c == 'undefined') {
1872
+ // Method 2: diffs
1873
+ // Compute text1 from diffs.
1874
+ diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(a);
1875
+ text1 = this.diff_text1(diffs);
1876
+ } else if (typeof a == 'string' && opt_b && typeof opt_b == 'object' &&
1877
+ typeof opt_c == 'undefined') {
1878
+ // Method 3: text1, diffs
1879
+ text1 = /** @type {string} */(a);
1880
+ diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(opt_b);
1881
+ } else if (typeof a == 'string' && typeof opt_b == 'string' &&
1882
+ opt_c && typeof opt_c == 'object') {
1883
+ // Method 4: text1, text2, diffs
1884
+ // text2 is not used.
1885
+ text1 = /** @type {string} */(a);
1886
+ diffs = /** @type {!Array.<!diff_match_patch.Diff>} */(opt_c);
1887
+ } else {
1888
+ throw new Error('Unknown call format to patch_make.');
1889
+ }
1890
+
1891
+ if (diffs.length === 0) {
1892
+ return []; // Get rid of the null case.
1893
+ }
1894
+ var patches = [];
1895
+ var patch = new diff_match_patch.patch_obj();
1896
+ var patchDiffLength = 0; // Keeping our own length var is faster in JS.
1897
+ var char_count1 = 0; // Number of characters into the text1 string.
1898
+ var char_count2 = 0; // Number of characters into the text2 string.
1899
+ // Start with text1 (prepatch_text) and apply the diffs until we arrive at
1900
+ // text2 (postpatch_text). We recreate the patches one by one to determine
1901
+ // context info.
1902
+ var prepatch_text = text1;
1903
+ var postpatch_text = text1;
1904
+ for (var x = 0; x < diffs.length; x++) {
1905
+ var diff_type = diffs[x][0];
1906
+ var diff_text = diffs[x][1];
1907
+
1908
+ if (!patchDiffLength && diff_type !== DIFF_EQUAL) {
1909
+ // A new patch starts here.
1910
+ patch.start1 = char_count1;
1911
+ patch.start2 = char_count2;
1912
+ }
1913
+
1914
+ switch (diff_type) {
1915
+ case DIFF_INSERT:
1916
+ patch.diffs[patchDiffLength++] = diffs[x];
1917
+ patch.length2 += diff_text.length;
1918
+ postpatch_text = postpatch_text.substring(0, char_count2) + diff_text +
1919
+ postpatch_text.substring(char_count2);
1920
+ break;
1921
+ case DIFF_DELETE:
1922
+ patch.length1 += diff_text.length;
1923
+ patch.diffs[patchDiffLength++] = diffs[x];
1924
+ postpatch_text = postpatch_text.substring(0, char_count2) +
1925
+ postpatch_text.substring(char_count2 +
1926
+ diff_text.length);
1927
+ break;
1928
+ case DIFF_EQUAL:
1929
+ if (diff_text.length <= 2 * this.Patch_Margin &&
1930
+ patchDiffLength && diffs.length != x + 1) {
1931
+ // Small equality inside a patch.
1932
+ patch.diffs[patchDiffLength++] = diffs[x];
1933
+ patch.length1 += diff_text.length;
1934
+ patch.length2 += diff_text.length;
1935
+ } else if (diff_text.length >= 2 * this.Patch_Margin) {
1936
+ // Time for a new patch.
1937
+ if (patchDiffLength) {
1938
+ this.patch_addContext_(patch, prepatch_text);
1939
+ patches.push(patch);
1940
+ patch = new diff_match_patch.patch_obj();
1941
+ patchDiffLength = 0;
1942
+ // Unlike Unidiff, our patch lists have a rolling context.
1943
+ // http://code.google.com/p/google-diff-match-patch/wiki/Unidiff
1944
+ // Update prepatch text & pos to reflect the application of the
1945
+ // just completed patch.
1946
+ prepatch_text = postpatch_text;
1947
+ char_count1 = char_count2;
1948
+ }
1949
+ }
1950
+ break;
1951
+ }
1952
+
1953
+ // Update the current character count.
1954
+ if (diff_type !== DIFF_INSERT) {
1955
+ char_count1 += diff_text.length;
1956
+ }
1957
+ if (diff_type !== DIFF_DELETE) {
1958
+ char_count2 += diff_text.length;
1959
+ }
1960
+ }
1961
+ // Pick up the leftover patch if not empty.
1962
+ if (patchDiffLength) {
1963
+ this.patch_addContext_(patch, prepatch_text);
1964
+ patches.push(patch);
1965
+ }
1966
+
1967
+ return patches;
1968
+ };
1969
+
1970
+
1971
+ /**
1972
+ * Given an array of patches, return another array that is identical.
1973
+ * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of Patch objects.
1974
+ * @return {!Array.<!diff_match_patch.patch_obj>} Array of Patch objects.
1975
+ */
1976
+ diff_match_patch.prototype.patch_deepCopy = function(patches) {
1977
+ // Making deep copies is hard in JavaScript.
1978
+ var patchesCopy = [];
1979
+ for (var x = 0; x < patches.length; x++) {
1980
+ var patch = patches[x];
1981
+ var patchCopy = new diff_match_patch.patch_obj();
1982
+ patchCopy.diffs = [];
1983
+ for (var y = 0; y < patch.diffs.length; y++) {
1984
+ patchCopy.diffs[y] = patch.diffs[y].slice();
1985
+ }
1986
+ patchCopy.start1 = patch.start1;
1987
+ patchCopy.start2 = patch.start2;
1988
+ patchCopy.length1 = patch.length1;
1989
+ patchCopy.length2 = patch.length2;
1990
+ patchesCopy[x] = patchCopy;
1991
+ }
1992
+ return patchesCopy;
1993
+ };
1994
+
1995
+
1996
+ /**
1997
+ * Merge a set of patches onto the text. Return a patched text, as well
1998
+ * as a list of true/false values indicating which patches were applied.
1999
+ * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of Patch objects.
2000
+ * @param {string} text Old text.
2001
+ * @return {!Array.<string|!Array.<boolean>>} Two element Array, containing the
2002
+ * new text and an array of boolean values.
2003
+ */
2004
+ diff_match_patch.prototype.patch_apply = function(patches, text) {
2005
+ if (patches.length == 0) {
2006
+ return [text, []];
2007
+ }
2008
+
2009
+ // Deep copy the patches so that no changes are made to originals.
2010
+ patches = this.patch_deepCopy(patches);
2011
+
2012
+ var nullPadding = this.patch_addPadding(patches);
2013
+ text = nullPadding + text + nullPadding;
2014
+
2015
+ this.patch_splitMax(patches);
2016
+ // delta keeps track of the offset between the expected and actual location
2017
+ // of the previous patch. If there are patches expected at positions 10 and
2018
+ // 20, but the first patch was found at 12, delta is 2 and the second patch
2019
+ // has an effective expected position of 22.
2020
+ var delta = 0;
2021
+ var results = [];
2022
+ for (var x = 0; x < patches.length; x++) {
2023
+ var expected_loc = patches[x].start2 + delta;
2024
+ var text1 = this.diff_text1(patches[x].diffs);
2025
+ var start_loc;
2026
+ var end_loc = -1;
2027
+ if (text1.length > this.Match_MaxBits) {
2028
+ // patch_splitMax will only provide an oversized pattern in the case of
2029
+ // a monster delete.
2030
+ start_loc = this.match_main(text, text1.substring(0, this.Match_MaxBits),
2031
+ expected_loc);
2032
+ if (start_loc != -1) {
2033
+ end_loc = this.match_main(text,
2034
+ text1.substring(text1.length - this.Match_MaxBits),
2035
+ expected_loc + text1.length - this.Match_MaxBits);
2036
+ if (end_loc == -1 || start_loc >= end_loc) {
2037
+ // Can't find valid trailing context. Drop this patch.
2038
+ start_loc = -1;
2039
+ }
2040
+ }
2041
+ } else {
2042
+ start_loc = this.match_main(text, text1, expected_loc);
2043
+ }
2044
+ if (start_loc == -1) {
2045
+ // No match found. :(
2046
+ results[x] = false;
2047
+ // Subtract the delta for this failed patch from subsequent patches.
2048
+ delta -= patches[x].length2 - patches[x].length1;
2049
+ } else {
2050
+ // Found a match. :)
2051
+ results[x] = true;
2052
+ delta = start_loc - expected_loc;
2053
+ var text2;
2054
+ if (end_loc == -1) {
2055
+ text2 = text.substring(start_loc, start_loc + text1.length);
2056
+ } else {
2057
+ text2 = text.substring(start_loc, end_loc + this.Match_MaxBits);
2058
+ }
2059
+ if (text1 == text2) {
2060
+ // Perfect match, just shove the replacement text in.
2061
+ text = text.substring(0, start_loc) +
2062
+ this.diff_text2(patches[x].diffs) +
2063
+ text.substring(start_loc + text1.length);
2064
+ } else {
2065
+ // Imperfect match. Run a diff to get a framework of equivalent
2066
+ // indices.
2067
+ var diffs = this.diff_main(text1, text2, false);
2068
+ if (text1.length > this.Match_MaxBits &&
2069
+ this.diff_levenshtein(diffs) / text1.length >
2070
+ this.Patch_DeleteThreshold) {
2071
+ // The end points match, but the content is unacceptably bad.
2072
+ results[x] = false;
2073
+ } else {
2074
+ this.diff_cleanupSemanticLossless(diffs);
2075
+ var index1 = 0;
2076
+ var index2;
2077
+ for (var y = 0; y < patches[x].diffs.length; y++) {
2078
+ var mod = patches[x].diffs[y];
2079
+ if (mod[0] !== DIFF_EQUAL) {
2080
+ index2 = this.diff_xIndex(diffs, index1);
2081
+ }
2082
+ if (mod[0] === DIFF_INSERT) { // Insertion
2083
+ text = text.substring(0, start_loc + index2) + mod[1] +
2084
+ text.substring(start_loc + index2);
2085
+ } else if (mod[0] === DIFF_DELETE) { // Deletion
2086
+ text = text.substring(0, start_loc + index2) +
2087
+ text.substring(start_loc + this.diff_xIndex(diffs,
2088
+ index1 + mod[1].length));
2089
+ }
2090
+ if (mod[0] !== DIFF_DELETE) {
2091
+ index1 += mod[1].length;
2092
+ }
2093
+ }
2094
+ }
2095
+ }
2096
+ }
2097
+ }
2098
+ // Strip the padding off.
2099
+ text = text.substring(nullPadding.length, text.length - nullPadding.length);
2100
+ return [text, results];
2101
+ };
2102
+
2103
+
2104
+ /**
2105
+ * Add some padding on text start and end so that edges can match something.
2106
+ * Intended to be called only from within patch_apply.
2107
+ * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of Patch objects.
2108
+ * @return {string} The padding string added to each side.
2109
+ */
2110
+ diff_match_patch.prototype.patch_addPadding = function(patches) {
2111
+ var paddingLength = this.Patch_Margin;
2112
+ var nullPadding = '';
2113
+ for (var x = 1; x <= paddingLength; x++) {
2114
+ nullPadding += String.fromCharCode(x);
2115
+ }
2116
+
2117
+ // Bump all the patches forward.
2118
+ for (var x = 0; x < patches.length; x++) {
2119
+ patches[x].start1 += paddingLength;
2120
+ patches[x].start2 += paddingLength;
2121
+ }
2122
+
2123
+ // Add some padding on start of first diff.
2124
+ var patch = patches[0];
2125
+ var diffs = patch.diffs;
2126
+ if (diffs.length == 0 || diffs[0][0] != DIFF_EQUAL) {
2127
+ // Add nullPadding equality.
2128
+ diffs.unshift([DIFF_EQUAL, nullPadding]);
2129
+ patch.start1 -= paddingLength; // Should be 0.
2130
+ patch.start2 -= paddingLength; // Should be 0.
2131
+ patch.length1 += paddingLength;
2132
+ patch.length2 += paddingLength;
2133
+ } else if (paddingLength > diffs[0][1].length) {
2134
+ // Grow first equality.
2135
+ var extraLength = paddingLength - diffs[0][1].length;
2136
+ diffs[0][1] = nullPadding.substring(diffs[0][1].length) + diffs[0][1];
2137
+ patch.start1 -= extraLength;
2138
+ patch.start2 -= extraLength;
2139
+ patch.length1 += extraLength;
2140
+ patch.length2 += extraLength;
2141
+ }
2142
+
2143
+ // Add some padding on end of last diff.
2144
+ patch = patches[patches.length - 1];
2145
+ diffs = patch.diffs;
2146
+ if (diffs.length == 0 || diffs[diffs.length - 1][0] != DIFF_EQUAL) {
2147
+ // Add nullPadding equality.
2148
+ diffs.push([DIFF_EQUAL, nullPadding]);
2149
+ patch.length1 += paddingLength;
2150
+ patch.length2 += paddingLength;
2151
+ } else if (paddingLength > diffs[diffs.length - 1][1].length) {
2152
+ // Grow last equality.
2153
+ var extraLength = paddingLength - diffs[diffs.length - 1][1].length;
2154
+ diffs[diffs.length - 1][1] += nullPadding.substring(0, extraLength);
2155
+ patch.length1 += extraLength;
2156
+ patch.length2 += extraLength;
2157
+ }
2158
+
2159
+ return nullPadding;
2160
+ };
2161
+
2162
+
2163
+ /**
2164
+ * Look through the patches and break up any which are longer than the maximum
2165
+ * limit of the match algorithm.
2166
+ * Intended to be called only from within patch_apply.
2167
+ * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of Patch objects.
2168
+ */
2169
+ diff_match_patch.prototype.patch_splitMax = function(patches) {
2170
+ var patch_size = this.Match_MaxBits;
2171
+ for (var x = 0; x < patches.length; x++) {
2172
+ if (patches[x].length1 <= patch_size) {
2173
+ continue;
2174
+ }
2175
+ var bigpatch = patches[x];
2176
+ // Remove the big old patch.
2177
+ patches.splice(x--, 1);
2178
+ var start1 = bigpatch.start1;
2179
+ var start2 = bigpatch.start2;
2180
+ var precontext = '';
2181
+ while (bigpatch.diffs.length !== 0) {
2182
+ // Create one of several smaller patches.
2183
+ var patch = new diff_match_patch.patch_obj();
2184
+ var empty = true;
2185
+ patch.start1 = start1 - precontext.length;
2186
+ patch.start2 = start2 - precontext.length;
2187
+ if (precontext !== '') {
2188
+ patch.length1 = patch.length2 = precontext.length;
2189
+ patch.diffs.push([DIFF_EQUAL, precontext]);
2190
+ }
2191
+ while (bigpatch.diffs.length !== 0 &&
2192
+ patch.length1 < patch_size - this.Patch_Margin) {
2193
+ var diff_type = bigpatch.diffs[0][0];
2194
+ var diff_text = bigpatch.diffs[0][1];
2195
+ if (diff_type === DIFF_INSERT) {
2196
+ // Insertions are harmless.
2197
+ patch.length2 += diff_text.length;
2198
+ start2 += diff_text.length;
2199
+ patch.diffs.push(bigpatch.diffs.shift());
2200
+ empty = false;
2201
+ } else if (diff_type === DIFF_DELETE && patch.diffs.length == 1 &&
2202
+ patch.diffs[0][0] == DIFF_EQUAL &&
2203
+ diff_text.length > 2 * patch_size) {
2204
+ // This is a large deletion. Let it pass in one chunk.
2205
+ patch.length1 += diff_text.length;
2206
+ start1 += diff_text.length;
2207
+ empty = false;
2208
+ patch.diffs.push([diff_type, diff_text]);
2209
+ bigpatch.diffs.shift();
2210
+ } else {
2211
+ // Deletion or equality. Only take as much as we can stomach.
2212
+ diff_text = diff_text.substring(0,
2213
+ patch_size - patch.length1 - this.Patch_Margin);
2214
+ patch.length1 += diff_text.length;
2215
+ start1 += diff_text.length;
2216
+ if (diff_type === DIFF_EQUAL) {
2217
+ patch.length2 += diff_text.length;
2218
+ start2 += diff_text.length;
2219
+ } else {
2220
+ empty = false;
2221
+ }
2222
+ patch.diffs.push([diff_type, diff_text]);
2223
+ if (diff_text == bigpatch.diffs[0][1]) {
2224
+ bigpatch.diffs.shift();
2225
+ } else {
2226
+ bigpatch.diffs[0][1] =
2227
+ bigpatch.diffs[0][1].substring(diff_text.length);
2228
+ }
2229
+ }
2230
+ }
2231
+ // Compute the head context for the next patch.
2232
+ precontext = this.diff_text2(patch.diffs);
2233
+ precontext =
2234
+ precontext.substring(precontext.length - this.Patch_Margin);
2235
+ // Append the end context for this patch.
2236
+ var postcontext = this.diff_text1(bigpatch.diffs)
2237
+ .substring(0, this.Patch_Margin);
2238
+ if (postcontext !== '') {
2239
+ patch.length1 += postcontext.length;
2240
+ patch.length2 += postcontext.length;
2241
+ if (patch.diffs.length !== 0 &&
2242
+ patch.diffs[patch.diffs.length - 1][0] === DIFF_EQUAL) {
2243
+ patch.diffs[patch.diffs.length - 1][1] += postcontext;
2244
+ } else {
2245
+ patch.diffs.push([DIFF_EQUAL, postcontext]);
2246
+ }
2247
+ }
2248
+ if (!empty) {
2249
+ patches.splice(++x, 0, patch);
2250
+ }
2251
+ }
2252
+ }
2253
+ };
2254
+
2255
+
2256
+ /**
2257
+ * Take a list of patches and return a textual representation.
2258
+ * @param {!Array.<!diff_match_patch.patch_obj>} patches Array of Patch objects.
2259
+ * @return {string} Text representation of patches.
2260
+ */
2261
+ diff_match_patch.prototype.patch_toText = function(patches) {
2262
+ var text = [];
2263
+ for (var x = 0; x < patches.length; x++) {
2264
+ text[x] = patches[x];
2265
+ }
2266
+ return text.join('');
2267
+ };
2268
+
2269
+
2270
+ /**
2271
+ * Parse a textual representation of patches and return a list of Patch objects.
2272
+ * @param {string} textline Text representation of patches.
2273
+ * @return {!Array.<!diff_match_patch.patch_obj>} Array of Patch objects.
2274
+ * @throws {!Error} If invalid input.
2275
+ */
2276
+ diff_match_patch.prototype.patch_fromText = function(textline) {
2277
+ var patches = [];
2278
+ if (!textline) {
2279
+ return patches;
2280
+ }
2281
+ var text = textline.split('\n');
2282
+ var textPointer = 0;
2283
+ var patchHeader = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;
2284
+ while (textPointer < text.length) {
2285
+ var m = text[textPointer].match(patchHeader);
2286
+ if (!m) {
2287
+ throw new Error('Invalid patch string: ' + text[textPointer]);
2288
+ }
2289
+ var patch = new diff_match_patch.patch_obj();
2290
+ patches.push(patch);
2291
+ patch.start1 = parseInt(m[1], 10);
2292
+ if (m[2] === '') {
2293
+ patch.start1--;
2294
+ patch.length1 = 1;
2295
+ } else if (m[2] == '0') {
2296
+ patch.length1 = 0;
2297
+ } else {
2298
+ patch.start1--;
2299
+ patch.length1 = parseInt(m[2], 10);
2300
+ }
2301
+
2302
+ patch.start2 = parseInt(m[3], 10);
2303
+ if (m[4] === '') {
2304
+ patch.start2--;
2305
+ patch.length2 = 1;
2306
+ } else if (m[4] == '0') {
2307
+ patch.length2 = 0;
2308
+ } else {
2309
+ patch.start2--;
2310
+ patch.length2 = parseInt(m[4], 10);
2311
+ }
2312
+ textPointer++;
2313
+
2314
+ while (textPointer < text.length) {
2315
+ var sign = text[textPointer].charAt(0);
2316
+ try {
2317
+ var line = decodeURI(text[textPointer].substring(1));
2318
+ } catch (ex) {
2319
+ // Malformed URI sequence.
2320
+ throw new Error('Illegal escape in patch_fromText: ' + line);
2321
+ }
2322
+ if (sign == '-') {
2323
+ // Deletion.
2324
+ patch.diffs.push([DIFF_DELETE, line]);
2325
+ } else if (sign == '+') {
2326
+ // Insertion.
2327
+ patch.diffs.push([DIFF_INSERT, line]);
2328
+ } else if (sign == ' ') {
2329
+ // Minor equality.
2330
+ patch.diffs.push([DIFF_EQUAL, line]);
2331
+ } else if (sign == '@') {
2332
+ // Start of next patch.
2333
+ break;
2334
+ } else if (sign === '') ; else {
2335
+ // WTF?
2336
+ throw new Error('Invalid patch mode "' + sign + '" in: ' + line);
2337
+ }
2338
+ textPointer++;
2339
+ }
2340
+ }
2341
+ return patches;
2342
+ };
2343
+
2344
+
2345
+ /**
2346
+ * Class representing one patch operation.
2347
+ * @constructor
2348
+ */
2349
+ diff_match_patch.patch_obj = function() {
2350
+ /** @type {!Array.<!diff_match_patch.Diff>} */
2351
+ this.diffs = [];
2352
+ /** @type {?number} */
2353
+ this.start1 = null;
2354
+ /** @type {?number} */
2355
+ this.start2 = null;
2356
+ /** @type {number} */
2357
+ this.length1 = 0;
2358
+ /** @type {number} */
2359
+ this.length2 = 0;
2360
+ };
2361
+
2362
+
2363
+ /**
2364
+ * Emmulate GNU diff's format.
2365
+ * Header: @@ -382,8 +481,9 @@
2366
+ * Indicies are printed as 1-based, not 0-based.
2367
+ * @return {string} The GNU diff string.
2368
+ */
2369
+ diff_match_patch.patch_obj.prototype.toString = function() {
2370
+ var coords1, coords2;
2371
+ if (this.length1 === 0) {
2372
+ coords1 = this.start1 + ',0';
2373
+ } else if (this.length1 == 1) {
2374
+ coords1 = this.start1 + 1;
2375
+ } else {
2376
+ coords1 = (this.start1 + 1) + ',' + this.length1;
2377
+ }
2378
+ if (this.length2 === 0) {
2379
+ coords2 = this.start2 + ',0';
2380
+ } else if (this.length2 == 1) {
2381
+ coords2 = this.start2 + 1;
2382
+ } else {
2383
+ coords2 = (this.start2 + 1) + ',' + this.length2;
2384
+ }
2385
+ var text = ['@@ -' + coords1 + ' +' + coords2 + ' @@\n'];
2386
+ var op;
2387
+ // Escape the body of the patch with %xx notation.
2388
+ for (var x = 0; x < this.diffs.length; x++) {
2389
+ switch (this.diffs[x][0]) {
2390
+ case DIFF_INSERT:
2391
+ op = '+';
2392
+ break;
2393
+ case DIFF_DELETE:
2394
+ op = '-';
2395
+ break;
2396
+ case DIFF_EQUAL:
2397
+ op = ' ';
2398
+ break;
2399
+ }
2400
+ text[x + 1] = op + encodeURI(this.diffs[x][1]) + '\n';
2401
+ }
2402
+ return text.join('').replace(/%20/g, ' ');
2403
+ };
2404
+
2405
+
2406
+ // The following export code was added by @ForbesLindesay
2407
+ module.exports = diff_match_patch;
2408
+ module.exports['diff_match_patch'] = diff_match_patch;
2409
+ module.exports['DIFF_DELETE'] = DIFF_DELETE;
2410
+ module.exports['DIFF_INSERT'] = DIFF_INSERT;
2411
+ module.exports['DIFF_EQUAL'] = DIFF_EQUAL;
2412
+ });
2413
+
2414
+ function handleInput(inPath, oldValue, newValue, inputType) {
2415
+ const path = inPath === null || inPath === void 0 ? void 0 : inPath.replace('//', '/');
2416
+ if (oldValue == undefined || oldValue == null) {
2417
+ return new change.Change({ path, op: [{ type: 'set', oldValue, value: newValue }] });
2418
+ }
2419
+ else if (typeof oldValue === 'number' || inputType == 'number') {
2420
+ return new change.Change({ path, op: [{ type: 'set', oldValue: Number(oldValue), value: Number(newValue) }] });
2421
+ }
2422
+ else {
2423
+ // Build DiffMatchPatch patches from oldValue and newValue
2424
+ const dmp = new diffMatchPatch(), diff = dmp.diff_main(oldValue, newValue);
2425
+ dmp.diff_cleanupSemantic(diff);
2426
+ const patches = dmp.patch_make(oldValue, diff);
2427
+ // Iterate over patches to build a `Change.op`
2428
+ const op = new Array();
2429
+ patches.forEach(patch => {
2430
+ const values = new Array();
2431
+ // start `skipCounter` at the patch start
2432
+ let skipCounter = patch.start1;
2433
+ patch.diffs.forEach(([operation, value]) => {
2434
+ switch (operation) {
2435
+ case 0: // No Change
2436
+ skipCounter += value.length;
2437
+ break;
2438
+ case 1: // Insert
2439
+ if (skipCounter > 0) {
2440
+ values.push(skipCounter);
2441
+ skipCounter = 0;
2442
+ }
2443
+ values.push(value);
2444
+ break;
2445
+ case -1: // Delete
2446
+ if (skipCounter > 0) {
2447
+ values.push(skipCounter);
2448
+ skipCounter = 0;
2449
+ }
2450
+ values.push({ d: value.length });
2451
+ break;
2452
+ }
2453
+ });
2454
+ op.push({ type: 'edit', value: values });
2455
+ });
2456
+ return new change.Change({ path, op });
2457
+ }
2458
+ }
2459
+
2460
+ const placeholder = "Begin typing here...";
2461
+ const EN = {
2462
+ placeholder: placeholder
2463
+ };
2464
+
2465
+ const editableTextCss = "ldf-editable-text.sc-ldf-editable-text{display:block;font-family:var(--ldf-font-face)}.sc-ldf-editable-text-h textarea.sc-ldf-editable-text{display:block;color:inherit;font-family:inherit;font-weight:inherit;font-style:inherit;font-size:inherit;font-variant:inherit;text-decoration:inherit;text-align:inherit;height:1.75em;width:100%;max-width:100%;min-height:1.75em;border:none;outline:none;background:transparent;box-sizing:border-box;resize:none;appearance:none;margin-top:calc(var(--ldf-string-border-width)+var(--ldf-string-border-radius));margin-bottom:var(--ldf-string-border-bottom-width);padding-left:calc(var(--ldf-string-border-width) + 4px);padding-right:calc(var(--ldf-string-border-width) + 4px)}ion-input.sc-ldf-editable-text{--ion-font-family:var(--ldf-font-face);min-height:2em !important}";
2466
+
2467
+ var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2468
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2469
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2470
+ r = Reflect.decorate(decorators, target, key, desc);
2471
+ else
2472
+ for (var i = decorators.length - 1; i >= 0; i--)
2473
+ if (d = decorators[i])
2474
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2475
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2476
+ };
2477
+ const LOCALE = {
2478
+ 'en': EN
2479
+ };
2480
+ const EditableTextComponent = class {
2481
+ constructor(hostRef) {
2482
+ index.registerInstance(this, hostRef);
2483
+ this.ldfCursorMoved = index.createEvent(this, "ldfCursorMoved", 7);
2484
+ this.ldfDocShouldChange = index.createEvent(this, "ldfDocShouldChange", 7);
2485
+ this.ldfAddChildAfter = index.createEvent(this, "ldfAddChildAfter", 7);
2486
+ this.ldfMergeWithPrevious = index.createEvent(this, "ldfMergeWithPrevious", 7);
2487
+ /** The base object this expresses as part of `LiturgicalDocument`.value */
2488
+ this.template = "";
2489
+ /** Function that converts a text node into a `template` — used when a node is split */
2490
+ this.templateMaker = (s) => s;
2491
+ }
2492
+ textChanged(newText) {
2493
+ this.currentText = newText;
2494
+ this.previousText = this.currentText;
2495
+ if (this.textarea) {
2496
+ this.textarea.value = this.currentText;
2497
+ }
2498
+ this.autoGrow();
2499
+ }
2500
+ // Life Cycle
2501
+ componentDidRender() {
2502
+ // After the first render, with text in place, adjust size from minimum
2503
+ this.autoGrow();
2504
+ }
2505
+ // Listeners
2506
+ /** When the user inputs something, autogrow the textarea and process the input */
2507
+ onInput() {
2508
+ // first, update the size of the textarea to match the size of the text
2509
+ this.autoGrow();
2510
+ this.handleInput();
2511
+ }
2512
+ // Debounce calculating and emitting the change so we can send multi-character changes
2513
+ handleInput() {
2514
+ var _a, _b;
2515
+ this.registerCursor();
2516
+ // calculate changes to be made
2517
+ const change = handleInput(this.cursor.path, this.previousText, this.cursor.element.value, this.inputType);
2518
+ // save previous value for diffing purposes on next change
2519
+ this.previousText = ((_b = (_a = this.cursor) === null || _a === void 0 ? void 0 : _a.element) === null || _b === void 0 ? void 0 : _b.value) || '';
2520
+ // emit the event
2521
+ this.ldfDocShouldChange.emit(change);
2522
+ }
2523
+ // This textarea no longer has the focus, so we no longer know where the cursor is
2524
+ onFocusOut() {
2525
+ this.cursor = undefined;
2526
+ this.ldfCursorMoved.emit(undefined);
2527
+ }
2528
+ // Each of focus/select/click/keydown could indicate an action taken that has moved the caret or selection
2529
+ onSelect() {
2530
+ this.registerCursor();
2531
+ }
2532
+ onFocus() {
2533
+ this.registerCursor();
2534
+ }
2535
+ onClick() {
2536
+ this.registerCursor();
2537
+ }
2538
+ onKeyDown() {
2539
+ this.registerCursor();
2540
+ }
2541
+ // Private Methods
2542
+ /** Sets private cursor field to a Cursor instance and sends it as a `cursor` event */
2543
+ registerCursor() {
2544
+ var _a, _b;
2545
+ const start = this.textarea.selectionStart, end = this.textarea.selectionEnd;
2546
+ if (!this.cursor || start !== ((_a = this.cursor) === null || _a === void 0 ? void 0 : _a.start) || end !== ((_b = this.cursor) === null || _b === void 0 ? void 0 : _b.end)) {
2547
+ this.cursor = new cursor.Cursor(this.path, this.textarea.selectionStart, this.textarea.selectionEnd, this.textarea);
2548
+ this.emitCursor(this.cursor);
2549
+ }
2550
+ return this.cursor;
2551
+ }
2552
+ /** Expand the child textarea vertically to fit its content */
2553
+ autoGrow() {
2554
+ if (!this.short && this.textarea) {
2555
+ /* this code is cosmetic, not essential, and relies on the global `window`
2556
+ * we can't guarantee that `window` is always available (e.g., in Angular Universal)
2557
+ * so if there’s no window, just do nothing and let the textarea UI be */
2558
+ if (window) {
2559
+ // reset the textarea height
2560
+ this.textarea.style.height = '1.5em';
2561
+ // calculate the textarea’s height
2562
+ const computed = window.getComputedStyle(this.textarea), height = parseInt(computed.getPropertyValue('border-top-width')) +
2563
+ parseInt(computed.getPropertyValue('padding-top')) +
2564
+ this.textarea.scrollHeight +
2565
+ parseInt(computed.getPropertyValue('padding-bottom')) +
2566
+ parseInt(computed.getPropertyValue('border-bottom-width')) +
2567
+ 5;
2568
+ // set the new height of the textarea
2569
+ this.textarea.style.height = `${height}px`;
2570
+ }
2571
+ }
2572
+ }
2573
+ /** Check for one of
2574
+ * 1) Enter at end of textarea => emit an event telling the parent to add another node in its value here
2575
+ * 2) Enter in middle of line => add a line break (i.e., normal behavior)
2576
+ * 3) Shift + Enter anywhere => add a line break (i.e., normal behavior) */
2577
+ checkEnter(event) {
2578
+ var _a, _b, _c, _d, _e, _f, _g;
2579
+ this.registerCursor();
2580
+ // if this is an Enter key event without the shift key
2581
+ if (event.keyCode == 13 && !event.shiftKey) {
2582
+ // at the end of the textarea — add child after
2583
+ if (((_a = this.cursor) === null || _a === void 0 ? void 0 : _a.start) == this.textarea.value.length) {
2584
+ event.preventDefault();
2585
+ this.ldfAddChildAfter.emit({ path: this.path, template: this.template });
2586
+ }
2587
+ // in the middle of the textarea — split the node
2588
+ else {
2589
+ event.preventDefault();
2590
+ const unsplitValue = this.textarea.value, firstHalf = unsplitValue.slice(0, (_c = (_b = this.cursor) === null || _b === void 0 ? void 0 : _b.start) !== null && _c !== void 0 ? _c : 0), secondHalf = unsplitValue.slice((_e = (_d = this.cursor) === null || _d === void 0 ? void 0 : _d.start) !== null && _e !== void 0 ? _e : 0, this.textarea.value.length);
2591
+ this.ldfDocShouldChange.emit(new change.Change({ path: this.path, op: [{ type: 'set', oldValue: unsplitValue, value: firstHalf }] }));
2592
+ this.ldfAddChildAfter.emit({ path: this.path, template: this.templateMaker(secondHalf) });
2593
+ }
2594
+ }
2595
+ // if this is a Backspace key event at the beginning of the textarea
2596
+ if (event.keyCode == 8 && ((_f = this.cursor) === null || _f === void 0 ? void 0 : _f.start) == 0 && ((_g = this.cursor) === null || _g === void 0 ? void 0 : _g.end) == 0) {
2597
+ event.preventDefault();
2598
+ this.ldfMergeWithPrevious.emit({ path: this.path, value: this.currentText });
2599
+ }
2600
+ }
2601
+ // Lifecycle
2602
+ componentWillLoad() {
2603
+ this.loadLocaleStrings();
2604
+ this.textChanged(this.text);
2605
+ this.previousText = this.text;
2606
+ }
2607
+ // Debounce emitting the change, not registering the change
2608
+ // That means the cursor will also be in the right place when edits need to refer to it,
2609
+ // but also that we won't be sending cursor updates to the server constantly as we type
2610
+ emitCursor(cursor) {
2611
+ this.ldfCursorMoved.emit(cursor);
2612
+ }
2613
+ async loadLocaleStrings() {
2614
+ try {
2615
+ this.localeStrings = LOCALE[locale.getComponentClosestLanguage(this.element)];
2616
+ }
2617
+ catch (e) {
2618
+ console.warn(e);
2619
+ }
2620
+ }
2621
+ render() {
2622
+ const localeStrings = this.localeStrings || {};
2623
+ // Ordinarily, use textarea
2624
+ if (!this.short) {
2625
+ return (index.h(index.Host, null, index.h("textarea", { ref: el => this.textarea = el, placeholder: this.placeholder || localeStrings.placeholder, onKeyDown: (event) => this.checkEnter(event) }, this.currentText)));
2626
+ }
2627
+ else {
2628
+ return (index.h(index.Host, null, index.h("ion-input", { ref: async (el) => this.textarea = await el.getInputElement(), placeholder: this.placeholder || localeStrings.placeholder, value: this.currentText, onKeyDown: (event) => this.checkEnter(event), type: this.inputType || 'text' }), this.unit && this.unit));
2629
+ }
2630
+ }
2631
+ get element() { return index.getElement(this); }
2632
+ static get watchers() { return {
2633
+ "text": ["textChanged"]
2634
+ }; }
2635
+ };
2636
+ __decorate([
2637
+ index$1.Debounce(1250)
2638
+ ], EditableTextComponent.prototype, "handleInput", null);
2639
+ __decorate([
2640
+ index$1.Debounce(500)
2641
+ ], EditableTextComponent.prototype, "emitCursor", null);
2642
+ EditableTextComponent.style = editableTextCss;
2643
+
2644
+ exports.ion_input = Input;
2645
+ exports.ldf_editable_text = EditableTextComponent;