2020-10-09 20:10:21 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								import  { UIEventSource }  from  "../Logic/UIEventSource" ;  
						 
					
						
							
								
									
										
										
										
											2020-10-12 01:25:27 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  { VariableUiElement }  from  "./Base/VariableUIElement" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  LiveQueryHandler  from  "../Logic/Web/LiveQueryHandler" ;  
						 
					
						
							
								
									
										
										
										
											2020-10-14 12:15:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  { ImageCarousel }  from  "./Image/ImageCarousel" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  Combine  from  "./Base/Combine" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  { FixedUiElement }  from  "./Base/FixedUiElement" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  { ImageUploadFlow }  from  "./Image/ImageUploadFlow" ;  
						 
					
						
							
								
									
										
										
										
											2021-01-04 04:06:21 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  ShareButton  from  "./BigComponents/ShareButton" ;  
						 
					
						
							
								
									
										
										
										
											2020-11-22 03:50:09 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  Svg  from  "../Svg" ;  
						 
					
						
							
								
									
										
										
										
											2020-12-08 23:44:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  ReviewElement  from  "./Reviews/ReviewElement" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  MangroveReviews  from  "../Logic/Web/MangroveReviews" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  Translations  from  "./i18n/Translations" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  ReviewForm  from  "./Reviews/ReviewForm" ;  
						 
					
						
							
								
									
										
										
										
											2021-06-16 14:23:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  OpeningHoursVisualization  from  "./OpeningHours/OpeningHoursVisualization" ;  
						 
					
						
							
								
									
										
										
										
											2021-01-03 13:50:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  State  from  "../State" ;  
						 
					
						
							
								
									
										
										
										
											2021-06-11 22:51:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  BaseUIElement  from  "./BaseUIElement" ;  
						 
					
						
							
								
									
										
										
										
											2021-06-21 00:19:19 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  Title  from  "./Base/Title" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  Table  from  "./Base/Table" ;  
						 
					
						
							
								
									
										
										
										
											2021-06-21 03:13:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  Histogram  from  "./BigComponents/Histogram" ;  
						 
					
						
							
								
									
										
										
										
											2021-06-23 02:15:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  Loc  from  "../Models/Loc" ;  
						 
					
						
							
								
									
										
										
										
											2021-06-24 01:17:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  { Utils }  from  "../Utils" ;  
						 
					
						
							
								
									
										
										
										
											2021-08-07 23:11:34 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  LayerConfig  from  "../Models/ThemeConfig/LayerConfig" ;  
						 
					
						
							
								
									
										
										
										
											2021-09-21 02:10:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  StaticFeatureSource  from  "../Logic/FeatureSource/Sources/StaticFeatureSource" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  ShowDataMultiLayer  from  "./ShowDataLayer/ShowDataMultiLayer" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  Minimap  from  "./Base/Minimap" ;  
						 
					
						
							
								
									
										
										
										
											2021-09-29 23:56:59 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  AllImageProviders  from  "../Logic/ImageProviders/AllImageProviders" ;  
						 
					
						
							
								
									
										
										
										
											2021-10-11 23:41:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  WikipediaBox  from  "./Wikipedia/WikipediaBox" ;  
						 
					
						
							
								
									
										
										
										
											2021-10-10 23:38:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  SimpleMetaTagger  from  "../Logic/SimpleMetaTagger" ;  
						 
					
						
							
								
									
										
										
										
											2021-10-12 02:12:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  MultiApply  from  "./Popup/MultiApply" ;  
						 
					
						
							
								
									
										
										
										
											2021-10-22 18:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  ShowDataLayer  from  "./ShowDataLayer/ShowDataLayer" ;  
						 
					
						
							
								
									
										
										
										
											2021-10-29 18:16:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  { SubtleButton }  from  "./Base/SubtleButton" ;  
						 
					
						
							
								
									
										
										
										
											2021-11-03 00:44:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  { DefaultGuiState }  from  "./DefaultGuiState" ;  
						 
					
						
							
								
									
										
										
										
											2021-11-08 20:49:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  { GeoOperations }  from  "../Logic/GeoOperations" ;  
						 
					
						
							
								
									
										
										
										
											2021-11-12 04:11:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  Hash  from  "../Logic/Web/Hash" ;  
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  FeaturePipelineState  from  "../Logic/State/FeaturePipelineState" ;  
						 
					
						
							
								
									
										
										
										
											2021-12-10 04:00:02 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  { ConflateButton ,  ImportPointButton ,  ImportWayButton }  from  "./Popup/ImportButton" ;  
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  TagApplyButton  from  "./Popup/TagApplyButton" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  AutoApplyButton  from  "./Popup/AutoApplyButton" ;  
						 
					
						
							
								
									
										
										
										
											2021-12-21 18:35:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  *  as  left_right_style_json  from  "../assets/layers/left_right_style/left_right_style.json" ;  
						 
					
						
							
								
									
										
										
										
											2021-12-23 21:28:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  { OpenIdEditor }  from  "./BigComponents/CopyrightPanel" ;  
						 
					
						
							
								
									
										
										
										
											2022-01-07 04:14:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  Toggle  from  "./Input/Toggle" ;  
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  Img  from  "./Base/Img" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  ValidatedTextField  from  "./Input/ValidatedTextField" ;  
						 
					
						
							
								
									
										
										
										
											2022-01-08 14:08:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  NoteCommentElement  from  "./Popup/NoteCommentElement" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  ImgurUploader  from  "../Logic/ImageProviders/ImgurUploader" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  FileSelectorButton  from  "./Input/FileSelectorButton" ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  { LoginToggle }  from  "./Popup/LoginButton" ;  
						 
					
						
							
								
									
										
										
										
											2022-01-12 02:31:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								import  { start }  from  "repl" ;  
						 
					
						
							
								
									
										
										
										
											2021-01-03 13:50:18 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-07-01 02:43:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								export  interface  SpecialVisualization  {  
						 
					
						
							
								
									
										
										
										
											2021-06-27 19:21:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    funcName : string , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-09 13:16:40 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    constr :  ( ( state : FeaturePipelineState ,  tagSource : UIEventSource < any > ,  argument : string [ ] ,  guistate : DefaultGuiState , )  = >  BaseUIElement ) , 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-27 19:21:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    docs : string , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    example? : string , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-05 02:06:14 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    args :  {  name : string ,  defaultValue? : string ,  doc : string  } [ ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    getLayerDependencies ? :  ( argument : string [ ] )  = >  string [ ] 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-27 19:21:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-09 20:10:21 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								export  default  class  SpecialVisualizations  {  
						 
					
						
							
								
									
										
										
										
											2021-06-15 01:24:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    public  static  specialVisualizations  =  SpecialVisualizations . init ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    public  static  HelpMessage() { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  helpTexts  = 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            SpecialVisualizations . specialVisualizations . map ( viz  = >  new  Combine ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    new  Title ( viz . funcName ,  3 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    viz . docs , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    viz . args . length  >  0  ?  new  Table ( [ "name" ,  "default" ,  "description" ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        viz . args . map ( arg  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            let  defaultArg  =  arg . defaultValue  ? ?  "_undefined_" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            if  ( defaultArg  ==  "" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                defaultArg  =  "_empty string_" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            return  [ arg . name ,  defaultArg ,  arg . doc ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    )  :  undefined , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    new  Title ( "Example usage of "  +  viz . funcName ,  4 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    new  FixedUiElement ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        viz . example  ? ?  "`{"  +  viz . funcName  +  "("  +  viz . args . map ( arg  = >  arg . defaultValue ) . join ( "," )  +  ")}`" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    ) . SetClass ( "literal-code" ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  new  Combine ( [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                new  Title ( "Special tag renderings" ,  1 ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                "In a tagrendering, some special values are substituted by an advanced UI-element. This allows advanced features and visualizations to be reused by custom themes or even to query third-party API's." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                "General usage is `{func_name()}`, `{func_name(arg, someotherarg)}` or `{func_name(args):cssStyle}`. Note that you _do not_ need to use quotes around your arguments, the comma is enough to separate them. This also implies you cannot use a comma in your args" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                . . . helpTexts 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								            ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        ) . SetClass ( "flex flex-col" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    private  static  init() { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        const  specialVisualizations : SpecialVisualization [ ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "all_tags" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "Prints all key-value pairs of the object - used for debugging" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( ( state : State ,  tags : UIEventSource < any > )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  calculatedTags  =  [ ] . concat ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            SimpleMetaTagger . lazyTags , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            . . . state . layoutToUse . layers . map ( l  = >  l . calculatedTags ? . map ( c  = >  c [ 0 ] )  ? ?  [ ] ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        return  new  VariableUiElement ( tags . map ( tags  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  parts  =  [ ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            for  ( const  key  in  tags )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                if  ( ! tags . hasOwnProperty ( key ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    continue 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                let  v  =  tags [ key ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                if  ( v  ===  "" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    v  =  "<b>empty string</b>" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                parts . push ( [ key ,  v  ? ?  "<b>undefined</b>" ] ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-10 23:38:09 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-22 18:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            for  ( const  key  of  calculatedTags )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                const  value  =  tags [ key ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                if  ( value  ===  undefined )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    continue 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                parts . push ( [ "<i>"  +  key  +  "</i>" ,  value ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-24 01:17:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-08 20:49:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            return  new  Table ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                [ "key" ,  "value" ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                parts 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } ) ) . SetStyle ( "border: 1px solid black; border-radius: 1em;padding:1em;display:block;" ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-24 01:17:29 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    } ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "image_carousel" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "Creates an image carousel for the given sources. An attempt will be made to guess what source is used. Supported: Wikidata identifiers, Wikipedia pages, Wikimedia categories, IMGUR (with attribution, direct links)" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        name :  "image key/prefix (multiple values allowed if comma-seperated)" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        defaultValue : AllImageProviders.defaultKeys.join ( "," ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        doc :  "The keys given to the images, e.g. if <span class='literal-code'>image</span> is given, the first picture URL will be added as <span class='literal-code'>image</span>, the second as <span class='literal-code'>image:0</span>, the third as <span class='literal-code'>image:1</span>, etc... " 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( state : State ,  tags ,  args )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        let  imagePrefixes : string [ ]  =  undefined ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        if  ( args . length  >  0 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            imagePrefixes  =  [ ] . concat ( . . . args . map ( a  = >  a . split ( "," ) ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-23 02:15:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-21 18:35:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        return  new  ImageCarousel ( AllImageProviders . LoadImagesFor ( tags ,  imagePrefixes ) ,  tags ,  state ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-23 02:15:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "image_upload" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "Creates a button where a user can upload an image to IMGUR" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        name :  "image-key" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        doc :  "Image tag to add the URL to (or image-tag:0, image-tag:1 when multiple images are added)" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        defaultValue :  "image" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } ,  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        name :  "label" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        doc :  "The text to show on the button" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        defaultValue :  "Add image" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( state : State ,  tags ,  args )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-21 18:35:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        return  new  ImageUploadFlow ( tags ,  state ,  args [ 0 ] ,  args [ 1 ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "wikipedia" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "A box showing the corresponding wikipedia article - based on the wikidata tag" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-23 02:15:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            name :  "keyToShowWikipediaFor" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            doc :  "Use the wikidata entry from this key to show the wikipedia article for" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            defaultValue :  "wikidata" 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-23 02:15:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    example :  "`{wikipedia()}` is a basic example, `{wikipedia(name:etymology:wikidata)}` to show the wikipedia page of whom the feature was named after. Also remember that these can be styled, e.g. `{wikipedia():max-height: 10rem}` to limit the height" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( _ ,  tagsSource ,  args )  = > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        new  VariableUiElement ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            tagsSource . map ( tags  = >  tags [ args [ 0 ] ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                . map ( wikidata  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    const  wikidatas : string [ ]  = 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                        Utils . NoEmpty ( wikidata ? . split ( ";" ) ? . map ( wd  = >  wd . trim ( ) )  ? ?  [ ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    return  new  WikipediaBox ( wikidatas ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-07-01 02:43:49 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "minimap" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "A small map showing the selected feature." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            doc :  "The (maximum) zoomlevel: the target zoomlevel after fitting the entire feature. The minimap will fit the entire feature, then zoom out to this zoom level. The higher, the more zoomed in with 1 being the entire world and 19 being really close" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            name :  "zoomlevel" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            defaultValue :  "18" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            doc :  "(Matches all resting arguments) This argument should be the key of a property of the feature. The corresponding value is interpreted as either the id or the a list of ID's. The features with these ID's will be shown on this minimap." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            name :  "idKey" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            defaultValue :  "id" 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-27 19:21:31 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    example :  "`{minimap()}`, `{minimap(17, id, _list_of_embedded_feature_ids_calculated_by_calculated_tag):height:10rem; border: 2px solid black}`" , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-21 18:35:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    constr :  ( state ,  tagSource ,  args ,  _ )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  keys  =  [ . . . args ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        keys . splice ( 0 ,  1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  featureStore  =  state . allElements . ContainingFeatures 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  featuresToShow : UIEventSource < {  freshness : Date ,  feature : any  } [ ] >  =  tagSource . map ( properties  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  values : string [ ]  =  Utils . NoNull ( keys . map ( key  = >  properties [ key ] ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  features :  {  freshness : Date ,  feature : any  } [ ]  =  [ ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            for  ( const  value  of  values )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                let  idList  =  [ value ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                if  ( value . startsWith ( "[" ) )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    // This is a list of values
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    idList  =  JSON . parse ( value ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                } 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-23 02:15:28 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                for  ( const  id  of  idList )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    const  feature  =  featureStore . get ( id ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    features . push ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                        freshness : new  Date ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                        feature 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            return  features 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  properties  =  tagSource . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        let  zoom  =  18 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        if  ( args [ 0 ] )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  parsed  =  Number ( args [ 0 ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            if  ( ! isNaN ( parsed )  &&  parsed  >  0  &&  parsed  <  25 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                zoom  =  parsed ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
									
										
										
										
											2021-09-21 02:10:42 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        const  locationSource  =  new  UIEventSource < Loc > ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            lat : Number ( properties . _lat ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            lon : Number ( properties . _lon ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            zoom : zoom 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  minimap  =  Minimap . createMiniMap ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                background : state.backgroundLayer , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                location : locationSource , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                allowMoving : false 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-08 23:44:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        locationSource . addCallback ( loc  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            if  ( loc . zoom  >  zoom )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                // We zoom back
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                locationSource . data . zoom  =  zoom ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                locationSource . ping ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-24 01:55:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        new  ShowDataMultiLayer ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                leafletMap : minimap [ "leafletMap" ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                enablePopups : false , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                zoomToFeatures : true , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                layers : State.state.filteredLayers , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                features : new  StaticFeatureSource ( featuresToShow ,  true ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                allElements : State.state.allElements 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        minimap . SetStyle ( "overflow: hidden; pointer-events: none;" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        return  minimap ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-22 18:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "sided_minimap" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "A small map showing _only one side_ the selected feature. *This features requires to have linerenderings with offset* as only linerenderings with a postive or negative offset will be shown. Note: in most cases, this map will be automatically introduced" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-22 18:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            doc :  "The side to show, either `left` or `right`" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            name :  "side" , 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-22 18:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    example :  "`{sided_minimap(left)}`" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( state ,  tagSource ,  args )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  properties  =  tagSource . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  locationSource  =  new  UIEventSource < Loc > ( { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            lat : Number ( properties . _lat ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            lon : Number ( properties . _lon ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            zoom : 18 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  minimap  =  Minimap . createMiniMap ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                background : state.backgroundLayer , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                location : locationSource , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                allowMoving : false 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  side  =  args [ 0 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  feature  =  state . allElements . ContainingFeatures . get ( tagSource . data . id ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  copy  =  { . . . feature } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        copy . properties  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            id : side 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-22 18:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        new  ShowDataLayer ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                leafletMap : minimap [ "leafletMap" ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                enablePopups : false , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                zoomToFeatures : true , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-21 18:35:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                layerToShow : new  LayerConfig ( left_right_style_json ,  "all_known_layers" ,  true ) , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                features : new  StaticFeatureSource ( [ copy ] ,  false ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                allElements : State.state.allElements 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-22 18:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        minimap . SetStyle ( "overflow: hidden; pointer-events: none;" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        return  minimap ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-12-08 23:44:34 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "reviews" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "Adds an overview of the mangrove-reviews of this object. Mangrove.Reviews needs - in order to identify the reviewed object - a coordinate and a name. By default, the name of the object is given, but this can be overwritten" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    example :  "`{reviews()}` for a vanilla review, `{reviews(name, play_forest)}` to review a play forest. If a name is known, the name will be used as identifier, otherwise 'play_forest' is used" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        name :  "subjectKey" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        defaultValue :  "name" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        doc :  "The key to use to determine the subject. If specified, the subject will be <b>tags[subjectKey]</b>" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } ,  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        name :  "fallback" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        doc :  "The identifier to use, if <i>tags[subjectKey]</i> as specified above is not available. This is effectively a fallback value" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( state : State ,  tags ,  args )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  tgs  =  tags . data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  key  =  args [ 0 ]  ? ?  "name" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        let  subject  =  tgs [ key ]  ? ?  args [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        if  ( subject  ===  undefined  ||  subject  ===  "" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            return  Translations . t . reviews . name_required ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  mangrove  =  MangroveReviews . Get ( Number ( tgs . _lon ) ,  Number ( tgs . _lat ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            encodeURIComponent ( subject ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            state . mangroveIdentity , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            state . osmConnection . _dryRun 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  form  =  new  ReviewForm ( ( r ,  whenDone )  = >  mangrove . AddReview ( r ,  whenDone ) ,  state . osmConnection ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        return  new  ReviewElement ( mangrove . GetSubjectUri ( ) ,  mangrove . GetReviews ( ) ,  form ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "opening_hours_table" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "Creates an opening-hours table. Usage: {opening_hours_table(opening_hours)} to create a table of the tag 'opening_hours'." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ { 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-20 03:09:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        name :  "key" , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        defaultValue :  "opening_hours" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        doc :  "The tagkey from which the table is constructed." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } ,  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        name :  "prefix" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        defaultValue :  "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        doc :  "Remove this string from the start of the value before parsing. __Note: use `&LPARENs` to indicate `(` if needed__" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } ,  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        name :  "postfix" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        defaultValue :  "" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        doc :  "Remove this string from the end of the value before parsing. __Note: use `&RPARENs` to indicate `)` if needed__" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    example :  "A normal opening hours table can be invoked with `{opening_hours_table()}`. A table for e.g. conditional access with opening hours can be `{opening_hours_table(access:conditional, no @ &LPARENS, &RPARENS)}`" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( state : State ,  tagSource : UIEventSource < any > ,  args )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-21 18:35:31 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        return  new  OpeningHoursVisualization ( tagSource ,  state ,  args [ 0 ] ,  args [ 1 ] ,  args [ 2 ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-20 03:09:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "live" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "Downloads a JSON from the given URL, e.g. '{live(example.org/data.json, shorthand:x.y.z, other:a.b.c, shorthand)}' will download the given file, will create an object {shorthand: json[x][y][z], other: json[a][b][c] out of it and will return 'other' or 'json[a][b][c]. This is made to use in combination with tags, e.g. {live({url}, {url:format}, needed_value)}" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    example :  "{live({url},{url:format},hour)} {live(https://data.mobility.brussels/bike/api/counts/?request=live&featureID=CB2105,hour:data.hour_cnt;day:data.day_cnt;year:data.year_cnt,hour)}" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        name :  "Url" ,  doc :  "The URL to load" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } ,  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        name :  "Shorthands" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        doc :  "A list of shorthands, of the format 'shorthandname:path.path.path'. separated by ;" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } ,  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        name :  "path" ,  doc :  "The path (or shorthand) that should be returned" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( state : State ,  tagSource : UIEventSource < any > ,  args )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  url  =  args [ 0 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  shorthands  =  args [ 1 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  neededValue  =  args [ 2 ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  source  =  LiveQueryHandler . FetchLiveData ( url ,  shorthands . split ( ";" ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        return  new  VariableUiElement ( source . map ( data  = >  data [ neededValue ]  ? ?  "Loading..." ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "histogram" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "Create a histogram for a list of given values, read from the properties." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    example :  "`{histogram('some_key')}` with properties being `{some_key: ['a','b','a','c']} to create a histogram" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            name :  "key" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            doc :  "The key to be read and to generate a histogram from" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            name :  "title" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-16 02:00:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            doc :  "This text will be placed above the texts (in the first column of the visulasition)" , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            defaultValue :  "" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            name :  "countHeader" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-16 02:00:55 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            doc :  "This text will be placed above the bars" , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            defaultValue :  "" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            name :  "colors*" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            doc :  "(Matches all resting arguments - optional) Matches a regex onto a color value, e.g. `3[a-zA-Z+-]*:#33cc33`" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( state : State ,  tagSource : UIEventSource < any > ,  args : string [ ] )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        let  assignColors  =  undefined ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        if  ( args . length  >=  3 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  colors  =  [ . . . args ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            colors . splice ( 0 ,  3 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  mapping  =  colors . map ( c  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                const  splitted  =  c . split ( ":" ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                const  value  =  splitted . pop ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                const  regex  =  splitted . join ( ":" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                return  { regex :  "^"  +  regex  +  "$" ,  color : value } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            assignColors  =  ( key )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                for  ( const  kv  of  mapping )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    if  ( key . match ( kv . regex )  !==  null )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                        return  kv . color 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-20 03:09:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                return  undefined 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-21 03:13:05 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        const  listSource : UIEventSource < string [ ] >  =  tagSource 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            . map ( tags  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                try  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    const  value  =  tags [ args [ 0 ] ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    if  ( value  ===  ""  ||  value  ===  undefined )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                        return  undefined 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    return  JSON . parse ( value ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                }  catch  ( e )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    console . error ( "Could not load histogram: parsing  of the list failed: " ,  e ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    return  undefined ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-20 03:09:55 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        return  new  Histogram ( listSource ,  args [ 1 ] ,  args [ 2 ] ,  assignColors ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-21 16:44:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "share_link" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "Creates a link that (attempts to) open the native 'share'-screen" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    example :  "{share_link()} to share the current page, {share_link(<some_url>)} to share the given url" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            name :  "url" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            doc :  "The url to share (default: current URL)" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( state : State ,  tagSource : UIEventSource < any > ,  args )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        if  ( window . navigator . share )  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-15 01:24:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            const  generateShareData  =  ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-15 01:24:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                const  title  =  state ? . layoutToUse ? . title ? . txt  ? ?  "MapComplete" ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-15 01:24:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                let  matchingLayer : LayerConfig  =  state ? . layoutToUse ? . getMatchingLayer ( tagSource ? . data ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                let  name  =  matchingLayer ? . title ? . GetRenderValue ( tagSource . data ) ? . txt  ? ?  tagSource . data ? . name  ? ?  "POI" ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                if  ( name )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    name  =  ` ${ name }  ( ${ title } ) ` 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    name  =  title ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                let  url  =  args [ 0 ]  ? ?  "" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                if  ( url  ===  "" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    url  =  window . location . href 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                return  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    title : name , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    url : url , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    text : state?.layoutToUse?.shortDescription?.txt  ? ?  "MapComplete" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                } 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-15 01:24:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            return  new  ShareButton ( Svg . share_svg ( ) . SetClass ( "w-8 h-8" ) ,  generateShareData ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            return  new  FixedUiElement ( "" ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-23 12:54:10 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-06-15 01:24:04 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-11-21 16:44:48 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "canonical" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "Converts a short, canonical value into the long, translated text" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    example :  "{canonical(length)} will give 42 metre (in french)" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        name :  "key" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        doc :  "The key of the tag to give the canonical text for" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( state ,  tagSource ,  args )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  key  =  args  [ 0 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        return  new  VariableUiElement ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            tagSource . map ( tags  = >  tags [ key ] ) . map ( value  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                if  ( value  ===  undefined )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    return  undefined 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                const  allUnits  =  [ ] . concat ( . . . state . layoutToUse . layers . map ( lyr  = >  lyr . units ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                const  unit  =  allUnits . filter ( unit  = >  unit . isApplicableToKey ( key ) ) [ 0 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                if  ( unit  ===  undefined )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    return  value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                return  unit . asHumanLongValue ( value ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-11-17 16:29:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-22 18:53:07 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                new  ImportPointButton ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                new  ImportWayButton ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                new  ConflateButton ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "multi_apply" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "A button to apply the tagging of this object onto a list of other features. This is an advanced feature for which you'll need calculatedTags" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { name :  "feature_ids" ,  doc :  "A JSOn-serialized list of IDs of features to apply the tagging on" } , 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-12 02:12:45 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            name :  "keys" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            doc :  "One key (or multiple keys, seperated by ';') of the attribute that should be copied onto the other features." 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { name :  "text" ,  doc :  "The text to show on the button" } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            name :  "autoapply" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            doc :  "A boolean indicating wether this tagging should be applied automatically if the relevant tags on this object are changed. A visual element indicating the multi_apply is still shown" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            name :  "overwrite" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            doc :  "If set to 'true', the tags on the other objects will always be overwritten. The default behaviour will be to only change the tags on other objects if they are either undefined or had the same value before the change" 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-29 18:16:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    example :  "{multi_apply(_features_with_the_same_name_within_100m, name:etymology:wikidata;name:etymology, Apply etymology information on all nearby objects with the same name)}" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( state ,  tagsSource ,  args )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  featureIdsKey  =  args [ 0 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  keysToApply  =  args [ 1 ] . split ( ";" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  text  =  args [ 2 ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  autoapply  =  args [ 3 ] ? . toLowerCase ( )  ===  "true" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  overwrite  =  args [ 4 ] ? . toLowerCase ( )  ===  "true" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  featureIds : UIEventSource < string [ ] >  =  tagsSource . map ( tags  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  ids  =  tags [ featureIdsKey ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            try  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                if  ( ids  ===  undefined )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    return  [ ] 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-29 18:16:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                } 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                return  JSON . parse ( ids ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            }  catch  ( e )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                console . warn ( "Could not parse " ,  ids ,  "as JSON to extract IDS which should be shown on the map." ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                return  [ ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-08 20:49:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        return  new  MultiApply ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                featureIds , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                keysToApply , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                text , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                autoapply , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                overwrite , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                tagsSource , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                state 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-08 20:49:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                new  TagApplyButton ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "export_as_gpx" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "Exports the selected feature as GPX-file" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( state ,  tagSource ,  args )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  t  =  Translations . t . general . download ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        return  new  SubtleButton ( Svg . download_ui ( ) , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-23 21:28:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            new  Combine ( [ t . downloadFeatureAsGpx . SetClass ( "font-bold text-lg" ) , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                t . downloadGpxHelper . SetClass ( "subtle" ) ] ) . SetClass ( "flex flex-col" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ) . onClick ( ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            console . log ( "Exporting as GPX!" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  tags  =  tagSource . data 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  feature  =  state . allElements . ContainingFeatures . get ( tags . id ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  matchingLayer  =  state ? . layoutToUse ? . getMatchingLayer ( tags ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  gpx  =  GeoOperations . AsGpx ( feature ,  matchingLayer ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  title  =  matchingLayer . title ? . GetRenderValue ( tags ) ? . Subs ( tags ) ? . txt  ? ?  "gpx_track" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            Utils . offerContentsAsDownloadableFile ( gpx ,  title  +  "_mapcomplete_export.gpx" ,  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                mimetype :  "{gpx=application/gpx+xml}" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-11-08 20:49:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-06 03:24:33 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-23 21:28:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "export_as_geojson" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "Exports the selected feature as GeoJson-file" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( state ,  tagSource ,  args )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  t  =  Translations . t . general . download ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        return  new  SubtleButton ( Svg . download_ui ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            new  Combine ( [ t . downloadFeatureAsGeojson . SetClass ( "font-bold text-lg" ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                t . downloadGeoJsonHelper . SetClass ( "subtle" ) ] ) . SetClass ( "flex flex-col" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ) . onClick ( ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            console . log ( "Exporting as Geojson" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  tags  =  tagSource . data 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  feature  =  state . allElements . ContainingFeatures . get ( tags . id ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  matchingLayer  =  state ? . layoutToUse ? . getMatchingLayer ( tags ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  title  =  matchingLayer . title ? . GetRenderValue ( tags ) ? . Subs ( tags ) ? . txt  ? ?  "geojson" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  data  =  JSON . stringify ( feature ,  null ,  "  " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            Utils . offerContentsAsDownloadableFile ( data ,  title  +  "_mapcomplete_export.geojson" ,  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                mimetype :  "application/vnd.geo+json" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "open_in_iD" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "Opens the current view in the iD-editor" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ ] , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    constr :  ( state ,  feature )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2021-12-23 21:28:41 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        return  new  OpenIdEditor ( state ,  undefined ,  feature . data . id ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-12-12 02:59:24 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "clear_location_history" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "A button to remove the travelled track information from the device" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr : state  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        return  new  SubtleButton ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            Svg . delete_icon_svg ( ) . SetStyle ( "height: 1.5rem" ) ,  Translations . t . general . removeLocationHistory 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ) . onClick ( ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            state . historicalUserLocations . features . setData ( [ ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            Hash . hash . setData ( undefined ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-29 18:16:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-07 04:14:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "close_note" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 02:31:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    docs :  "Button to close a note. A predifined text can be defined to close the note with. If the note is already closed, will show a small text." , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    args :  [ 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-07 04:14:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            name :  "text" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-07 04:14:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            doc :  "Text to show on this button" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            name :  "icon" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            doc :  "Icon to show" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            defaultValue :  "checkmark.svg" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            name :  "Id-key" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-07 04:14:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            doc :  "The property name where the ID of the note to close can be found" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            defaultValue :  "id" 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            name :  "comment" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            doc :  "Text to add onto the note when closing" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-07 04:14:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( state ,  tags ,  args ,  guiState )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  t  =  Translations . t . notes ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        let  icon  =  Svg . checkmark_svg ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 02:31:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        if  ( args [ 1 ]  !==  "checkmark.svg"  &&  ( args [ 2 ]  ? ?  "" )  !==  "" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            icon  =  new  Img ( args [ 1 ] ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        let  textToShow  =  t . closeNote ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        if  ( ( args [ 0 ]  ? ?  "" )  !==  "" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            textToShow  =  Translations . T ( args [ 0 ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  closeButton  =  new  SubtleButton ( icon ,  textToShow ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 02:31:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        const  isClosed  =  tags . map ( tags  = >  ( tags [ "closed_at" ]  ? ?  "" )  !==  "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-07 04:14:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        closeButton . onClick ( ( )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 02:31:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            const  id  =  tags . data [ args [ 2 ]  ? ?  "id" ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            state . osmConnection . closeNote ( id ,  args [ 3 ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                ? . then ( _  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                tags . data [ "closed_at" ]  =  new  Date ( ) . toISOString ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                tags . ping ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-07 04:14:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 14:08:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        return  new  LoginToggle (  new  Toggle ( 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-07 04:14:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            t . isClosed . SetClass ( "thanks" ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            closeButton , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            isClosed 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 14:08:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        ) ,  t . loginToClose ,  state ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-07 04:14:53 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "add_note_comment" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "A textfield to add a comment to a node (with the option to close the note)." , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            name :  "Id-key" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            doc :  "The property name where the ID of the note to close can be found" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            defaultValue :  "id" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( state ,  tags ,  args ,  guiState )  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-17 02:37:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        const  t  =  Translations . t . notes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  textField  =  ValidatedTextField . InputForType ( "text" ,  { placeholder : t.addCommentPlaceholder } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        textField . SetClass ( "rounded-l border border-grey" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  txt  =  textField . GetValue ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 02:31:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        const  addCommentButton  =  new  SubtleButton ( Svg . addSmall_svg ( ) . SetClass ( "max-h-7" ) ,  t . addCommentPlaceholder ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            . onClick ( async  ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                const  id  =  tags . data [ args [ 1 ]  ? ?  "id" ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 14:08:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                if  ( ( txt . data  ? ?  "" )  ==  "" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                if  ( isClosed . data )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    await  state . osmConnection . reopenNote ( id ,  txt . data ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    await  state . osmConnection . closeNote ( id ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    await  state . osmConnection . addCommentToNode ( id ,  txt . data ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                } 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 14:08:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                NoteCommentElement . addCommentTo ( txt . data ,  tags ,  state ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                txt . setData ( "" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 02:31:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        const  close  =  new  SubtleButton ( Svg . resolved_svg ( ) . SetClass ( "max-h-7" ) ,  new  VariableUiElement ( txt . map ( txt  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            if  ( txt  ===  undefined  ||  txt  ===  "" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                return  t . closeNote 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-29 13:53:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            return  t . addCommentAndClose 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } ) ) ) . onClick ( ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  id  =  tags . data [ args [ 1 ]  ? ?  "id" ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            if  ( state . featureSwitchIsTesting . data )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                console . log ( "Testmode: Not actually closing note..." ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            state . osmConnection . closeNote ( id ,  txt . data ) . then ( _  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                tags . data [ "closed_at" ]  =  new  Date ( ) . toISOString ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                tags . ping ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-29 13:53:00 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-17 02:37:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 02:31:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        const  reopen  =  new  SubtleButton ( Svg . note_svg ( ) . SetClass ( "max-h-7" ) ,  new  VariableUiElement ( txt . map ( txt  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            if  ( txt  ===  undefined  ||  txt  ===  "" )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                return  t . reopenNote 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            return  t . reopenNoteAndComment 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } ) ) ) . onClick ( ( )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            const  id  =  tags . data [ args [ 1 ]  ? ?  "id" ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            if  ( state . featureSwitchIsTesting . data )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                console . log ( "Testmode: Not actually reopening note..." ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            state . osmConnection . reopenNote ( id ,  txt . data ) . then ( _  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                tags . data [ "closed_at" ]  =  undefined ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                tags . ping ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } ) 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-17 02:37:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        const  isClosed  =  tags . map ( tags  = >  ( tags [ "closed_at" ]  ? ?  "" )  !==  "" ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 14:08:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        const  stateButtons  =  new  Toggle ( new  Toggle ( reopen ,  close ,  isClosed ) ,  undefined ,  state . osmConnection . isLoggedIn ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        return  new  LoginToggle ( 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            new  Combine ( [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                new  Title ( "Add a comment" ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                textField , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                new  Combine ( [ addCommentButton . SetClass ( "mr-2" ) ,  stateButtons ] ) . SetClass ( "flex justify-end" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            ] ) . SetClass ( "border-2 border-black rounded-xl p-4 block" ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            t . loginToAddComment ,  state ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "visualize_note_comments" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 02:31:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    docs :  "Visualises the comments for notes" , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    args :  [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            name :  "commentsKey" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            doc :  "The property name of the comments, which should be stringified json" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            defaultValue :  "comments" 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 02:31:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            name :  "start" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            doc : "Drop the first 'start' comments" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            defaultValue :  "0" 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    ] 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 14:08:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    ,  constr :  ( state ,  tags ,  args )  = > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        new  VariableUiElement ( 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            tags . map ( tags  = >  tags [ args [ 0 ] ] ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                . map ( commentsStr  = >  { 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 14:08:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                    const  comments : any [ ]  =  JSON . parse ( commentsStr ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-12 02:31:51 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                    const  startLoc  =  Number ( args [ 1 ]  ? ?  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    if ( ! isNaN ( startLoc )  &&  startLoc  >  0 ) { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                        comments . splice ( 0 ,  startLoc ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                    } 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                    return  new  Combine ( comments 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                                        . filter ( c  = >  c . text  !==  "" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 14:08:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                        . map ( c  = >  new  NoteCommentElement ( c ) ) ) . SetClass ( "flex flex-col" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                                } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 14:08:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    funcName :  "add_image_to_note" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    docs :  "Adds an image to a node" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    args :  [ { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        name :  "Id-key" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        doc :  "The property name where the ID of the note to close can be found" , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        defaultValue :  "id" 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    } ] , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    constr :  ( state ,  tags ,  args )  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                    const  isUploading  =  new  UIEventSource ( false ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                      const  t  =  Translations . t . notes ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                          const  id  =  tags . data [ args [ 0 ]  ? ?  "id" ] 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  uploader  =  new  ImgurUploader ( url  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            isUploading . setData ( false ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            state . osmConnection . addCommentToNode ( id ,  url ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            NoteCommentElement . addCommentTo ( url ,  tags ,  state ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  label  =  new  Combine ( [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            Svg . camera_plus_ui ( ) . SetClass ( "block w-12 h-12 p-1 text-4xl " ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 17:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            Translations . t . image . addPicture 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ] ) . SetClass ( "p-2 border-4 border-black rounded-full font-bold h-full align-center w-full flex justify-center" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 14:08:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  fileSelector  =  new  FileSelectorButton ( label ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        fileSelector . GetValue ( ) . addCallback ( filelist  = >  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            isUploading . setData ( true ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            uploader . uploadMany ( "Image for osm.org/note/"  +  id ,  "CC0" ,  filelist ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        } ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 17:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        const  ti  =  Translations . t . image 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        const  uploadPanel  =  new  Combine ( [ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            fileSelector , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            new  Combine ( [ ti . willBePublished ,  ti . cco ] ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            ti . ccoExplanation . SetClass ( "subtle text-sm" ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            ti . respectPrivacy . SetClass ( "text-sm" ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                        ] ) . SetClass ( "flex flex-col" ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 14:08:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                        return  new  LoginToggle (  new  Toggle (  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            Translations . t . image . uploadingPicture . SetClass ( "alert" ) , 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 17:44:23 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                            uploadPanel , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                            isUploading ) ,  t . loginToAddPicture ,  state ) 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                    } 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 14:08:04 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								                } 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-17 02:37:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								            ] 
							 
						 
					
						
							
								
									
										
										
										
											2022-01-08 04:22:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        specialVisualizations . push ( new  AutoApplyButton ( specialVisualizations ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        return  specialVisualizations ; 
							 
						 
					
						
							
								
									
										
										
										
											2020-10-17 02:37:53 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2021-10-29 18:16:51 +02:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2020-10-09 20:10:21 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								}