 
 ;; --- Initialize WebSocket
 
-
 (s/def ::type keyword?)
 (s/def ::message
   (s/keys :req-un [::type]))

   :drawing-tool nil
   :tooltip nil})

(declare initialized)
(declare initialize-page)

(defn initialize
  "Initialize the workspace state."

                        (rx/filter (ptk/type? ::dp/files-fetched) stream))
                (rx/take 1)
                (rx/do #(reset! st/loader false))
                (rx/mapcat #(rx/of (initialize-state file-id)
                                   (initialize-file file-id)
                                   (initialize-page page-id)
                                   #_(initialize-alignment page-id)))))
          (rx/of (initialize-file file-id)
                 (initialize-page page-id)))))))

(defn- initialize-state
  [file-id]
  (us/assert ::us/uuid file-id)
  (ptk/reify ::initialize-state
    ptk/UpdateEvent
    (update [_ state]
      (let [local (assoc workspace-default :file-id file-id)]
        (-> state
            (assoc :workspace-layout default-layout)
            (assoc :workspace-local local))))))

(defn- initialize-file
  [file-id]
  (us/assert ::us/uuid file-id)
  (ptk/reify ::initialize-file
    ptk/UpdateEvent
    (update [_ state]
      (let [file (get-in state [:files file-id])]
        (assoc state :workspace-file file)))))

(defn initialize-page
  [page-id]
