@epigraph/epigraph-std-lib 4.1.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { failureResult as p, successResult as u } from "../EpigraphResultFactory/epigraphResultFactory.js";
2
- class x {
1
+ import { failureResult as u, successResult as l } from "../EpigraphResultFactory/epigraphResultFactory.js";
2
+ class P {
3
3
  /**
4
4
  * Constructs a new instance of the class with the provided parameters.
5
5
  *
@@ -11,63 +11,228 @@ class x {
11
11
  * @param {NexusAPIVersions} [apiVersion=NexusAPIVersions.V1] - The API version to use, defaulting to version 1.
12
12
  * @return {void}
13
13
  */
14
- constructor(e = "https://api.myepigraph.com/api/", i, r, s = "", n = "", a = "v1/") {
15
- this.epigraphXPath = "", this.epigraphComponentVersion = s, this.epigraphSessionId = r, this.epigraphXPath = n, this.baseUrl = e + a, this.epgLocation = i;
14
+ constructor(i = "https://api.myepigraph.com/api/", t, e, r = "", s = "", a = "v1/") {
15
+ this.epigraphXPath = "", this.epigraphComponentVersion = r, this.epigraphSessionId = e, this.epigraphXPath = s, this.baseUrl = i + a, this.epgLocation = t;
16
16
  }
17
17
  /*******************************************************************************************************************
18
- * Configurator API Calls *
18
+ * Epigraph Button API Calls *
19
19
  ******************************************************************************************************************/
20
- async getConfiguratorByExperienceId(e, i = "") {
21
- const r = {};
22
- i !== "" && (r.version_id = i);
23
- const s = `experience/configurator/experience_id/${e}`, n = this.buildNexusUrl(
20
+ async getButtonBySku(i, t = "") {
21
+ const e = {};
22
+ t !== "" && (e.version_id = t);
23
+ const r = `experience/button/sku/${i}`, s = this.buildNexusUrl(
24
+ r,
25
+ e
26
+ );
27
+ return await this.callNexusAPI(
24
28
  s,
25
- r
29
+ "GET"
30
+ /* GET */
31
+ );
32
+ }
33
+ async getButtonByShopifyVariantId(i, t = "") {
34
+ const e = {};
35
+ t !== "" && (e.version_id = t);
36
+ const r = `experience/button/shopify_variant_id/${i}`, s = this.buildNexusUrl(
37
+ r,
38
+ e
26
39
  );
27
40
  return await this.callNexusAPI(
28
- n,
41
+ s,
29
42
  "GET"
30
43
  /* GET */
31
44
  );
32
45
  }
33
- async getConfiguratorByClientAccessKey(e, i = "") {
34
- const r = {};
35
- i !== "" && (r.version_id = i);
36
- const s = `experience/configurator/client_access_key/${e}`, n = this.buildNexusUrl(
46
+ async getButtonByUpc(i, t = "") {
47
+ const e = {};
48
+ t !== "" && (e.version_id = t);
49
+ const r = `experience/button/upc/${i}`, s = this.buildNexusUrl(
50
+ r,
51
+ e
52
+ );
53
+ return await this.callNexusAPI(
37
54
  s,
38
- r
55
+ "GET"
56
+ /* GET */
57
+ );
58
+ }
59
+ async getButtonByAsin(i, t = "") {
60
+ const e = {};
61
+ t !== "" && (e.version_id = t);
62
+ const r = `experience/button/asin/${i}`, s = this.buildNexusUrl(
63
+ r,
64
+ e
39
65
  );
40
66
  return await this.callNexusAPI(
41
- n,
67
+ s,
42
68
  "GET"
43
69
  /* GET */
44
70
  );
45
71
  }
46
72
  /*******************************************************************************************************************
47
- * ConfiguratorLite API Calls *
73
+ * Epigraph Viewer API Calls *
48
74
  ******************************************************************************************************************/
49
- async getConfiguratorLiteByExperienceId(e, i = "") {
50
- const r = {};
51
- i !== "" && (r.version_id = i);
52
- const s = `experience/configurator-lite/experience_id/${e}`, n = this.buildNexusUrl(
75
+ async getViewerBySku(i, t = "") {
76
+ const e = {};
77
+ t !== "" && (e.version_id = t);
78
+ const r = `experience/viewer/sku/${i}`, s = this.buildNexusUrl(
79
+ r,
80
+ e
81
+ );
82
+ return await this.callNexusAPI(
53
83
  s,
54
- r
84
+ "GET"
85
+ /* GET */
86
+ );
87
+ }
88
+ async getViewerByShopifyVariantId(i, t = "") {
89
+ const e = {};
90
+ t !== "" && (e.version_id = t);
91
+ const r = `experience/viewer/shopify_variant_id/${i}`, s = this.buildNexusUrl(
92
+ r,
93
+ e
55
94
  );
56
95
  return await this.callNexusAPI(
57
- n,
96
+ s,
58
97
  "GET"
59
98
  /* GET */
60
99
  );
61
100
  }
62
- async getConfiguratorLiteByProjectId(e, i = "") {
63
- const r = {};
64
- i !== "" && (r.version_id = i);
65
- const s = `experience/configurator-lite/project_id/${e}`, n = this.buildNexusUrl(
101
+ async getViewerByUpc(i, t = "") {
102
+ const e = {};
103
+ t !== "" && (e.version_id = t);
104
+ const r = `experience/viewer/upc/${i}`, s = this.buildNexusUrl(
105
+ r,
106
+ e
107
+ );
108
+ return await this.callNexusAPI(
66
109
  s,
67
- r
110
+ "GET"
111
+ /* GET */
112
+ );
113
+ }
114
+ async getViewerByAsin(i, t = "") {
115
+ const e = {};
116
+ t !== "" && (e.version_id = t);
117
+ const r = `experience/viewer/asin/${i}`, s = this.buildNexusUrl(
118
+ r,
119
+ e
68
120
  );
69
121
  return await this.callNexusAPI(
70
- n,
122
+ s,
123
+ "GET"
124
+ /* GET */
125
+ );
126
+ }
127
+ /*******************************************************************************************************************
128
+ * Epigraph Tour API Calls *
129
+ ******************************************************************************************************************/
130
+ async getTourBySku(i, t = "") {
131
+ const e = {};
132
+ t !== "" && (e.version_id = t);
133
+ const r = `experience/tour/sku/${i}`, s = this.buildNexusUrl(
134
+ r,
135
+ e
136
+ );
137
+ return await this.callNexusAPI(
138
+ s,
139
+ "GET"
140
+ /* GET */
141
+ );
142
+ }
143
+ async getTourByShopifyVariantId(i, t = "") {
144
+ const e = {};
145
+ t !== "" && (e.version_id = t);
146
+ const r = `experience/tour/shopify_variant_id/${i}`, s = this.buildNexusUrl(
147
+ r,
148
+ e
149
+ );
150
+ return await this.callNexusAPI(
151
+ s,
152
+ "GET"
153
+ /* GET */
154
+ );
155
+ }
156
+ async getTourByUpc(i, t = "") {
157
+ const e = {};
158
+ t !== "" && (e.version_id = t);
159
+ const r = `experience/tour/upc/${i}`, s = this.buildNexusUrl(
160
+ r,
161
+ e
162
+ );
163
+ return await this.callNexusAPI(
164
+ s,
165
+ "GET"
166
+ /* GET */
167
+ );
168
+ }
169
+ async getTourByAsin(i, t = "") {
170
+ const e = {};
171
+ t !== "" && (e.version_id = t);
172
+ const r = `experience/tour/asin/${i}`, s = this.buildNexusUrl(
173
+ r,
174
+ e
175
+ );
176
+ return await this.callNexusAPI(
177
+ s,
178
+ "GET"
179
+ /* GET */
180
+ );
181
+ }
182
+ /*******************************************************************************************************************
183
+ * Configurator API Calls *
184
+ ******************************************************************************************************************/
185
+ async getConfiguratorByExperienceId(i, t = "") {
186
+ const e = {};
187
+ t !== "" && (e.version_id = t);
188
+ const r = `experience/configurator/experience_id/${i}`, s = this.buildNexusUrl(
189
+ r,
190
+ e
191
+ );
192
+ return await this.callNexusAPI(
193
+ s,
194
+ "GET"
195
+ /* GET */
196
+ );
197
+ }
198
+ async getConfiguratorByClientAccessKey(i, t = "") {
199
+ const e = {};
200
+ t !== "" && (e.version_id = t);
201
+ const r = `experience/configurator/client_access_key/${i}`, s = this.buildNexusUrl(
202
+ r,
203
+ e
204
+ );
205
+ return await this.callNexusAPI(
206
+ s,
207
+ "GET"
208
+ /* GET */
209
+ );
210
+ }
211
+ /*******************************************************************************************************************
212
+ * ConfiguratorLite API Calls *
213
+ ******************************************************************************************************************/
214
+ async getConfiguratorLiteByExperienceId(i, t = "") {
215
+ const e = {};
216
+ t !== "" && (e.version_id = t);
217
+ const r = `experience/configurator-lite/experience_id/${i}`, s = this.buildNexusUrl(
218
+ r,
219
+ e
220
+ );
221
+ return await this.callNexusAPI(
222
+ s,
223
+ "GET"
224
+ /* GET */
225
+ );
226
+ }
227
+ async getConfiguratorLiteByProjectId(i, t = "") {
228
+ const e = {};
229
+ t !== "" && (e.version_id = t);
230
+ const r = `experience/configurator-lite/project_id/${i}`, s = this.buildNexusUrl(
231
+ r,
232
+ e
233
+ );
234
+ return await this.callNexusAPI(
235
+ s,
71
236
  "GET"
72
237
  /* GET */
73
238
  );
@@ -75,20 +240,20 @@ class x {
75
240
  /*******************************************************************************************************************
76
241
  * Save & Share Calls *
77
242
  ******************************************************************************************************************/
78
- async postExperienceSaveAndShare(e, i) {
79
- const r = "experience/" + e + "/save/", s = this.buildNexusUrl(
80
- r
81
- ), n = {
82
- save_data: JSON.stringify(i)
243
+ async postExperienceSaveAndShare(i, t) {
244
+ const e = `experience/${i}/save`, r = this.buildNexusUrl(
245
+ e
246
+ ), s = {
247
+ save_data: JSON.stringify(t)
83
248
  }, a = new Headers();
84
- return a.set("Content-Type", "application/json"), await this.callNexusAPI(s, "POST", JSON.stringify(n), a);
249
+ return a.set("Content-Type", "application/json"), await this.callNexusAPI(r, "POST", JSON.stringify(s), a);
85
250
  }
86
- async getExperienceSaveAndShare(e, i) {
87
- const r = "experience/" + e + "/save/" + i, s = this.buildNexusUrl(
88
- r
251
+ async getExperienceSaveAndShare(i, t) {
252
+ const e = `experience/${i}/save/${t}`, r = this.buildNexusUrl(
253
+ e
89
254
  );
90
255
  return await this.callNexusAPI(
91
- s,
256
+ r,
92
257
  "GET"
93
258
  /* GET */
94
259
  );
@@ -103,32 +268,32 @@ class x {
103
268
  * @param headers
104
269
  * @return {Promise<Result>} A promise that resolves with the API response, encapsulated in a success or failure result format.
105
270
  */
106
- async callNexusAPI(e, i = "GET", r, s = new Headers()) {
107
- s = this.addRequiredHeaders(s);
108
- const n = {
109
- method: i,
110
- body: r,
111
- headers: s
271
+ async callNexusAPI(i, t = "GET", e, r = new Headers()) {
272
+ r = this.addRequiredHeaders(r);
273
+ const s = {
274
+ method: t,
275
+ body: e,
276
+ headers: r
112
277
  };
113
278
  try {
114
- const a = await fetch(e, n), c = await a.json();
279
+ const a = await fetch(i, s), c = await a.json();
115
280
  if (!a.ok) {
116
281
  let o = "Unable to retrieve configurator experience";
117
282
  return c.message && (o = c.message), Promise.resolve(
118
- p(c, a.status, o)
283
+ u(c, a.status, o)
119
284
  );
120
285
  }
121
- return Promise.resolve(u(c, a.status));
286
+ return Promise.resolve(l(c, a.status));
122
287
  } catch {
123
- return Promise.resolve(p({}, 500, "Unknown error"));
288
+ return Promise.resolve(u({}, 500, "Unknown error"));
124
289
  }
125
290
  }
126
- buildNexusUrl(e, i = {}) {
127
- let r = new URL(this.baseUrl);
128
- r.pathname += e;
129
- for (const [s, n] of Object.entries(i))
130
- r.searchParams.set(s, n);
131
- return r;
291
+ buildNexusUrl(i, t = {}) {
292
+ let e = new URL(this.baseUrl);
293
+ e.pathname += i;
294
+ for (const [r, s] of Object.entries(t))
295
+ e.searchParams.set(r, s);
296
+ return e;
132
297
  }
133
298
  /**
134
299
  * Adds required headers to the provided headers object if they are not already present.
@@ -138,16 +303,16 @@ class x {
138
303
  * @param {Headers} headers - The headers object to which the required headers will be added.
139
304
  * @return {Headers} The updated headers object containing all required headers.
140
305
  */
141
- addRequiredHeaders(e) {
142
- return e.has("accept") || e.set("accept", "application/json"), e.has("EPG-Location") || e.set("EPG-location", this.epgLocation), e.has("EPG-Session-ID") || e.set("EPG-Session-ID", this.epigraphSessionId), e.has("EPG-XPATH") || e.set("EPG-XPATH", this.epigraphXPath), e.has("EPG-Version") || e.set("EPG-Version", this.epigraphComponentVersion), e;
306
+ addRequiredHeaders(i) {
307
+ return i.has("accept") || i.set("accept", "application/json"), i.has("EPG-Location") || i.set("EPG-location", this.epgLocation), i.has("EPG-Session-ID") || i.set("EPG-Session-ID", this.epigraphSessionId), i.has("EPG-XPATH") || i.set("EPG-XPATH", this.epigraphXPath), i.has("EPG-Version") || i.set("EPG-Version", this.epigraphComponentVersion), i;
143
308
  }
144
309
  }
145
- var l = /* @__PURE__ */ ((t) => (t.PRODUCTION = "https://api.myepigraph.com/api/", t.STAGING = "https://nexus.epigraph.dev/api/", t.LOCAL = "https://nexus.test/api/", t))(l || {}), h = /* @__PURE__ */ ((t) => (t.CLIENT_ACCESS_KEY = "client_access_key", t.EXPERIENCE_ID = "experience_id", t.PROJECT_ID = "project_id", t))(h || {}), E = /* @__PURE__ */ ((t) => (t.CONFIGURATOR = "experience/configurator/", t.CONFIGURATOR_LITE = "experience/configurator-lite/", t.EXPERIENCE = "experience/", t.SAVE = "save/", t))(E || {}), g = /* @__PURE__ */ ((t) => (t.V1 = "v1/", t))(g || {}), P = /* @__PURE__ */ ((t) => (t.GET = "GET", t.POST = "POST", t.PUT = "PUT", t.DELETE = "DELETE", t))(P || {});
310
+ var p = /* @__PURE__ */ ((n) => (n.PRODUCTION = "https://api.myepigraph.com/api/", n.STAGING = "https://nexus.epigraph.dev/api/", n.LOCAL = "https://nexus.test/api/", n))(p || {}), h = /* @__PURE__ */ ((n) => (n.CLIENT_ACCESS_KEY = "client_access_key", n.EXPERIENCE_ID = "experience_id", n.PROJECT_ID = "project_id", n.SKU = "sku", n.SHOPIFY_VARIANT_ID = "shopify_variant_id", n.UPC = "upc", n.ASIN = "asin", n))(h || {}), y = /* @__PURE__ */ ((n) => (n.BUTTON = "experience/button", n.VIEWER = "experience/viewer", n.TOUR = "experience/tour", n.CUSTOMIZER = "experience/customizer", n.CONFIGURATOR = "experience/configurator", n.CONFIGURATOR_LITE = "experience/configurator-lite", n.EXPERIENCE = "experience", n.SAVE = "save", n))(y || {}), x = /* @__PURE__ */ ((n) => (n.V1 = "v1/", n))(x || {}), $ = /* @__PURE__ */ ((n) => (n.GET = "GET", n.POST = "POST", n.PUT = "PUT", n.DELETE = "DELETE", n))($ || {});
146
311
  export {
147
- x as EpigraphNexusAPI,
148
- P as HTTPMethod,
312
+ P as EpigraphNexusAPI,
313
+ $ as HTTPMethod,
149
314
  h as NexusAPIResourceIdentifier,
150
- E as NexusAPIRoutes,
151
- g as NexusAPIVersions,
152
- l as NexusEndpoints
315
+ y as NexusAPIRoutes,
316
+ x as NexusAPIVersions,
317
+ p as NexusEndpoints
153
318
  };
@@ -1,29 +1,7 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const U=require("lit"),Z=require("qr-creator");/**
2
- * @license
3
- * Copyright 2017 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */const R=globalThis,w=R.trustedTypes,k=w?w.createPolicy("lit-html",{createHTML:i=>i}):void 0,P="$lit$",u=`lit$${Math.random().toFixed(9).slice(2)}$`,W="?"+u,F=`<${W}>`,g=document,M=()=>g.createComment(""),C=i=>i===null||typeof i!="object"&&typeof i!="function",L=Array.isArray,J=i=>L(i)||typeof i?.[Symbol.iterator]=="function",E=`[
6
- \f\r]`,m=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,B=/>/g,p=RegExp(`>|${E}(?:([^\\s"'>=/]+)(${E}*=${E}*(?:[^
7
- \f\r"'\`<>=]|("|')|))|$)`,"g"),q=/'/g,D=/"/g,z=/^(?:script|style|textarea|title)$/i,H=Symbol.for("lit-noChange"),a=Symbol.for("lit-nothing"),j=new WeakMap,f=g.createTreeWalker(g,129);function V(i,t){if(!L(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return k!==void 0?k.createHTML(t):t}const K=(i,t)=>{const e=i.length-1,s=[];let n,o=t===2?"<svg>":t===3?"<math>":"",r=m;for(let d=0;d<e;d++){const h=i[d];let c,$,l=-1,A=0;for(;A<h.length&&(r.lastIndex=A,$=r.exec(h),$!==null);)A=r.lastIndex,r===m?$[1]==="!--"?r=O:$[1]!==void 0?r=B:$[2]!==void 0?(z.test($[2])&&(n=RegExp("</"+$[2],"g")),r=p):$[3]!==void 0&&(r=p):r===p?$[0]===">"?(r=n??m,l=-1):$[1]===void 0?l=-2:(l=r.lastIndex-$[2].length,c=$[1],r=$[3]===void 0?p:$[3]==='"'?D:q):r===D||r===q?r=p:r===O||r===B?r=m:(r=p,n=void 0);const _=r===p&&i[d+1].startsWith("/>")?" ":"";o+=r===m?h+F:l>=0?(s.push(c),h.slice(0,l)+P+h.slice(l)+u+_):h+u+(l===-2?d:_)}return[V(i,o+(i[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class b{constructor({strings:t,_$litType$:e},s){let n;this.parts=[];let o=0,r=0;const d=t.length-1,h=this.parts,[c,$]=K(t,e);if(this.el=b.createElement(c,s),f.currentNode=this.el.content,e===2||e===3){const l=this.el.content.firstChild;l.replaceWith(...l.childNodes)}for(;(n=f.nextNode())!==null&&h.length<d;){if(n.nodeType===1){if(n.hasAttributes())for(const l of n.getAttributeNames())if(l.endsWith(P)){const A=$[r++],_=n.getAttribute(l).split(u),x=/([.?@])?(.*)/.exec(A);h.push({type:1,index:o,name:x[2],strings:_,ctor:x[1]==="."?Y:x[1]==="?"?tt:x[1]==="@"?et:S}),n.removeAttribute(l)}else l.startsWith(u)&&(h.push({type:6,index:o}),n.removeAttribute(l));if(z.test(n.tagName)){const l=n.textContent.split(u),A=l.length-1;if(A>0){n.textContent=w?w.emptyScript:"";for(let _=0;_<A;_++)n.append(l[_],M()),f.nextNode(),h.push({type:2,index:++o});n.append(l[A],M())}}}else if(n.nodeType===8)if(n.data===W)h.push({type:2,index:o});else{let l=-1;for(;(l=n.data.indexOf(u,l+1))!==-1;)h.push({type:7,index:o}),l+=u.length-1}o++}}static createElement(t,e){const s=g.createElement("template");return s.innerHTML=t,s}}function v(i,t,e=i,s){if(t===H)return t;let n=s!==void 0?e._$Co?.[s]:e._$Cl;const o=C(t)?void 0:t._$litDirective$;return n?.constructor!==o&&(n?._$AO?.(!1),o===void 0?n=void 0:(n=new o(i),n._$AT(i,e,s)),s!==void 0?(e._$Co??=[])[s]=n:e._$Cl=n),n!==void 0&&(t=v(i,n._$AS(i,t.values),n,s)),t}class X{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,n=(t?.creationScope??g).importNode(e,!0);f.currentNode=n;let o=f.nextNode(),r=0,d=0,h=s[0];for(;h!==void 0;){if(r===h.index){let c;h.type===2?c=new G(o,o.nextSibling,this,t):h.type===1?c=new h.ctor(o,h.name,h.strings,this,t):h.type===6&&(c=new st(o,this,t)),this._$AV.push(c),h=s[++d]}r!==h?.index&&(o=f.nextNode(),r++)}return f.currentNode=g,n}p(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class G{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,n){this.type=2,this._$AH=a,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=v(this,t,e),C(t)?t===a||t==null||t===""?(this._$AH!==a&&this._$AR(),this._$AH=a):t!==this._$AH&&t!==H&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):J(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==a&&C(this._$AH)?this._$AA.nextSibling.data=t:this.T(g.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,n=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=b.createElement(V(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===n)this._$AH.p(e);else{const o=new X(n,this),r=o.u(this.options);o.p(e),this.T(r),this._$AH=o}}_$AC(t){let e=j.get(t.strings);return e===void 0&&j.set(t.strings,e=new b(t)),e}k(t){L(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,n=0;for(const o of t)n===e.length?e.push(s=new G(this.O(M()),this.O(M()),this,this.options)):s=e[n],s._$AI(o),n++;n<e.length&&(this._$AR(s&&s._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const s=t.nextSibling;t.remove(),t=s}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}}class S{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,n,o){this.type=1,this._$AH=a,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=a}_$AI(t,e=this,s,n){const o=this.strings;let r=!1;if(o===void 0)t=v(this,t,e,0),r=!C(t)||t!==this._$AH&&t!==H,r&&(this._$AH=t);else{const d=t;let h,c;for(t=o[0],h=0;h<o.length-1;h++)c=v(this,d[s+h],e,h),c===H&&(c=this._$AH[h]),r||=!C(c)||c!==this._$AH[h],c===a?t=a:t!==a&&(t+=(c??"")+o[h+1]),this._$AH[h]=c}r&&!n&&this.j(t)}j(t){t===a?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Y extends S{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===a?void 0:t}}class tt extends S{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==a)}}class et extends S{constructor(t,e,s,n,o){super(t,e,s,n,o),this.type=5}_$AI(t,e=this){if((t=v(this,t,e,0)??a)===H)return;const s=this._$AH,n=t===a&&s!==a||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==a&&(s===a||n);n&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class st{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){v(this,t)}}const it=R.litHtmlPolyfillSupport;it?.(b,G),(R.litHtmlVersions??=[]).push("3.3.0");/**
8
- * @license
9
- * Copyright 2020 Google LLC
10
- * SPDX-License-Identifier: BSD-3-Clause
11
- */const nt=i=>i.strings===void 0;/**
12
- * @license
13
- * Copyright 2017 Google LLC
14
- * SPDX-License-Identifier: BSD-3-Clause
15
- */const ot={CHILD:2},rt=i=>(...t)=>({_$litDirective$:i,values:t});class ht{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}/**
16
- * @license
17
- * Copyright 2017 Google LLC
18
- * SPDX-License-Identifier: BSD-3-Clause
19
- */const y=(i,t)=>{const e=i._$AN;if(e===void 0)return!1;for(const s of e)s._$AO?.(t,!1),y(s,t);return!0},T=i=>{let t,e;do{if((t=i._$AM)===void 0)break;e=t._$AN,e.delete(i),i=t}while(e?.size===0)},Q=i=>{for(let t;t=i._$AM;i=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(i))break;e.add(i),ct(t)}};function lt(i){this._$AN!==void 0?(T(this),this._$AM=i,Q(this)):this._$AM=i}function at(i,t=!1,e=0){const s=this._$AH,n=this._$AN;if(n!==void 0&&n.size!==0)if(t)if(Array.isArray(s))for(let o=e;o<s.length;o++)y(s[o],!1),T(s[o]);else s!=null&&(y(s,!1),T(s));else y(this,i)}const ct=i=>{i.type==ot.CHILD&&(i._$AP??=at,i._$AQ??=lt)};class $t extends ht{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),Q(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(y(this,t),T(this))}setValue(t){if(nt(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}/**
20
- * @license
21
- * Copyright 2020 Google LLC
22
- * SPDX-License-Identifier: BSD-3-Clause
23
- */const dt=()=>new At;class At{}const I=new WeakMap,_t=rt(class extends $t{render(i){return a}update(i,[t]){const e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=i.options?.host,this.rt(this.ct=i.element)),a}rt(i){if(this.isConnected||(i=void 0),typeof this.G=="function"){const t=this.ht??globalThis;let e=I.get(t);e===void 0&&(e=new WeakMap,I.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,i),i!==void 0&&this.G.call(this.ht,i)}else this.G.value=i}get lt(){return typeof this.G=="function"?I.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});class N extends U.LitElement{constructor(){super(...arguments),this._qrCodeGenCanvasRef=dt()}static{this.webComponentName="epigraph-qr-code-generator"}static{this.styles=U.css`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../../lit-element-CYaaFRfk.cjs"),l=require("lit/decorators.js"),c=require("qr-creator");var C=Object.defineProperty,p=(i,t,e,o)=>{for(var r=void 0,n=i.length-1,s;n>=0;n--)(s=i[n])&&(r=s(t,e,r)||r);return r&&C(t,e,r),r};class a extends d.i{static{this.webComponentName="epigraph-qr-code-generator"}static{this.styles=d.i$1`
24
2
  :host {
25
3
  display: none;
26
4
  }
27
- `}dataUritoBlob(t){const e=t.split(",");if(e.length!==2)throw new Error("Invalid data URI format");const s=e[0].split(":")[1].split(";")[0],n=atob(e[1]),o=new Uint8Array(Array.from(n,r=>r.charCodeAt(0)));return new Blob([o],{type:s})}generateQrCode(t={text:"www.epigraph.us",radius:.5,ecLevel:"H",fill:"black",background:null,size:256}){if(!this._qrCodeGenCanvasRef.value)return"";Z.render(t,this._qrCodeGenCanvasRef.value);const e=this._qrCodeGenCanvasRef.value.toDataURL(),s=this.dataUritoBlob(e);return URL.createObjectURL(s)}render(){return U.html`
28
- <canvas id="qrCode" ${_t(this._qrCodeGenCanvasRef)}></canvas>
29
- `}}window.customElements.get(N.webComponentName)===void 0&&window.customElements.define(N.webComponentName,N);exports.EpigraphQrCodeGenerator=N;
5
+ `}get qrCodeGenCanvasRef(){return this._qrCodeGenCanvasRef}dataUritoBlob(t){const e=t.split(",");if(e.length!==2)throw new Error("Invalid data URI format");const o=e[0].split(":")[1].split(";")[0],r=atob(e[1]),n=new Uint8Array(Array.from(r,s=>s.charCodeAt(0)));return new Blob([n],{type:o})}generateQrCode(t={text:"www.epigraph.us",radius:.5,ecLevel:"H",fill:"black",background:null,size:256}){if(!this._qrCodeGenCanvasRef)return"";c.render(t,this._qrCodeGenCanvasRef);const e=this._qrCodeGenCanvasRef.toDataURL(),o=this.dataUritoBlob(e);return URL.createObjectURL(o)}render(){return d.x`
6
+ <canvas id="qrCodeCanvas"></canvas>
7
+ `}}p([l.query("#qrCodeCanvas")],a.prototype,"_qrCodeGenCanvasRef");window.customElements.get(a.webComponentName)===void 0&&window.customElements.define(a.webComponentName,a);exports.EpigraphQrCodeGenerator=a;
@@ -1,10 +1,10 @@
1
1
  import { LitElement } from 'lit';
2
- import { Ref } from 'lit/directives/ref.js';
3
2
  import { default as QrCreator } from 'qr-creator';
4
3
  export declare class EpigraphQrCodeGenerator extends LitElement {
5
4
  static webComponentName: string;
6
- _qrCodeGenCanvasRef: Ref<HTMLCanvasElement>;
5
+ _qrCodeGenCanvasRef: HTMLCanvasElement;
7
6
  static styles: import('lit').CSSResult;
7
+ get qrCodeGenCanvasRef(): HTMLCanvasElement;
8
8
  /**
9
9
  * Converts any given data uri to a blob.
10
10
  *