{
    "tailapp": 2,
    "manifest": {
        "format": 2,
        "app_id": "timer",
        "name": "Timer",
        "version": 1,
        "schema": "tailapps/v0",
        "exported_at": 1795614937,
        "from": "gallery",
        "connections": [],
        "files": {
            "app.json": "cdd35f51f89c7c4e301a62863d8852a40bf70de3b33550693e832d274bf34355"
        },
        "signature": "6omizkjXpwQ8hkW8CG76shbuHaOMy0M2KscMxRcG4zffWwR1QzjZBlOr2KAQgFfPvJ9JwfPMAinzRcDhM3XzAA==",
        "key_id": "gallery-1"
    },
    "app": {
        "schema": "tailapps/v0",
        "app": "timer",
        "name": "Timer",
        "description": "One countdown timer: type a length like 4:30 or 25, or tap a preset, then start. It rings even with TailApps closed, and with sync on it runs on all your devices.",
        "icon": "timer",
        "version": 4,
        "on_sync": "reschedule",
        "permissions": [
            "notify"
        ],
        "state": {
            "name": {
                "type": "text",
                "sync": true,
                "default": "Timer"
            },
            "hue": {
                "type": "text",
                "sync": true,
                "default": "orange"
            },
            "alarm": {
                "type": "bool",
                "sync": true,
                "default": true
            },
            "length": {
                "type": "number",
                "sync": true,
                "default": 300
            },
            "left": {
                "type": "number",
                "sync": true,
                "default": 300
            },
            "ends_at": {
                "type": "number",
                "sync": true,
                "default": 0
            },
            "started_at": {
                "type": "number",
                "sync": true,
                "default": 0
            },
            "status": {
                "type": "text",
                "sync": true,
                "default": "idle"
            },
            "entry": {
                "type": "text",
                "default": ""
            },
            "fresh": {
                "type": "number",
                "default": 0
            }
        },
        "cards": [
            {
                "id": "main",
                "layout": {
                    "column": [
                        {
                            "column": [
                                {
                                    "row": [
                                        {
                                            "timer": "$ends_at",
                                            "mode": "until",
                                            "size": "xxl",
                                            "grow": true,
                                            "when": "$status | map:{running:true, else:false}",
                                            "on_end": "finished"
                                        },
                                        {
                                            "text": "$left | duration:'clock'",
                                            "size": "xxl",
                                            "grow": true,
                                            "when": "$status | map:{running:false, else:true}"
                                        },
                                        {
                                            "button": "Restart",
                                            "icon": "arrow.counterclockwise",
                                            "icon_only": true,
                                            "style": "plain",
                                            "size": "l",
                                            "on": "restart"
                                        },
                                        {
                                            "button": "Start",
                                            "icon": "play.fill",
                                            "icon_only": true,
                                            "style": "plain",
                                            "size": "l",
                                            "on": "start",
                                            "keys": "mod+return",
                                            "when": "$status | map:{running:false, else:true}"
                                        },
                                        {
                                            "button": "Pause",
                                            "icon": "pause.fill",
                                            "icon_only": true,
                                            "style": "plain",
                                            "size": "l",
                                            "on": "pause",
                                            "keys": "mod+return",
                                            "when": "$status | map:{running:true, else:false}"
                                        }
                                    ],
                                    "align": "center",
                                    "gap": "s"
                                },
                                {
                                    "progress": "$ends_at",
                                    "from": "$started_at",
                                    "style": "bar",
                                    "when": "$status | map:{running:true, else:false}"
                                },
                                {
                                    "row": [
                                        {
                                            "text": "$name",
                                            "emphasis": "strong"
                                        },
                                        {
                                            "icon": "$alarm | map:{true:'bell.fill', else:'bell.slash'}",
                                            "size": "s"
                                        },
                                        {
                                            "text": "$length | duration",
                                            "size": "s",
                                            "emphasis": "subtle"
                                        },
                                        {
                                            "spacer": true
                                        },
                                        {
                                            "text": "Ends {$ends_at | time}",
                                            "size": "s",
                                            "emphasis": "subtle",
                                            "when": "$status | map:{running:true, else:false}"
                                        },
                                        {
                                            "text": "Ends {$left | add:$now | time}",
                                            "size": "s",
                                            "emphasis": "subtle",
                                            "when": "$status | map:{running:false, else:true}"
                                        }
                                    ],
                                    "align": "center",
                                    "gap": "s"
                                }
                            ],
                            "style": "tile",
                            "hue": "$hue",
                            "gap": "xs"
                        },
                        {
                            "row": [
                                {
                                    "field": "Length",
                                    "type": "text",
                                    "bind": "$entry",
                                    "placeholder": "4:30, 25 or 1h 30m",
                                    "on_submit": "set_entry",
                                    "grow": true
                                },
                                {
                                    "button": "Set",
                                    "on": "set_entry",
                                    "style": "secondary",
                                    "disabled": "$entry | seconds | map:{null:true, 0:true, else:false}"
                                }
                            ],
                            "align": "end",
                            "gap": "s"
                        },
                        {
                            "row": [
                                {
                                    "button": "1 min",
                                    "on": "preset",
                                    "args": {
                                        "length": 60
                                    },
                                    "style": "secondary",
                                    "size": "s"
                                },
                                {
                                    "button": "3 min",
                                    "on": "preset",
                                    "args": {
                                        "length": 180
                                    },
                                    "style": "secondary",
                                    "size": "s"
                                },
                                {
                                    "button": "5 min",
                                    "on": "preset",
                                    "args": {
                                        "length": 300
                                    },
                                    "style": "secondary",
                                    "size": "s"
                                },
                                {
                                    "button": "10 min",
                                    "on": "preset",
                                    "args": {
                                        "length": 600
                                    },
                                    "style": "secondary",
                                    "size": "s"
                                },
                                {
                                    "button": "15 min",
                                    "on": "preset",
                                    "args": {
                                        "length": 900
                                    },
                                    "style": "secondary",
                                    "size": "s"
                                },
                                {
                                    "button": "25 min",
                                    "on": "preset",
                                    "args": {
                                        "length": 1500
                                    },
                                    "style": "secondary",
                                    "size": "s"
                                },
                                {
                                    "button": "1 hour",
                                    "on": "preset",
                                    "args": {
                                        "length": 3600
                                    },
                                    "style": "secondary",
                                    "size": "s"
                                }
                            ],
                            "wrap": true,
                            "gap": "s"
                        },
                        {
                            "section": "Settings",
                            "collapsible": true,
                            "collapsed": true,
                            "children": [
                                {
                                    "field": "Name",
                                    "type": "text",
                                    "bind": "$name",
                                    "placeholder": "Timer",
                                    "on_change": "reschedule"
                                },
                                {
                                    "field": "Colour",
                                    "type": "color",
                                    "bind": "$hue"
                                },
                                {
                                    "field": "Alarm when it ends",
                                    "type": "toggle",
                                    "value": "$alarm",
                                    "on_change": "set_alarm"
                                }
                            ]
                        }
                    ],
                    "gap": "m"
                }
            },
            {
                "id": "mini",
                "layout": {
                    "column": [
                        {
                            "timer": "$ends_at",
                            "mode": "until",
                            "size": "fill",
                            "when": "$status | map:{running:true, else:false}"
                        },
                        {
                            "text": "$left | duration:'clock'",
                            "size": "fill",
                            "when": "$status | map:{running:false, else:true}"
                        },
                        {
                            "row": [
                                {
                                    "text": "$name",
                                    "emphasis": "subtle",
                                    "grow": true
                                },
                                {
                                    "button": "Restart",
                                    "icon": "arrow.counterclockwise",
                                    "icon_only": true,
                                    "style": "plain",
                                    "on": "restart"
                                },
                                {
                                    "button": "Start",
                                    "icon": "play.fill",
                                    "icon_only": true,
                                    "style": "plain",
                                    "on": "start",
                                    "when": "$status | map:{running:false, else:true}"
                                },
                                {
                                    "button": "Pause",
                                    "icon": "pause.fill",
                                    "icon_only": true,
                                    "style": "plain",
                                    "on": "pause",
                                    "when": "$status | map:{running:true, else:false}"
                                }
                            ],
                            "align": "center",
                            "gap": "s"
                        }
                    ],
                    "style": "tile",
                    "hue": "$hue",
                    "gap": "xs"
                }
            }
        ],
        "actions": {
            "start": {
                "steps": [
                    {
                        "if": "$left | map:{0:true, null:true, else:false}",
                        "then": [
                            {
                                "set": {
                                    "left": "$length"
                                }
                            }
                        ]
                    },
                    {
                        "set": {
                            "ends_at": "$now",
                            "started_at": "$now",
                            "status": "running"
                        }
                    },
                    {
                        "increment": {
                            "ends_at": "$left",
                            "started_at": "$left"
                        }
                    },
                    {
                        "increment": {
                            "started_at": "-$length"
                        }
                    },
                    {
                        "if": "$alarm",
                        "then": [
                            {
                                "notify": {
                                    "title": "$name",
                                    "body": "Time's up",
                                    "at": "$ends_at",
                                    "id": "timer"
                                }
                            }
                        ]
                    }
                ]
            },
            "pause": {
                "steps": [
                    {
                        "set": {
                            "left": "$ends_at"
                        }
                    },
                    {
                        "increment": {
                            "left": "-$now"
                        },
                        "min": 0
                    },
                    {
                        "set": {
                            "ends_at": 0,
                            "status": "paused"
                        }
                    },
                    {
                        "notify": {
                            "cancel": "timer"
                        }
                    }
                ]
            },
            "restart": {
                "steps": [
                    {
                        "set": {
                            "left": "$length",
                            "ends_at": 0,
                            "started_at": 0,
                            "status": "idle"
                        }
                    },
                    {
                        "notify": {
                            "cancel": "timer"
                        }
                    }
                ]
            },
            "finished": {
                "steps": [
                    {
                        "if": "$status | map:{running:true, else:false}",
                        "then": [
                            {
                                "set": {
                                    "fresh": "$ends_at"
                                }
                            },
                            {
                                "increment": {
                                    "fresh": 10
                                }
                            },
                            {
                                "increment": {
                                    "fresh": "-$now"
                                },
                                "min": 0
                            },
                            {
                                "set": {
                                    "left": "$length",
                                    "ends_at": 0,
                                    "started_at": 0,
                                    "status": "idle"
                                }
                            },
                            {
                                "if": "$alarm",
                                "then": [
                                    {
                                        "if": "$fresh",
                                        "then": [
                                            {
                                                "sound": "alert"
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            },
            "set_entry": {
                "steps": [
                    {
                        "if": "$entry | seconds",
                        "then": [
                            {
                                "set": {
                                    "length": "$entry | seconds"
                                }
                            },
                            {
                                "set": {
                                    "left": "$length",
                                    "ends_at": 0,
                                    "started_at": 0,
                                    "status": "idle"
                                }
                            },
                            {
                                "notify": {
                                    "cancel": "timer"
                                }
                            },
                            {
                                "set": {
                                    "entry": ""
                                }
                            }
                        ]
                    }
                ]
            },
            "preset": {
                "args": {
                    "length": "number"
                },
                "steps": [
                    {
                        "set": {
                            "length": "$args.length"
                        }
                    },
                    {
                        "set": {
                            "left": "$length",
                            "ends_at": 0,
                            "started_at": 0,
                            "status": "idle"
                        }
                    },
                    {
                        "notify": {
                            "cancel": "timer"
                        }
                    }
                ]
            },
            "set_alarm": {
                "steps": [
                    {
                        "set": {
                            "alarm": "$args.value"
                        }
                    },
                    {
                        "notify": {
                            "cancel": "timer"
                        }
                    },
                    {
                        "if": "$status | map:{running:true, else:false}",
                        "then": [
                            {
                                "set": {
                                    "left": "$ends_at"
                                }
                            },
                            {
                                "increment": {
                                    "left": "-$now"
                                },
                                "min": 0
                            },
                            {
                                "if": "$left",
                                "then": [
                                    {
                                        "if": "$alarm",
                                        "then": [
                                            {
                                                "notify": {
                                                    "title": "$name",
                                                    "body": "Time's up",
                                                    "at": "$ends_at",
                                                    "id": "timer"
                                                }
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            },
            "reschedule": {
                "steps": [
                    {
                        "notify": {
                            "cancel": "timer"
                        }
                    },
                    {
                        "if": "$status | map:{running:true, else:false}",
                        "then": [
                            {
                                "set": {
                                    "left": "$ends_at"
                                }
                            },
                            {
                                "increment": {
                                    "left": "-$now"
                                },
                                "min": 0
                            },
                            {
                                "if": "$left",
                                "then": [
                                    {
                                        "if": "$alarm",
                                        "then": [
                                            {
                                                "notify": {
                                                    "title": "$name",
                                                    "body": "Time's up",
                                                    "at": "$ends_at",
                                                    "id": "timer"
                                                }
                                            }
                                        ]
                                    }
                                ]
                            }
                        ]
                    }
                ]
            }
        },
        "views": {
            "menubar": {
                "icon": "timer",
                "label": "{$ends_at | until}{$status | map:{paused:'Paused', else:''}}",
                "label_tone": "$status | map:{running:'accent', else:'neutral'}",
                "label_icon": "$status | map:{running:'timer', paused:'pause.circle', else:'timer'}",
                "label_fill": "$hue",
                "card": "main"
            },
            "floating": {
                "card": "mini",
                "width": "narrow",
                "pin": true,
                "chrome": "none"
            }
        },
        "style": {
            "accent": "#f97316"
        }
    },
    "app_json": "{\n  \"schema\": \"tailapps/v0\",\n  \"app\": \"timer\",\n  \"name\": \"Timer\",\n  \"description\": \"One countdown timer: type a length like 4:30 or 25, or tap a preset, then start. It rings even with TailApps closed, and with sync on it runs on all your devices.\",\n  \"icon\": \"timer\",\n  \"version\": 4,\n  \"on_sync\": \"reschedule\",\n  \"permissions\": [\n    \"notify\"\n  ],\n  \"state\": {\n    \"name\": {\n      \"type\": \"text\",\n      \"sync\": true,\n      \"default\": \"Timer\"\n    },\n    \"hue\": {\n      \"type\": \"text\",\n      \"sync\": true,\n      \"default\": \"orange\"\n    },\n    \"alarm\": {\n      \"type\": \"bool\",\n      \"sync\": true,\n      \"default\": true\n    },\n    \"length\": {\n      \"type\": \"number\",\n      \"sync\": true,\n      \"default\": 300\n    },\n    \"left\": {\n      \"type\": \"number\",\n      \"sync\": true,\n      \"default\": 300\n    },\n    \"ends_at\": {\n      \"type\": \"number\",\n      \"sync\": true,\n      \"default\": 0\n    },\n    \"started_at\": {\n      \"type\": \"number\",\n      \"sync\": true,\n      \"default\": 0\n    },\n    \"status\": {\n      \"type\": \"text\",\n      \"sync\": true,\n      \"default\": \"idle\"\n    },\n    \"entry\": {\n      \"type\": \"text\",\n      \"default\": \"\"\n    },\n    \"fresh\": {\n      \"type\": \"number\",\n      \"default\": 0\n    }\n  },\n  \"cards\": [\n    {\n      \"id\": \"main\",\n      \"layout\": {\n        \"column\": [\n          {\n            \"column\": [\n              {\n                \"row\": [\n                  {\n                    \"timer\": \"$ends_at\",\n                    \"mode\": \"until\",\n                    \"size\": \"xxl\",\n                    \"grow\": true,\n                    \"when\": \"$status | map:{running:true, else:false}\",\n                    \"on_end\": \"finished\"\n                  },\n                  {\n                    \"text\": \"$left | duration:'clock'\",\n                    \"size\": \"xxl\",\n                    \"grow\": true,\n                    \"when\": \"$status | map:{running:false, else:true}\"\n                  },\n                  {\n                    \"button\": \"Restart\",\n                    \"icon\": \"arrow.counterclockwise\",\n                    \"icon_only\": true,\n                    \"style\": \"plain\",\n                    \"size\": \"l\",\n                    \"on\": \"restart\"\n                  },\n                  {\n                    \"button\": \"Start\",\n                    \"icon\": \"play.fill\",\n                    \"icon_only\": true,\n                    \"style\": \"plain\",\n                    \"size\": \"l\",\n                    \"on\": \"start\",\n                    \"keys\": \"mod+return\",\n                    \"when\": \"$status | map:{running:false, else:true}\"\n                  },\n                  {\n                    \"button\": \"Pause\",\n                    \"icon\": \"pause.fill\",\n                    \"icon_only\": true,\n                    \"style\": \"plain\",\n                    \"size\": \"l\",\n                    \"on\": \"pause\",\n                    \"keys\": \"mod+return\",\n                    \"when\": \"$status | map:{running:true, else:false}\"\n                  }\n                ],\n                \"align\": \"center\",\n                \"gap\": \"s\"\n              },\n              {\n                \"progress\": \"$ends_at\",\n                \"from\": \"$started_at\",\n                \"style\": \"bar\",\n                \"when\": \"$status | map:{running:true, else:false}\"\n              },\n              {\n                \"row\": [\n                  {\n                    \"text\": \"$name\",\n                    \"emphasis\": \"strong\"\n                  },\n                  {\n                    \"icon\": \"$alarm | map:{true:'bell.fill', else:'bell.slash'}\",\n                    \"size\": \"s\"\n                  },\n                  {\n                    \"text\": \"$length | duration\",\n                    \"size\": \"s\",\n                    \"emphasis\": \"subtle\"\n                  },\n                  {\n                    \"spacer\": true\n                  },\n                  {\n                    \"text\": \"Ends {$ends_at | time}\",\n                    \"size\": \"s\",\n                    \"emphasis\": \"subtle\",\n                    \"when\": \"$status | map:{running:true, else:false}\"\n                  },\n                  {\n                    \"text\": \"Ends {$left | add:$now | time}\",\n                    \"size\": \"s\",\n                    \"emphasis\": \"subtle\",\n                    \"when\": \"$status | map:{running:false, else:true}\"\n                  }\n                ],\n                \"align\": \"center\",\n                \"gap\": \"s\"\n              }\n            ],\n            \"style\": \"tile\",\n            \"hue\": \"$hue\",\n            \"gap\": \"xs\"\n          },\n          {\n            \"row\": [\n              {\n                \"field\": \"Length\",\n                \"type\": \"text\",\n                \"bind\": \"$entry\",\n                \"placeholder\": \"4:30, 25 or 1h 30m\",\n                \"on_submit\": \"set_entry\",\n                \"grow\": true\n              },\n              {\n                \"button\": \"Set\",\n                \"on\": \"set_entry\",\n                \"style\": \"secondary\",\n                \"disabled\": \"$entry | seconds | map:{null:true, 0:true, else:false}\"\n              }\n            ],\n            \"align\": \"end\",\n            \"gap\": \"s\"\n          },\n          {\n            \"row\": [\n              {\n                \"button\": \"1 min\",\n                \"on\": \"preset\",\n                \"args\": {\n                  \"length\": 60\n                },\n                \"style\": \"secondary\",\n                \"size\": \"s\"\n              },\n              {\n                \"button\": \"3 min\",\n                \"on\": \"preset\",\n                \"args\": {\n                  \"length\": 180\n                },\n                \"style\": \"secondary\",\n                \"size\": \"s\"\n              },\n              {\n                \"button\": \"5 min\",\n                \"on\": \"preset\",\n                \"args\": {\n                  \"length\": 300\n                },\n                \"style\": \"secondary\",\n                \"size\": \"s\"\n              },\n              {\n                \"button\": \"10 min\",\n                \"on\": \"preset\",\n                \"args\": {\n                  \"length\": 600\n                },\n                \"style\": \"secondary\",\n                \"size\": \"s\"\n              },\n              {\n                \"button\": \"15 min\",\n                \"on\": \"preset\",\n                \"args\": {\n                  \"length\": 900\n                },\n                \"style\": \"secondary\",\n                \"size\": \"s\"\n              },\n              {\n                \"button\": \"25 min\",\n                \"on\": \"preset\",\n                \"args\": {\n                  \"length\": 1500\n                },\n                \"style\": \"secondary\",\n                \"size\": \"s\"\n              },\n              {\n                \"button\": \"1 hour\",\n                \"on\": \"preset\",\n                \"args\": {\n                  \"length\": 3600\n                },\n                \"style\": \"secondary\",\n                \"size\": \"s\"\n              }\n            ],\n            \"wrap\": true,\n            \"gap\": \"s\"\n          },\n          {\n            \"section\": \"Settings\",\n            \"collapsible\": true,\n            \"collapsed\": true,\n            \"children\": [\n              {\n                \"field\": \"Name\",\n                \"type\": \"text\",\n                \"bind\": \"$name\",\n                \"placeholder\": \"Timer\",\n                \"on_change\": \"reschedule\"\n              },\n              {\n                \"field\": \"Colour\",\n                \"type\": \"color\",\n                \"bind\": \"$hue\"\n              },\n              {\n                \"field\": \"Alarm when it ends\",\n                \"type\": \"toggle\",\n                \"value\": \"$alarm\",\n                \"on_change\": \"set_alarm\"\n              }\n            ]\n          }\n        ],\n        \"gap\": \"m\"\n      }\n    },\n    {\n      \"id\": \"mini\",\n      \"layout\": {\n        \"column\": [\n          {\n            \"timer\": \"$ends_at\",\n            \"mode\": \"until\",\n            \"size\": \"fill\",\n            \"when\": \"$status | map:{running:true, else:false}\"\n          },\n          {\n            \"text\": \"$left | duration:'clock'\",\n            \"size\": \"fill\",\n            \"when\": \"$status | map:{running:false, else:true}\"\n          },\n          {\n            \"row\": [\n              {\n                \"text\": \"$name\",\n                \"emphasis\": \"subtle\",\n                \"grow\": true\n              },\n              {\n                \"button\": \"Restart\",\n                \"icon\": \"arrow.counterclockwise\",\n                \"icon_only\": true,\n                \"style\": \"plain\",\n                \"on\": \"restart\"\n              },\n              {\n                \"button\": \"Start\",\n                \"icon\": \"play.fill\",\n                \"icon_only\": true,\n                \"style\": \"plain\",\n                \"on\": \"start\",\n                \"when\": \"$status | map:{running:false, else:true}\"\n              },\n              {\n                \"button\": \"Pause\",\n                \"icon\": \"pause.fill\",\n                \"icon_only\": true,\n                \"style\": \"plain\",\n                \"on\": \"pause\",\n                \"when\": \"$status | map:{running:true, else:false}\"\n              }\n            ],\n            \"align\": \"center\",\n            \"gap\": \"s\"\n          }\n        ],\n        \"style\": \"tile\",\n        \"hue\": \"$hue\",\n        \"gap\": \"xs\"\n      }\n    }\n  ],\n  \"actions\": {\n    \"start\": {\n      \"steps\": [\n        {\n          \"if\": \"$left | map:{0:true, null:true, else:false}\",\n          \"then\": [\n            {\n              \"set\": {\n                \"left\": \"$length\"\n              }\n            }\n          ]\n        },\n        {\n          \"set\": {\n            \"ends_at\": \"$now\",\n            \"started_at\": \"$now\",\n            \"status\": \"running\"\n          }\n        },\n        {\n          \"increment\": {\n            \"ends_at\": \"$left\",\n            \"started_at\": \"$left\"\n          }\n        },\n        {\n          \"increment\": {\n            \"started_at\": \"-$length\"\n          }\n        },\n        {\n          \"if\": \"$alarm\",\n          \"then\": [\n            {\n              \"notify\": {\n                \"title\": \"$name\",\n                \"body\": \"Time's up\",\n                \"at\": \"$ends_at\",\n                \"id\": \"timer\"\n              }\n            }\n          ]\n        }\n      ]\n    },\n    \"pause\": {\n      \"steps\": [\n        {\n          \"set\": {\n            \"left\": \"$ends_at\"\n          }\n        },\n        {\n          \"increment\": {\n            \"left\": \"-$now\"\n          },\n          \"min\": 0\n        },\n        {\n          \"set\": {\n            \"ends_at\": 0,\n            \"status\": \"paused\"\n          }\n        },\n        {\n          \"notify\": {\n            \"cancel\": \"timer\"\n          }\n        }\n      ]\n    },\n    \"restart\": {\n      \"steps\": [\n        {\n          \"set\": {\n            \"left\": \"$length\",\n            \"ends_at\": 0,\n            \"started_at\": 0,\n            \"status\": \"idle\"\n          }\n        },\n        {\n          \"notify\": {\n            \"cancel\": \"timer\"\n          }\n        }\n      ]\n    },\n    \"finished\": {\n      \"steps\": [\n        {\n          \"if\": \"$status | map:{running:true, else:false}\",\n          \"then\": [\n            {\n              \"set\": {\n                \"fresh\": \"$ends_at\"\n              }\n            },\n            {\n              \"increment\": {\n                \"fresh\": 10\n              }\n            },\n            {\n              \"increment\": {\n                \"fresh\": \"-$now\"\n              },\n              \"min\": 0\n            },\n            {\n              \"set\": {\n                \"left\": \"$length\",\n                \"ends_at\": 0,\n                \"started_at\": 0,\n                \"status\": \"idle\"\n              }\n            },\n            {\n              \"if\": \"$alarm\",\n              \"then\": [\n                {\n                  \"if\": \"$fresh\",\n                  \"then\": [\n                    {\n                      \"sound\": \"alert\"\n                    }\n                  ]\n                }\n              ]\n            }\n          ]\n        }\n      ]\n    },\n    \"set_entry\": {\n      \"steps\": [\n        {\n          \"if\": \"$entry | seconds\",\n          \"then\": [\n            {\n              \"set\": {\n                \"length\": \"$entry | seconds\"\n              }\n            },\n            {\n              \"set\": {\n                \"left\": \"$length\",\n                \"ends_at\": 0,\n                \"started_at\": 0,\n                \"status\": \"idle\"\n              }\n            },\n            {\n              \"notify\": {\n                \"cancel\": \"timer\"\n              }\n            },\n            {\n              \"set\": {\n                \"entry\": \"\"\n              }\n            }\n          ]\n        }\n      ]\n    },\n    \"preset\": {\n      \"args\": {\n        \"length\": \"number\"\n      },\n      \"steps\": [\n        {\n          \"set\": {\n            \"length\": \"$args.length\"\n          }\n        },\n        {\n          \"set\": {\n            \"left\": \"$length\",\n            \"ends_at\": 0,\n            \"started_at\": 0,\n            \"status\": \"idle\"\n          }\n        },\n        {\n          \"notify\": {\n            \"cancel\": \"timer\"\n          }\n        }\n      ]\n    },\n    \"set_alarm\": {\n      \"steps\": [\n        {\n          \"set\": {\n            \"alarm\": \"$args.value\"\n          }\n        },\n        {\n          \"notify\": {\n            \"cancel\": \"timer\"\n          }\n        },\n        {\n          \"if\": \"$status | map:{running:true, else:false}\",\n          \"then\": [\n            {\n              \"set\": {\n                \"left\": \"$ends_at\"\n              }\n            },\n            {\n              \"increment\": {\n                \"left\": \"-$now\"\n              },\n              \"min\": 0\n            },\n            {\n              \"if\": \"$left\",\n              \"then\": [\n                {\n                  \"if\": \"$alarm\",\n                  \"then\": [\n                    {\n                      \"notify\": {\n                        \"title\": \"$name\",\n                        \"body\": \"Time's up\",\n                        \"at\": \"$ends_at\",\n                        \"id\": \"timer\"\n                      }\n                    }\n                  ]\n                }\n              ]\n            }\n          ]\n        }\n      ]\n    },\n    \"reschedule\": {\n      \"steps\": [\n        {\n          \"notify\": {\n            \"cancel\": \"timer\"\n          }\n        },\n        {\n          \"if\": \"$status | map:{running:true, else:false}\",\n          \"then\": [\n            {\n              \"set\": {\n                \"left\": \"$ends_at\"\n              }\n            },\n            {\n              \"increment\": {\n                \"left\": \"-$now\"\n              },\n              \"min\": 0\n            },\n            {\n              \"if\": \"$left\",\n              \"then\": [\n                {\n                  \"if\": \"$alarm\",\n                  \"then\": [\n                    {\n                      \"notify\": {\n                        \"title\": \"$name\",\n                        \"body\": \"Time's up\",\n                        \"at\": \"$ends_at\",\n                        \"id\": \"timer\"\n                      }\n                    }\n                  ]\n                }\n              ]\n            }\n          ]\n        }\n      ]\n    }\n  },\n  \"views\": {\n    \"menubar\": {\n      \"icon\": \"timer\",\n      \"label\": \"{$ends_at | until}{$status | map:{paused:'Paused', else:''}}\",\n      \"label_tone\": \"$status | map:{running:'accent', else:'neutral'}\",\n      \"label_icon\": \"$status | map:{running:'timer', paused:'pause.circle', else:'timer'}\",\n      \"label_fill\": \"$hue\",\n      \"card\": \"main\"\n    },\n    \"floating\": {\n      \"card\": \"mini\",\n      \"width\": \"narrow\",\n      \"pin\": true,\n      \"chrome\": \"none\"\n    }\n  },\n  \"style\": {\n    \"accent\": \"#f97316\"\n  }\n}\n",
    "files": []
}