@@ -1796,109 +1796,7 @@ class ExternalMutationTracker {
1796
1796
return element . tagName === 'FONT' && element . getAttribute ( 'style' ) === 'vertical-align: inherit;' ;
1797
1797
}
1798
1798
}
1799
- function isValueEmpty ( value ) {
1800
- if ( null === value || value === '' || undefined === value || ( Array . isArray ( value ) && value . length === 0 ) ) {
1801
- return true ;
1802
- }
1803
- if ( typeof value !== 'object' ) {
1804
- return false ;
1805
- }
1806
- for ( const key of Object . keys ( value ) ) {
1807
- if ( ! isValueEmpty ( value [ key ] ) ) {
1808
- return false ;
1809
- }
1810
- }
1811
- return true ;
1812
- }
1813
- function toQueryString ( data ) {
1814
- const buildQueryStringEntries = ( data , entries = { } , baseKey = '' ) => {
1815
- Object . entries ( data ) . forEach ( ( [ iKey , iValue ] ) => {
1816
- const key = baseKey === '' ? iKey : `${ baseKey } [${ iKey } ]` ;
1817
- if ( '' === baseKey && isValueEmpty ( iValue ) ) {
1818
- entries [ key ] = '' ;
1819
- }
1820
- else if ( null !== iValue ) {
1821
- if ( typeof iValue === 'object' ) {
1822
- entries = { ...entries , ...buildQueryStringEntries ( iValue , entries , key ) } ;
1823
- }
1824
- else {
1825
- entries [ key ] = encodeURIComponent ( iValue )
1826
- . replace ( / % 2 0 / g, '+' )
1827
- . replace ( / % 2 C / g, ',' ) ;
1828
- }
1829
- }
1830
- } ) ;
1831
- return entries ;
1832
- } ;
1833
- const entries = buildQueryStringEntries ( data ) ;
1834
- return Object . entries ( entries )
1835
- . map ( ( [ key , value ] ) => `${ key } =${ value } ` )
1836
- . join ( '&' ) ;
1837
- }
1838
- function fromQueryString ( search ) {
1839
- search = search . replace ( '?' , '' ) ;
1840
- if ( search === '' )
1841
- return { } ;
1842
- const insertDotNotatedValueIntoData = ( key , value , data ) => {
1843
- const [ first , second , ...rest ] = key . split ( '.' ) ;
1844
- if ( ! second ) {
1845
- data [ key ] = value ;
1846
- return value ;
1847
- }
1848
- if ( data [ first ] === undefined ) {
1849
- data [ first ] = Number . isNaN ( Number . parseInt ( second ) ) ? { } : [ ] ;
1850
- }
1851
- insertDotNotatedValueIntoData ( [ second , ...rest ] . join ( '.' ) , value , data [ first ] ) ;
1852
- } ;
1853
- const entries = search . split ( '&' ) . map ( ( i ) => i . split ( '=' ) ) ;
1854
- const data = { } ;
1855
- entries . forEach ( ( [ key , value ] ) => {
1856
- value = decodeURIComponent ( String ( value || '' ) . replace ( / \+ / g, '%20' ) ) ;
1857
- if ( ! key . includes ( '[' ) ) {
1858
- data [ key ] = value ;
1859
- }
1860
- else {
1861
- if ( '' === value )
1862
- return ;
1863
- const dotNotatedKey = key . replace ( / \[ / g, '.' ) . replace ( / ] / g, '' ) ;
1864
- insertDotNotatedValueIntoData ( dotNotatedKey , value , data ) ;
1865
- }
1866
- } ) ;
1867
- return data ;
1868
- }
1869
- class UrlUtils extends URL {
1870
- has ( key ) {
1871
- const data = this . getData ( ) ;
1872
- return Object . keys ( data ) . includes ( key ) ;
1873
- }
1874
- set ( key , value ) {
1875
- const data = this . getData ( ) ;
1876
- data [ key ] = value ;
1877
- this . setData ( data ) ;
1878
- }
1879
- get ( key ) {
1880
- return this . getData ( ) [ key ] ;
1881
- }
1882
- remove ( key ) {
1883
- const data = this . getData ( ) ;
1884
- delete data [ key ] ;
1885
- this . setData ( data ) ;
1886
- }
1887
- getData ( ) {
1888
- if ( ! this . search ) {
1889
- return { } ;
1890
- }
1891
- return fromQueryString ( this . search ) ;
1892
- }
1893
- setData ( data ) {
1894
- this . search = toQueryString ( data ) ;
1895
- }
1896
- }
1897
- class HistoryStrategy {
1898
- static replace ( url ) {
1899
- history . replaceState ( history . state , '' , url ) ;
1900
- }
1901
- }
1799
+
1902
1800
class UnsyncedInputsTracker {
1903
1801
constructor ( component , modelElementResolver ) {
1904
1802
this . elementEventListeners = [
0 commit comments