;ELC   
;;; Compiled
;;; in Emacs version 29.3
;;; with all optimizations.



(byte-code "\301\302!\210\303\304\305\306\307\310\311\312\313\314&	\210\315\300\316\317\320DD\321\322\323%\210\315\324\316\317\325DD\326\322\327\330\331\"B%\210\315\332\316\317\333DD\334\322\335%\207" [0x0-servers require url custom-declare-group 0x0 nil "Share files, links, pastes, and images with others." :group convenience :tag "0x0" :prefix "0x0-" custom-declare-variable funcall function #[0 "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\257\317\301\302\303\320\305\306\307\310\311\312\313\314\315\321\257\322\301\302\303\323\305\306\307\310\311\312\313\314\315\316\257E\207" [0x0 :scheme "https" :host "0x0.st" :default-dir "~/Desktop" :curl-args-fun 0x0--make-0x0-curl-args :min-age 30 :max-age 365 :max-size 536870912 ttm "ttm.sh" 268435456 envs "envs.sh"] 17 #1=""] "Configurations for the target servers.\n\nOverride these values to associate your own target servers." :type (alist :key-type symbol :value-type (plist :value-type sexp)) 0x0-default-server #[0 "\300\207" [0x0] 1 #1#] "Symbol describing server to use.\n\nThe symbol must be a key from the alist `0x0-servers'." choice mapcar #[257 "\300\301\302A\303\"@F\207" [const :tag plist-get :host] 6 "\n\n(fn SRV)"] 0x0-use-curl #[0 "\300\207" [if-installed] 1 #1#] "Policy how how to use curl.\nCan be a symbol (t, nil, if-installed) to respectivly use curl\nunconditionally, never or only if found.\nAlternativly the value might be a string describing a path to the\ncurl binary." (choice (const :tag "Unconditionally" t) (const :tag "If Installed" if-installed) (const :tag "Never" nil) (string :tag "Path to curl"))] 10)#@33 Prompt user for service to use.
(defalias '0x0--choose-server #[0 "\203 \303\304\305\306\307	\"\310\311\310\211\n&!\202 \n\211	\236A\207" [current-prefix-arg 0x0-servers 0x0-default-server intern completing-read "Server: " mapcar car nil t] 9 (#$ . 1698)])#@76 Calculate days a file of size SIZE would last on SERVER.

(fn SERVER SIZE)
(defalias '0x0--calculate-timeout #[514 "\3001) \301\302\303\"!\301\302\304\"!\301\302\305\"!\211Z\306\245\307Z\310\"_\\\266\2030\207\210\311\207" [(wrong-type-argument) float plist-get :min-age :max-age :max-size expt 1.0 3 nil] 10 (#$ . 1964)])#@76 Access the :default-dir property of the SERVER Property list.

(fn SERVER)
(defalias '0x0--get-server-default-dir #[257 "\300\301\"\207" [plist-get :default-dir] 4 (#$ . 2299)])#@64 Access the value of :curl-args-fun on the SERVER.

(fn SERVER)
(defalias '0x0--get-server-curl-args-fun #[257 "\300\301\"\207" [plist-get :curl-args-fun] 4 (#$ . 2483)])#@229 Prompt to pick a file path or use Dired file at point.

This function creates a prompt for interactive functions below.
The SERVER is used to look up the default directory to use for where to find
uploadable files.

(fn SERVER)
(defalias '0x0--pick-file #[257 "\300\301!\203	 \302 \207\303\304\305!\"\207" [derived-mode-p dired-mode dired-file-name-at-point read-file-name "Pick a file to share: " 0x0--get-server-default-dir] 5 (#$ . 2660)])#@157 Make a SERVER host URI using configuration properties.

BASIC-AUTH-CREDS plist optionally contains :user and :pass.

(fn SERVER &optional BASIC-AUTH-CREDS)
(defalias '0x0--make-server-host-uri #[513 "\211\203 \300\301\302\303\"\302\304\"\302\305\"\302\306\"%\207\300\307\302\303\"\302\306\"#\207" [format "%s://%s:%s@%s" plist-get :scheme :user :pass :host "%s://%s"] 10 (#$ . 3110)])#@180 Create 0x0 curl arguments from SERVER configs and FILE-NAME.

BOUNDED indicates a partial upload and that changes querystring parameters.

(fn SERVER FILE-NAME &optional BOUNDED)
(defalias '0x0--make-0x0-curl-args #[770 "\211\203 \300\202	 \301\302\303\304\305\"\306!\257\207" ["file=@-;filename=%s" "file=@%s" "-s" "-S" "-F" format 0x0--make-server-host-uri] 10 (#$ . 3509)])#@107 Call SERVER :curl-args-fun with FILE-NAME and BOUNDED arguments.

(fn SERVER FILE-NAME &optional BOUNDED)
(defalias '0x0--make-curl-args #[770 "\300!\211#\207" [0x0--get-server-curl-args-fun] 8 (#$ . 3899)])#@135 Make Bounds property list from START and END points.

Defaults START to =point-min= and END to =point-min=.

(fn &optional START END)
(defalias '0x0--make-bounds #[512 "\206 e\206\n d\300\301F\207" [:start :end] 8 (#$ . 4117)])#@46 Get end - start size of BOUNDS.

(fn BOUNDS)
(defalias '0x0--bounds-size #[257 "\300\301\"\300\302\"Z\207" [plist-get :end :start] 5 (#$ . 4355)])#@265 Wrapper around curl background process call.

CURL-ARGS are forwarded to the curl command. If BOUNDS are supplied the curl
process call will be called using =call-process-region= on the portion of the
buffer between start and end.

(fn CURL-ARGS &optional BOUNDS)
(defalias '0x0--curl #[513 "\301\302!;\203\f \202 \303\203) \304\305\306\307\"\306\310\"\311\311&\210\2024 \304\312\311\311	&\210\207" [0x0-use-curl generate-new-buffer "*0x0 response*" "curl" apply call-process-region plist-get :start :end nil call-process] 13 (#$ . 4510)])#@174 Create 0x0 url arguments from SERVER configs and FILE-NAME.

BOUNDED indicates a partial upload and changes querystring parameters.

(fn SERVER FILE-NAME &optional BOUNDED)
(defalias '0x0--make-url-props #[770 "\300\301\302!\"\303!?\205 \304\305\306\257\207" [format "name=\"file\"; filename=\"%s\"" file-name-nondirectory 0x0--make-server-host-uri :file-path :query-str :host-uri] 12 (#$ . 5074)])#@138 Uploading using `url' functions according to URL-PROPS infrormation.

Operate on region between BOUNDS.

(fn URL-PROPS &optional BOUNDS)
(defalias '0x0--url #[513 "\303\304\305 \305 \305 $\306\307\"\306\310\"\306\311\"\312\313PBC\203; \314\315\316\"r\211q\210\317\320\"\216\321!\210\322ed\"*\262\202G \322\306\323\"\306\324\"\"\314\315\316\"r\211q\210\317\325\"\216\326\327\261\210\330c\210\327\261\210\331c\210c\210\332\326\261\210\333 *\262\262\334r\335!q\210\336\337\316\"\210eb\210\340 \317\341\"\216\342\343\344\316#\203\234 e\345\225|\210)\210p,\207" [url-request-extra-headers url-request-data url-request-method format "%X-%X-%X" random plist-get :file-path :query-str :host-uri "Content-Type" "multipart/form-data; boundary=" generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205	 \302\300!\207" [V0 buffer-name kill-buffer] 2] insert-file-contents buffer-substring-no-properties :start :end #[0 "\301\300!\205	 \302\300!\207" [V0 buffer-name kill-buffer] 2] "--" "\n" "Content-Disposition: form-data; " "Content-type: text/plain\n\n" "\n--" buffer-string "POST" url-retrieve-synchronously rename-buffer "*0x0 response*" match-data #[0 "\301\300\302\"\207" [V0 set-match-data t] 3] search-forward-regexp "^[[:space:]]*$" nil 0] 11 (#$ . 5489)])#@149 Send data to SERVER from file with FILE-NAME.

Optionally, uses BOUNDS when sending a partial file as text.

(fn SERVER FILE-NAME &optional BOUNDS)
(defalias '0x0--send #[770 "\301=\204 \302=\203 \303\304!\202 ;\203  \305\306#\"\207\307\310#\"\207" [0x0-use-curl t if-installed executable-find "curl" 0x0--curl 0x0--make-curl-args 0x0--url 0x0--make-url-props] 8 (#$ . 6792)])#@145 Yank successful SERVER share URI into "kill-ring" from response RESP.

The SIZE influences the estimate of file timeout.

(fn SERVER SIZE RESP)
(defalias '0x0--handle-resp #[771 "r\211q\210eb\210\300 \301\302\"\216\303\304\305!\306Q\307\310#\204# \311\312\313p!\"\210\314\315\316!!\210\2051 \317\"\320\321\2058 \322P\315\316!#\266\315\316!\323p!*\210\207" [match-data make-closure #[0 "\301\300\302\"\207" [V0 set-match-data t] 3] search-forward-regexp "^" 0x0--make-server-host-uri ".+" nil t error "Failed to upload/parse. see %s for more details" buffer-name kill-new match-string 0 0x0--calculate-timeout message "yanked `%s' into kill ring." " Should last ~%g days." kill-buffer] 9 (#$ . 7189)])#@56 Choose FILE and upload it to SERVER.

(fn SERVER FILE)
(defalias '0x0-upload-file #[514 "\300!\301!\3028\262\303\"\304#\207" [expand-file-name file-attributes 7 0x0--send 0x0--handle-resp] 9 (#$ . 7904) (byte-code "\300 \211\301!D\207" [0x0--choose-server 0x0--pick-file] 4)])#@76 Upload full or region text from the current buffer to SERVER.

(fn SERVER)
(defalias '0x0-upload-text #[257 "\300 \203 \301\302 \303 \"\202 \301 \304!\305\306#\307#\207" [use-region-p 0x0--make-bounds region-beginning region-end 0x0--bounds-size 0x0--send "upload.txt" 0x0--handle-resp] 8 (#$ . 8196) (byte-code "\300 C\207" [0x0--choose-server] 1)])#@61 Upload content from the "kill-ring" to SERVER.

(fn SERVER)
(defalias '0x0-upload-kill-ring #[257 "\300\301\302\"r\211q\210\303\304\"\216\305\306!c\210\307 \206 \310 \206 \311\312 \313!\314#\315#\266\204*\207" [generate-new-buffer " *temp*" t make-closure #[0 "\301\300!\205	 \302\300!\207" [V0 buffer-name kill-buffer] 2] current-kill 0 buffer-file-name buffer-name "kill-ring.txt" 0x0--make-bounds 0x0--bounds-size 0x0--send 0x0--handle-resp] 10 (#$ . 8560) (byte-code "\300 C\207" [0x0--choose-server] 1)])#@53 Shorten the given URI with SERVER.

(fn SERVER URI)
(defalias '0x0-shorten-uri #[514 "\301=\204 \302=\203 \303\304!\202 ;\204 \305\306!\210\307!\310\311\312\313\314\"\257\315!\316\317#\207" [0x0-use-curl t if-installed executable-find "curl" error "Unsupported currenlty without using curl" 0x0--make-server-host-uri "-s" "-S" "-F" format "shorten=%s" 0x0--curl 0x0--handle-resp nil] 9 (#$ . 9086) (byte-code "\300 \301\302!D\207" [0x0--choose-server read-string "URI: "] 3)])#@56 Upload to SERVER and kill current buffer.

(fn SERVER)
(defalias '0x0-popup-upload #[257 "\300 \301!\302\303#\304#\266\305p!\207" [0x0--make-bounds 0x0--bounds-size 0x0--send "popup-upload.txt" 0x0--handle-resp kill-buffer] 8 (#$ . 9583) (byte-code "\300 C\207" [0x0--choose-server] 1)])#@88 Create a new buffer, fill it with content, and upload it to SERVER later.

(fn SERVER)
(defalias '0x0-popup #[257 "r\300\301!q\210\302\303\304\305\"\"\210\306p!)\210\307\310!\207" [generate-new-buffer "*upload*" local-set-key "" make-closure #[0 "	\302\300!)\207" [V0 current-prefix-arg 0x0-popup-upload] 2 nil nil] pop-to-buffer message "Press C-c C-c to upload."] 6 (#$ . 9883) (byte-code "\300 C\207" [0x0--choose-server] 1)])#@53 Try to guess what to upload to SERVER.

(fn SERVER)
(defalias '0x0-dwim #[257 "\301 \203	 \302!\207\303>\203 \304!\207\305\306!\203 \307\310 \"\207\311 \2038 \311 \211\2057 \312\313\314\"!\2057 \307\"\207\302!\207" [last-command region-active-p 0x0-upload-text (kill-ring-save kill-region append-next-kill) 0x0-upload-kill-ring derived-mode-p dired-mode 0x0-upload-file dired-file-name-at-point ffap-guess-file-name-at-point yes-or-no-p format "Is publicly sharing this file, %s, what you intended?"] 6 (#$ . 10322) (byte-code "\300 C\207" [0x0--choose-server] 1)])
(provide '0x0)
