@teipublisher/pb-components 2.12.6 → 2.12.8

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,4 +1,4 @@
1
- import{h as e,g as t,F as o,D as i,x as s,y as r,c as a}from"./paper-checkbox-c9177e35.js";import{a as n}from"./paper-listbox-1fc346ac.js";import{E as l,T as d,D as c,p}from"./vaadin-element-mixin-660b2157.js";import{f as h,N as m,j as u,k as b,l as g,A as v,L as f,c as y,h as w,b as _,w as x,p as E}from"./pb-mixin-d61c06b6.js";import{t as $,g as S}from"./pb-i18n-9000294c.js";import"./paper-icon-button-be4dc644.js";import"./jinn-codemirror-dc6c3c7c.js";const k=(()=>{if("undefined"==typeof self)return!1;if("top"in self&&self!==top)try{top}catch(e){return!1}return"showOpenFilePicker"in self})(),C=(k?Promise.resolve().then((function(){return P})):Promise.resolve().then((function(){return B})),k?Promise.resolve().then((function(){return T})):Promise.resolve().then((function(){return z})),k?Promise.resolve().then((function(){return O})):Promise.resolve().then((function(){return j})));async function A(...e){return(await C).default(...e)}const R=async e=>{const t=await e.getFile();return t.handle=e,t};var P={__proto__:null,default:async(e=[{}])=>{Array.isArray(e)||(e=[e]);const t=[];e.forEach((e,o)=>{t[o]={description:e.description||"Files",accept:{}},e.mimeTypes?e.mimeTypes.map(i=>{t[o].accept[i]=e.extensions||[]}):t[o].accept["*/*"]=e.extensions||[]});const o=await window.showOpenFilePicker({id:e[0].id,startIn:e[0].startIn,types:t,multiple:e[0].multiple||!1,excludeAcceptAllOption:e[0].excludeAcceptAllOption||!1}),i=await Promise.all(o.map(R));return e[0].multiple?i:i[0]}};function M(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(M=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var o=this.s.return;return void 0===o?Promise.resolve({value:e,done:!0}):t(o.apply(this.s,arguments))},throw:function(e){var o=this.s.return;return void 0===o?Promise.reject(e):t(o.apply(this.s,arguments))}},new M(e)}const I=async(e,t,o=e.name,i)=>{const s=[],r=[];var a,n=!1,l=!1;try{for(var d,c=function(e){var t,o,i,s=2;for("undefined"!=typeof Symbol&&(o=Symbol.asyncIterator,i=Symbol.iterator);s--;){if(o&&null!=(t=e[o]))return t.call(e);if(i&&null!=(t=e[i]))return new M(t.call(e));o="@@asyncIterator",i="@@iterator"}throw new TypeError("Object is not async iterable")}(e.values());n=!(d=await c.next()).done;n=!1){const a=d.value,n=`${o}/${a.name}`;"file"===a.kind?r.push(a.getFile().then(t=>(t.directoryHandle=e,t.handle=a,Object.defineProperty(t,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>n})))):"directory"!==a.kind||!t||i&&i(a)||s.push(I(a,t,n,i))}}catch(e){l=!0,a=e}finally{try{n&&null!=c.return&&await c.return()}finally{if(l)throw a}}return[...(await Promise.all(s)).flat(),...await Promise.all(r)]};var T={__proto__:null,default:async(e={})=>{e.recursive=e.recursive||!1,e.mode=e.mode||"read";const t=await window.showDirectoryPicker({id:e.id,startIn:e.startIn,mode:e.mode});return(await(await t.values()).next()).done?[t]:I(t,e.recursive,void 0,e.skipDirectory)}},O={__proto__:null,default:async(e,t=[{}],o=null,i=!1,s=null)=>{Array.isArray(t)||(t=[t]),t[0].fileName=t[0].fileName||"Untitled";const r=[];let a=null;if(e instanceof Blob&&e.type?a=e.type:e.headers&&e.headers.get("content-type")&&(a=e.headers.get("content-type")),t.forEach((e,t)=>{r[t]={description:e.description||"Files",accept:{}},e.mimeTypes?(0===t&&a&&e.mimeTypes.push(a),e.mimeTypes.map(o=>{r[t].accept[o]=e.extensions||[]})):a?r[t].accept[a]=e.extensions||[]:r[t].accept["*/*"]=e.extensions||[]}),o)try{await o.getFile()}catch(e){if(o=null,i)throw e}const n=o||await window.showSaveFilePicker({suggestedName:t[0].fileName,id:t[0].id,startIn:t[0].startIn,types:r,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1});!o&&s&&s(n);const l=await n.createWritable();if("stream"in e){const t=e.stream();return await t.pipeTo(l),n}return"body"in e?(await e.body.pipeTo(l),n):(await l.write(await e),await l.close(),n)}},B={__proto__:null,default:async(e=[{}])=>(Array.isArray(e)||(e=[e]),new Promise((t,o)=>{const i=document.createElement("input");i.type="file";const s=[...e.map(e=>e.mimeTypes||[]),...e.map(e=>e.extensions||[])].join();i.multiple=e[0].multiple||!1,i.accept=s||"",i.style.display="none",document.body.append(i);const r=e=>{"function"==typeof a&&a(),t(e)},a=e[0].legacySetup&&e[0].legacySetup(r,()=>a(o),i),n=()=>{window.removeEventListener("focus",n),i.remove()};i.addEventListener("click",()=>{window.addEventListener("focus",n)}),i.addEventListener("change",()=>{window.removeEventListener("focus",n),i.remove(),r(i.multiple?Array.from(i.files):i.files[0])}),"showPicker"in HTMLInputElement.prototype?i.showPicker():i.click()}))},z={__proto__:null,default:async(e=[{}])=>(Array.isArray(e)||(e=[e]),e[0].recursive=e[0].recursive||!1,new Promise((t,o)=>{const i=document.createElement("input");i.type="file",i.webkitdirectory=!0;const s=e=>{"function"==typeof r&&r(),t(e)},r=e[0].legacySetup&&e[0].legacySetup(s,()=>r(o),i);i.addEventListener("change",()=>{let t=Array.from(i.files);e[0].recursive?e[0].recursive&&e[0].skipDirectory&&(t=t.filter(t=>t.webkitRelativePath.split("/").every(t=>!e[0].skipDirectory({name:t,kind:"directory"})))):t=t.filter(e=>2===e.webkitRelativePath.split("/").length),s(t)}),"showPicker"in HTMLInputElement.prototype?i.showPicker():i.click()}))},j={__proto__:null,default:async(e,t={})=>{Array.isArray(t)&&(t=t[0]);const o=document.createElement("a");let i=e;"body"in e&&(i=await async function(e,t){const o=e.getReader(),i=new ReadableStream({start:e=>async function t(){return o.read().then(({done:o,value:i})=>{if(!o)return e.enqueue(i),t();e.close()})}()}),s=new Response(i),r=await s.blob();return o.releaseLock(),new Blob([r],{type:t})}(e.body,e.headers.get("content-type"))),o.download=t.fileName||"Untitled",o.href=URL.createObjectURL(await i);const s=()=>{"function"==typeof r&&r()},r=t.legacySetup&&t.legacySetup(s,()=>r(),o);return o.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(o.href),3e4),s()}),o.click(),null}};
1
+ import{h as e,g as t,F as o,D as i,x as s,y as r,c as a}from"./paper-checkbox-c9177e35.js";import{a as n}from"./paper-listbox-1fc346ac.js";import{E as l,T as d,D as c,p}from"./vaadin-element-mixin-ec93018d.js";import{f as h,N as m,j as u,k as b,l as g,A as v,L as f,c as y,h as w,b as _,w as x,p as E}from"./pb-mixin-d61c06b6.js";import{t as $,g as S}from"./pb-i18n-375ccc5c.js";import"./paper-icon-button-be4dc644.js";import"./jinn-codemirror-dc6c3c7c.js";const k=(()=>{if("undefined"==typeof self)return!1;if("top"in self&&self!==top)try{top}catch(e){return!1}return"showOpenFilePicker"in self})(),C=(k?Promise.resolve().then((function(){return P})):Promise.resolve().then((function(){return B})),k?Promise.resolve().then((function(){return T})):Promise.resolve().then((function(){return z})),k?Promise.resolve().then((function(){return O})):Promise.resolve().then((function(){return j})));async function A(...e){return(await C).default(...e)}const R=async e=>{const t=await e.getFile();return t.handle=e,t};var P={__proto__:null,default:async(e=[{}])=>{Array.isArray(e)||(e=[e]);const t=[];e.forEach((e,o)=>{t[o]={description:e.description||"Files",accept:{}},e.mimeTypes?e.mimeTypes.map(i=>{t[o].accept[i]=e.extensions||[]}):t[o].accept["*/*"]=e.extensions||[]});const o=await window.showOpenFilePicker({id:e[0].id,startIn:e[0].startIn,types:t,multiple:e[0].multiple||!1,excludeAcceptAllOption:e[0].excludeAcceptAllOption||!1}),i=await Promise.all(o.map(R));return e[0].multiple?i:i[0]}};function M(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(M=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var o=this.s.return;return void 0===o?Promise.resolve({value:e,done:!0}):t(o.apply(this.s,arguments))},throw:function(e){var o=this.s.return;return void 0===o?Promise.reject(e):t(o.apply(this.s,arguments))}},new M(e)}const I=async(e,t,o=e.name,i)=>{const s=[],r=[];var a,n=!1,l=!1;try{for(var d,c=function(e){var t,o,i,s=2;for("undefined"!=typeof Symbol&&(o=Symbol.asyncIterator,i=Symbol.iterator);s--;){if(o&&null!=(t=e[o]))return t.call(e);if(i&&null!=(t=e[i]))return new M(t.call(e));o="@@asyncIterator",i="@@iterator"}throw new TypeError("Object is not async iterable")}(e.values());n=!(d=await c.next()).done;n=!1){const a=d.value,n=`${o}/${a.name}`;"file"===a.kind?r.push(a.getFile().then(t=>(t.directoryHandle=e,t.handle=a,Object.defineProperty(t,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>n})))):"directory"!==a.kind||!t||i&&i(a)||s.push(I(a,t,n,i))}}catch(e){l=!0,a=e}finally{try{n&&null!=c.return&&await c.return()}finally{if(l)throw a}}return[...(await Promise.all(s)).flat(),...await Promise.all(r)]};var T={__proto__:null,default:async(e={})=>{e.recursive=e.recursive||!1,e.mode=e.mode||"read";const t=await window.showDirectoryPicker({id:e.id,startIn:e.startIn,mode:e.mode});return(await(await t.values()).next()).done?[t]:I(t,e.recursive,void 0,e.skipDirectory)}},O={__proto__:null,default:async(e,t=[{}],o=null,i=!1,s=null)=>{Array.isArray(t)||(t=[t]),t[0].fileName=t[0].fileName||"Untitled";const r=[];let a=null;if(e instanceof Blob&&e.type?a=e.type:e.headers&&e.headers.get("content-type")&&(a=e.headers.get("content-type")),t.forEach((e,t)=>{r[t]={description:e.description||"Files",accept:{}},e.mimeTypes?(0===t&&a&&e.mimeTypes.push(a),e.mimeTypes.map(o=>{r[t].accept[o]=e.extensions||[]})):a?r[t].accept[a]=e.extensions||[]:r[t].accept["*/*"]=e.extensions||[]}),o)try{await o.getFile()}catch(e){if(o=null,i)throw e}const n=o||await window.showSaveFilePicker({suggestedName:t[0].fileName,id:t[0].id,startIn:t[0].startIn,types:r,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1});!o&&s&&s(n);const l=await n.createWritable();if("stream"in e){const t=e.stream();return await t.pipeTo(l),n}return"body"in e?(await e.body.pipeTo(l),n):(await l.write(await e),await l.close(),n)}},B={__proto__:null,default:async(e=[{}])=>(Array.isArray(e)||(e=[e]),new Promise((t,o)=>{const i=document.createElement("input");i.type="file";const s=[...e.map(e=>e.mimeTypes||[]),...e.map(e=>e.extensions||[])].join();i.multiple=e[0].multiple||!1,i.accept=s||"",i.style.display="none",document.body.append(i);const r=e=>{"function"==typeof a&&a(),t(e)},a=e[0].legacySetup&&e[0].legacySetup(r,()=>a(o),i),n=()=>{window.removeEventListener("focus",n),i.remove()};i.addEventListener("click",()=>{window.addEventListener("focus",n)}),i.addEventListener("change",()=>{window.removeEventListener("focus",n),i.remove(),r(i.multiple?Array.from(i.files):i.files[0])}),"showPicker"in HTMLInputElement.prototype?i.showPicker():i.click()}))},z={__proto__:null,default:async(e=[{}])=>(Array.isArray(e)||(e=[e]),e[0].recursive=e[0].recursive||!1,new Promise((t,o)=>{const i=document.createElement("input");i.type="file",i.webkitdirectory=!0;const s=e=>{"function"==typeof r&&r(),t(e)},r=e[0].legacySetup&&e[0].legacySetup(s,()=>r(o),i);i.addEventListener("change",()=>{let t=Array.from(i.files);e[0].recursive?e[0].recursive&&e[0].skipDirectory&&(t=t.filter(t=>t.webkitRelativePath.split("/").every(t=>!e[0].skipDirectory({name:t,kind:"directory"})))):t=t.filter(e=>2===e.webkitRelativePath.split("/").length),s(t)}),"showPicker"in HTMLInputElement.prototype?i.showPicker():i.click()}))},j={__proto__:null,default:async(e,t={})=>{Array.isArray(t)&&(t=t[0]);const o=document.createElement("a");let i=e;"body"in e&&(i=await async function(e,t){const o=e.getReader(),i=new ReadableStream({start:e=>async function t(){return o.read().then(({done:o,value:i})=>{if(!o)return e.enqueue(i),t();e.close()})}()}),s=new Response(i),r=await s.blob();return o.releaseLock(),new Blob([r],{type:t})}(e.body,e.headers.get("content-type"))),o.download=t.fileName||"Untitled",o.href=URL.createObjectURL(await i);const s=()=>{"function"==typeof r&&r()},r=t.legacySetup&&t.legacySetup(s,()=>r(),o);return o.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(o.href),3e4),s()}),o.click(),null}};
2
2
  /**
3
3
  * @license
4
4
  * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
@@ -1,4 +1,4 @@
1
- import{P as e,h as t,p as n,B as o,d as i,a as s,I as a,T as r,q as l,s as c,D as u,t as p,f as d}from"./paper-checkbox-c9177e35.js";import{a as h}from"./paper-listbox-1fc346ac.js";import{w as m,p as g,L as f,h as y,c as v}from"./pb-mixin-d61c06b6.js";import{t as b}from"./pb-i18n-9000294c.js";import{u as x}from"./paper-icon-button-be4dc644.js";
1
+ import{P as e,h as t,p as n,B as o,d as i,a as s,I as a,T as r,q as l,s as c,D as u,t as p,f as d}from"./paper-checkbox-c9177e35.js";import{a as h}from"./paper-listbox-1fc346ac.js";import{w as m,p as g,L as f,h as y,c as v}from"./pb-mixin-d61c06b6.js";import{t as b}from"./pb-i18n-375ccc5c.js";import{u as x}from"./paper-icon-button-be4dc644.js";
2
2
  /**
3
3
  @license
4
4
  Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
@@ -273,7 +273,10 @@
273
273
  "run": "Run",
274
274
  "model": "Select a model",
275
275
  "denied": "Unsaved changes found: please store or discard them first."
276
- }
276
+ },
277
+ "confirm-discard-title": "Discard",
278
+ "confirm-discard": "Discard the list of occurrences?",
279
+ "doc-count": "{{count}} von {{total}}"
277
280
  },
278
281
  "ner": {
279
282
  "title": "Train a Named Entity Recognition Model",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teipublisher/pb-components",
3
- "version": "2.12.6",
3
+ "version": "2.12.8",
4
4
  "description": "Collection of webcomponents underlying TEI Publisher",
5
5
  "repository": "https://github.com/eeditiones/tei-publisher-components.git",
6
6
  "main": "index.html",
package/pb-elements.json CHANGED
@@ -2761,6 +2761,10 @@
2761
2761
  }
2762
2762
  ],
2763
2763
  "properties": [
2764
+ {
2765
+ "name": "value",
2766
+ "type": "string | string[] | null"
2767
+ },
2764
2768
  {
2765
2769
  "name": "renderItem",
2766
2770
  "description": "Set a javascript function to be called whenever an item\nneeds to be rendered. The function will be passed the data\nobject of the current item as argument.",
@@ -5090,31 +5094,31 @@
5090
5094
  "path": "./src/pb-i18n.js",
5091
5095
  "description": "Insert translated text somewhere on an HTML page. If no translation is found,\ndisplay the contained content.",
5092
5096
  "attributes": [
5097
+ {
5098
+ "name": "options",
5099
+ "description": "Optional interpolation parameters to be passed to the\ntranslation function",
5100
+ "type": "object"
5101
+ },
5093
5102
  {
5094
5103
  "name": "key",
5095
5104
  "description": "The i18n key to use for looking up the translation.",
5096
5105
  "type": "string",
5097
5106
  "default": "\"missing-key\""
5098
- },
5107
+ }
5108
+ ],
5109
+ "properties": [
5099
5110
  {
5100
5111
  "name": "options",
5112
+ "attribute": "options",
5101
5113
  "description": "Optional interpolation parameters to be passed to the\ntranslation function",
5102
5114
  "type": "object"
5103
- }
5104
- ],
5105
- "properties": [
5115
+ },
5106
5116
  {
5107
5117
  "name": "key",
5108
5118
  "attribute": "key",
5109
5119
  "description": "The i18n key to use for looking up the translation.",
5110
5120
  "type": "string",
5111
5121
  "default": "\"missing-key\""
5112
- },
5113
- {
5114
- "name": "options",
5115
- "attribute": "options",
5116
- "description": "Optional interpolation parameters to be passed to the\ntranslation function",
5117
- "type": "object"
5118
5122
  }
5119
5123
  ]
5120
5124
  },
@@ -11947,6 +11951,10 @@
11947
11951
  }
11948
11952
  ],
11949
11953
  "events": [
11954
+ {
11955
+ "name": "pb-annotations-loaded",
11956
+ "description": "fired after text was loaded and annotations were drawn"
11957
+ },
11950
11958
  {
11951
11959
  "name": "pb-selection-changed",
11952
11960
  "description": "fired when user selects text"
@@ -78,7 +78,7 @@ export class PbAuthorityLookup extends pbMixin(LitElement) {
78
78
  return html`
79
79
  <paper-input
80
80
  id="query"
81
- label="${translate('Search for')}"
81
+ label="${translate('annotations.lookup')}"
82
82
  always-float-label
83
83
  value="${this.query}"
84
84
  @change="${this._queryChanged}"
@@ -84,6 +84,21 @@ export class PbComboBox extends pbMixin(LitElement) {
84
84
  };
85
85
  }
86
86
 
87
+ get value() {
88
+ return this._select ? this._select.getValue() : null;
89
+ }
90
+
91
+ set value(value) {
92
+ if (!this._select) {
93
+ return;
94
+ }
95
+ this._select.clear(true);
96
+ this._select.sync();
97
+
98
+ this._select.setValue(value, false);
99
+ this._select.sync();
100
+ }
101
+
87
102
  /**
88
103
  * Set a javascript function to be called whenever an item
89
104
  * needs to be rendered. The function will be passed the data
@@ -164,8 +179,8 @@ export class PbComboBox extends pbMixin(LitElement) {
164
179
  }
165
180
  options.placeholder = i18n(this.placeholder);
166
181
  options.closeAfterSelect = this.closeAfterSelect;
167
- options.onBlur = () => this.emitTo(this.onBlur);
168
- options.onChange = () => this.emitTo(this.onChange);
182
+ options.onBlur = () => this.emitTo(this.onBlur, { value: this.value });
183
+ options.onChange = () => this.emitTo(this.onChange, { value: this.value });
169
184
  options.plugins = ['change_listener'];
170
185
 
171
186
  this._select = new TomSelect(input, options);
package/src/pb-i18n.js CHANGED
@@ -128,7 +128,7 @@ export class PbI18n extends LitElement {
128
128
  constructor() {
129
129
  super();
130
130
  this.key = 'missing-key';
131
- this.options = null;
131
+ this._options = null;
132
132
  this._translated = null;
133
133
  }
134
134
 
@@ -142,8 +142,13 @@ export class PbI18n extends LitElement {
142
142
  this._translate();
143
143
  }
144
144
 
145
+ set options(value) {
146
+ this._options = value;
147
+ this._translate();
148
+ }
149
+
145
150
  _translate() {
146
- const transl = get(this.key, this.options);
151
+ const transl = get(this.key, this._options);
147
152
  if (transl && transl !== this.key) {
148
153
  this._translated = transl;
149
154
  } else {
@@ -215,6 +215,7 @@ function clearProperties(teiRange) {
215
215
  * The class itself does not provide any editing facility, except for
216
216
  * handling deletions.
217
217
  *
218
+ * @fires pb-annotations-loaded - fired after text was loaded and annotations were drawn
218
219
  * @fires pb-selection-changed - fired when user selects text
219
220
  * @fires pb-annotations-changed - fired when an annotation was added or changed
220
221
  * @fires pb-annotation-detail - fired to request additional details about an annotation
@@ -335,6 +336,7 @@ class PbViewAnnotate extends PbView {
335
336
  set annotations(annoData) {
336
337
  this._ranges = annoData;
337
338
  this.updateAnnotations(true);
339
+ this._markIncompleteAnnotations();
338
340
  this._initAnnotationColors();
339
341
  this._annotationStyles();
340
342
  }
@@ -426,6 +428,7 @@ class PbViewAnnotate extends PbView {
426
428
  this.scrollTop = this._scrollTop;
427
429
  this._scrollTop = undefined;
428
430
  }
431
+ this.emitTo('pb-annotations-loaded');
429
432
  }, 300));
430
433
  }
431
434
 
@@ -511,6 +514,10 @@ class PbViewAnnotate extends PbView {
511
514
  break;
512
515
  case 'modify':
513
516
  span = this.shadowRoot.querySelector(`[data-tei="${teiRange.node}"]`);
517
+ if (!span) {
518
+ console.error('<pb-view-annotate> Target node not found for %o', teiRange.node);
519
+ break;
520
+ }
514
521
  span.dataset.annotation = JSON.stringify(teiRange.properties);
515
522
  break;
516
523
  default:
@@ -997,6 +1004,8 @@ class PbViewAnnotate extends PbView {
997
1004
  const key = this.getKey(annotation.dataset.type);
998
1005
  if (!data[key] || data[key].length === 0) {
999
1006
  annotation.classList.add('incomplete');
1007
+ } else {
1008
+ annotation.classList.remove('incomplete');
1000
1009
  }
1001
1010
  }
1002
1011
  });
@@ -1 +0,0 @@
1
- import{f as t,L as e,N as n,A as s}from"./pb-mixin-d61c06b6.js";const i=new Map;let a;function r(t){a=t}function o(t){return t instanceof n?t.startNode.isConnected:t instanceof s?t.committer.element.isConnected:t.element.isConnected}function c(){Object.keys(i).forEach(t=>{o(t)||i.delete(t)})}function l(t){"requestIdleCallback"in window?window.requestIdleCallback(t):setTimeout(t)}function d(t,e){const n=e();t.value!==n&&(t.setValue(n),t.commit())}function u(t){a=t.t,i.forEach((t,e)=>{o(e)&&d(e,t)})}function p(t,e){return a?a(t,e):t}const h=t(t=>e=>{i.set(e,t),d(e,t)}),b=(t,e)=>h(()=>p(t,e));document.addEventListener("pb-i18n-update",t=>{u(t.detail)}),setInterval(()=>l(()=>c()),6e4);class f extends e{static get properties(){return Object.assign(Object.assign({},super.properties),{},{key:{type:String},options:{type:Object},_translated:{type:String}})}constructor(){super(),this.key="missing-key",this.options=null,this._translated=null}connectedCallback(){super.connectedCallback(),this._fallback=this.innerHTML,document.addEventListener("pb-i18n-update",this._translate.bind(this)),this._translate()}_translate(){const t=p(this.key,this.options);t&&t!==this.key?this._translated=t:this._translated=null}render(){return this._translated?this._translated:this._fallback}createRenderRoot(){return this}}customElements.define("pb-i18n",f);export{p as g,r as i,b as t};