import{a as t}from"./p-d6eb762b.js";import"./p-112455b1.js";import"./p-1ae2b158.js";var i=function(t,i,r,n){return new(r||(r=Promise))((function(e,o){function c(t){try{u(n.next(t))}catch(t){o(t)}}function d(t){try{u(n.throw(t))}catch(t){o(t)}}function u(t){var i;t.done?e(t.value):(i=t.value,i instanceof r?i:new r((function(t){t(i)}))).then(c,d)}u((n=n.apply(t,i||[])).next())}))};class r{constructor(t){this.connection=t}create(t,r){return i(this,void 0,void 0,(function*(){return yield this.connection.post("order",t,{accept:r?"application/jwt":"application/json"})}))}update(t){return i(this,void 0,void 0,(function*(){return yield this.connection.patch("order",t)}))}list(){return i(this,void 0,void 0,(function*(){return yield this.connection.get("order")}))}get(t){return i(this,void 0,void 0,(function*(){return yield this.connection.get(`order/${t}`)}))}receipt(t,r,n){return i(this,void 0,void 0,(function*(){return yield this.connection.get(`order/${t}/receipt${n?"?email=true":""}`,{accept:{pdf:"application/pdf",html:"text/html"}[r]})}))}setPayment(t,r){return i(this,void 0,void 0,(function*(){return yield this.connection.put(`order/${r}/payment`,t)}))}createEvent(t,r){return i(this,void 0,void 0,(function*(){return yield this.connection.post(`order/${r}/event`,t)}))}load(t){const r=Object.assign(Object.assign({},"string"==typeof t?{id:t}:t),{cancel:t=>i(this,void 0,void 0,(function*(){return this.createEvent(t,r.id)})),charge:t=>i(this,void 0,void 0,(function*(){return this.createEvent(t,r.id)})),refund:t=>i(this,void 0,void 0,(function*(){return this.createEvent(t,r.id)}))});return r}static open(i,n){const e=t.open(i,n);return e&&new r(e)}}export{r as Order}