@wodira/browser 0.1.0 → 0.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.
- package/CHANGELOG.md +14 -0
- package/README.md +210 -17
- package/dist/index.cjs +33 -5
- package/dist/index.d.ts +50 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +33 -4
- package/dist/types.d.ts +56 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/boxes/cdn.d.ts +2 -0
- package/dist/ui/boxes/cdn.d.ts.map +1 -0
- package/dist/ui/boxes/cdn.js +743 -0
- package/dist/ui/boxes/client.d.ts +30 -0
- package/dist/ui/boxes/client.d.ts.map +1 -0
- package/dist/ui/boxes/components.d.ts +246 -0
- package/dist/ui/boxes/components.d.ts.map +1 -0
- package/dist/ui/boxes/i18n.d.ts +107 -0
- package/dist/ui/boxes/i18n.d.ts.map +1 -0
- package/dist/ui/boxes/index.d.ts +16 -0
- package/dist/ui/boxes/index.d.ts.map +1 -0
- package/dist/ui/boxes/index.js +3071 -0
- package/dist/ui/boxes/styles.d.ts +2 -0
- package/dist/ui/boxes/styles.d.ts.map +1 -0
- package/dist/ui/boxes/types.d.ts +105 -0
- package/dist/ui/boxes/types.d.ts.map +1 -0
- package/dist/ui/components.d.ts +158 -4
- package/dist/ui/components.d.ts.map +1 -1
- package/dist/ui/events.d.ts +1 -1
- package/dist/ui/events.d.ts.map +1 -1
- package/dist/ui/i18n.d.ts +4 -1
- package/dist/ui/i18n.d.ts.map +1 -1
- package/dist/ui/index.d.ts +19 -3
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +9869 -610
- package/dist/ui/layout-styles.d.ts +3 -0
- package/dist/ui/layout-styles.d.ts.map +1 -0
- package/dist/ui/registration-eligibility.d.ts +52 -0
- package/dist/ui/registration-eligibility.d.ts.map +1 -0
- package/dist/ui/shirt-sponsors/cdn.d.ts +2 -0
- package/dist/ui/shirt-sponsors/cdn.d.ts.map +1 -0
- package/dist/ui/shirt-sponsors/cdn.js +83 -0
- package/dist/ui/shirt-sponsors/index.d.ts +9 -0
- package/dist/ui/shirt-sponsors/index.d.ts.map +1 -0
- package/dist/ui/shirt-sponsors/index.js +1669 -0
- package/dist/ui/shirt-sponsors/shirt-auction.d.ts +51 -0
- package/dist/ui/shirt-sponsors/shirt-auction.d.ts.map +1 -0
- package/dist/ui/signature-pad.d.ts +29 -0
- package/dist/ui/signature-pad.d.ts.map +1 -0
- package/dist/ui/styles.d.ts.map +1 -1
- package/dist/ui/theme.d.ts +63 -0
- package/dist/ui/theme.d.ts.map +1 -0
- package/dist/ui/validators.d.ts +1 -1
- package/dist/ui/validators.d.ts.map +1 -1
- package/package.json +33 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-styles.d.ts","sourceRoot":"","sources":["../../src/ui/layout-styles.ts"],"names":[],"mappings":"AAEA,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB,yBAoN9B,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { WodiraEventCategory, WodiraGender, WodiraGenderComposition } from '../types.js';
|
|
2
|
+
interface EligibilityAthlete {
|
|
3
|
+
gender?: WodiraGender | null;
|
|
4
|
+
birthDate?: Date | string | null;
|
|
5
|
+
}
|
|
6
|
+
interface EligibilityEvent {
|
|
7
|
+
startDate: Date | string;
|
|
8
|
+
timezone?: string | null;
|
|
9
|
+
}
|
|
10
|
+
export type RegistrationEligibilityIssue = {
|
|
11
|
+
code: 'gender-not-allowed';
|
|
12
|
+
gender: WodiraGender;
|
|
13
|
+
allowed: WodiraGender[];
|
|
14
|
+
} | {
|
|
15
|
+
code: 'exact-composition';
|
|
16
|
+
compositions: WodiraGenderComposition[];
|
|
17
|
+
} | {
|
|
18
|
+
code: 'all-same';
|
|
19
|
+
} | {
|
|
20
|
+
code: 'minimum-one-each';
|
|
21
|
+
required: WodiraGender[];
|
|
22
|
+
} | {
|
|
23
|
+
code: 'balanced';
|
|
24
|
+
gender: WodiraGender;
|
|
25
|
+
percentage: number;
|
|
26
|
+
} | {
|
|
27
|
+
code: 'minimum-age';
|
|
28
|
+
athleteIndex: number;
|
|
29
|
+
minimum: number;
|
|
30
|
+
} | {
|
|
31
|
+
code: 'maximum-age';
|
|
32
|
+
athleteIndex: number;
|
|
33
|
+
maximum: number;
|
|
34
|
+
} | {
|
|
35
|
+
code: 'minimum-combined-age';
|
|
36
|
+
actual: number;
|
|
37
|
+
minimum: number;
|
|
38
|
+
};
|
|
39
|
+
export declare function readGenderCompositions(value: unknown, teamSize?: number | null): WodiraGenderComposition[];
|
|
40
|
+
export declare function getAllowedGenders(category: Pick<WodiraEventCategory, 'genders'>): WodiraGender[];
|
|
41
|
+
export declare function buildGenderSlotPlan(composition: WodiraGenderComposition, captainGender: WodiraGender): WodiraGender[] | null;
|
|
42
|
+
export declare function buildRegistrationGenderSlotPlan(category: WodiraEventCategory | null | undefined, captainGender: WodiraGender, selectedExactComposition?: WodiraGenderComposition | null): WodiraGender[] | null;
|
|
43
|
+
export declare function validateRegistrationGenderPolicy(category: WodiraEventCategory | null | undefined, athletes: EligibilityAthlete[]): RegistrationEligibilityIssue | null;
|
|
44
|
+
export declare function validateRegistrationAgeRules(category: WodiraEventCategory | null | undefined, athletes: EligibilityAthlete[], eventStartDate: Date | string | null | undefined, eventTimezone?: string): RegistrationEligibilityIssue | null;
|
|
45
|
+
export declare function getRegistrationBirthDateBounds(category: WodiraEventCategory | null | undefined, event: EligibilityEvent): {
|
|
46
|
+
min: string;
|
|
47
|
+
max: string;
|
|
48
|
+
};
|
|
49
|
+
export declare function formatEligibilityIssue(issue: RegistrationEligibilityIssue, locale?: string): string;
|
|
50
|
+
export declare function formatGenderComposition(composition: WodiraGenderComposition, locale?: string): string;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=registration-eligibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registration-eligibility.d.ts","sourceRoot":"","sources":["../../src/ui/registration-eligibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE9F,UAAU,kBAAkB;IAC1B,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC7B,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;CAClC;AAED,UAAU,gBAAgB;IACxB,SAAS,EAAE,IAAI,GAAG,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAQD,MAAM,MAAM,4BAA4B,GACpC;IAAE,IAAI,EAAE,oBAAoB,CAAC;IAAC,MAAM,EAAE,YAAY,CAAC;IAAC,OAAO,EAAE,YAAY,EAAE,CAAA;CAAE,GAC7E;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,YAAY,EAAE,uBAAuB,EAAE,CAAA;CAAE,GACtE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,QAAQ,EAAE,YAAY,EAAE,CAAA;CAAE,GACtD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,YAAY,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC9D;IAAE,IAAI,EAAE,sBAAsB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtE,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,GACvB,uBAAuB,EAAE,CAmB3B;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,GAAG,YAAY,EAAE,CAGhG;AAED,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,uBAAuB,EACpC,aAAa,EAAE,YAAY,GAC1B,YAAY,EAAE,GAAG,IAAI,CAevB;AAED,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,EAChD,aAAa,EAAE,YAAY,EAC3B,wBAAwB,CAAC,EAAE,uBAAuB,GAAG,IAAI,GACxD,YAAY,EAAE,GAAG,IAAI,CA0CvB;AAED,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,EAChD,QAAQ,EAAE,kBAAkB,EAAE,GAC7B,4BAA4B,GAAG,IAAI,CAkDrC;AAED,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,EAChD,QAAQ,EAAE,kBAAkB,EAAE,EAC9B,cAAc,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,EAChD,aAAa,SAAQ,GACpB,4BAA4B,GAAG,IAAI,CAwCrC;AAED,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,mBAAmB,GAAG,IAAI,GAAG,SAAS,EAChD,KAAK,EAAE,gBAAgB,GACtB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAO9B;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,4BAA4B,EACnC,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CA8CR;AAED,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,uBAAuB,EACpC,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CASR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../../../src/ui/shirt-sponsors/cdn.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var B=globalThis,X=B.ShadowRoot&&(B.ShadyCSS===void 0||B.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,J=Symbol(),he=new WeakMap;class Q{constructor(e,t,i){if(this._$cssResult$=!0,i!==J)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this._strings=t}get styleSheet(){let e=this._styleSheet,t=this._strings;if(X&&e===void 0){let i=t!==void 0&&t.length===1;if(i)e=he.get(t);if(e===void 0){if((this._styleSheet=e=new CSSStyleSheet).replaceSync(this.cssText),i)he.set(t,e)}}return e}toString(){return this.cssText}}var Ie=(e)=>{if(e._$cssResult$===!0)return e.cssText;else if(typeof e==="number")return e;else throw Error(`Value passed to 'css' function must be a 'css' function result: ${e}. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)},Le=(e)=>new Q(typeof e==="string"?e:String(e),void 0,J),pe=(e,...t)=>{let i=e.length===1?e[0]:t.reduce((s,n,r)=>s+Ie(n)+e[r+1],e[0]);return new Q(i,e,J)},ue=(e,t)=>{if(X)e.adoptedStyleSheets=t.map((i)=>i instanceof CSSStyleSheet?i:i.styleSheet);else for(let i of t){let s=document.createElement("style"),n=B.litNonce;if(n!==void 0)s.setAttribute("nonce",n);s.textContent=i.cssText,e.appendChild(s)}},We=(e)=>{let t="";for(let i of e.cssRules)t+=i.cssText;return Le(t)},G=X?(e)=>e:(e)=>e instanceof CSSStyleSheet?We(e):e;var{is:ze,defineProperty:He,getOwnPropertyDescriptor:me,getOwnPropertyNames:Be,getOwnPropertySymbols:Fe,getPrototypeOf:fe}=Object,qe=!1,m=globalThis;if(qe)m.customElements??=customElements;var f=!0,y,_e=m.trustedTypes,je=_e?_e.emptyScript:"",ye=f?m.reactiveElementPolyfillSupportDevMode:m.reactiveElementPolyfillSupport;if(f)m.litIssuedWarnings??=new Set,y=(e,t)=>{if(t+=` See https://lit.dev/msg/${e} for more information.`,!m.litIssuedWarnings.has(t)&&!m.litIssuedWarnings.has(e))console.warn(t),m.litIssuedWarnings.add(t)},queueMicrotask(()=>{if(y("dev-mode","Lit is in dev mode. Not recommended for production!"),m.ShadyDOM?.inUse&&ye===void 0)y("polyfill-support-missing","Shadow DOM is being polyfilled via `ShadyDOM` but the `polyfill-support` module has not been loaded.")});var Ye=f?(e)=>{if(!m.emitLitDebugLogEvents)return;m.dispatchEvent(new CustomEvent("lit-debug",{detail:e}))}:void 0,M=(e,t)=>e,Z={toAttribute(e,t){switch(t){case Boolean:e=e?je:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e);break}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=e!==null;break;case Number:i=e===null?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(s){i=null}break}return i}},be=(e,t)=>!ze(e,t),ge={attribute:!0,type:String,converter:Z,reflect:!1,useDefault:!1,hasChanged:be};Symbol.metadata??=Symbol("metadata");m.litPropertyMetadata??=new WeakMap;class _ extends HTMLElement{static addInitializer(e){this.__prepare(),(this._initializers??=[]).push(e)}static get observedAttributes(){return this.finalize(),this.__attributeToPropertyMap&&[...this.__attributeToPropertyMap.keys()]}static createProperty(e,t=ge){if(t.state)t.attribute=!1;if(this.__prepare(),this.prototype.hasOwnProperty(e))t=Object.create(t),t.wrapped=!0;if(this.elementProperties.set(e,t),!t.noAccessor){let i=f?Symbol.for(`${String(e)} (@property() cache)`):Symbol(),s=this.getPropertyDescriptor(e,i,t);if(s!==void 0)He(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){let{get:s,set:n}=me(this.prototype,e)??{get(){return this[t]},set(r){this[t]=r}};if(f&&s==null){if("value"in(me(this.prototype,e)??{}))throw Error(`Field ${JSON.stringify(String(e))} on ${this.name} was declared as a reactive property but it's actually declared as a value on the prototype. Usually this is due to using @property or @state on a method.`);y("reactive-property-without-getter",`Field ${JSON.stringify(String(e))} on ${this.name} was declared as a reactive property but it does not have a getter. This will be an error in a future version of Lit.`)}return{get:s,set(r){let o=s?.call(this);n?.call(this,r),this.requestUpdate(e,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ge}static __prepare(){if(this.hasOwnProperty(M("elementProperties",this)))return;let e=fe(this);if(e.finalize(),e._initializers!==void 0)this._initializers=[...e._initializers];this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(M("finalized",this)))return;if(this.finalized=!0,this.__prepare(),this.hasOwnProperty(M("properties",this))){let t=this.properties,i=[...Be(t),...Fe(t)];for(let s of i)this.createProperty(s,t[s])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[i,s]of t)this.elementProperties.set(i,s)}this.__attributeToPropertyMap=new Map;for(let[t,i]of this.elementProperties){let s=this.__attributeNameForProperty(t,i);if(s!==void 0)this.__attributeToPropertyMap.set(s,t)}if(this.elementStyles=this.finalizeStyles(this.styles),f){if(this.hasOwnProperty("createProperty"))y("no-override-create-property","Overriding ReactiveElement.createProperty() is deprecated. The override will not be called with standard decorators");if(this.hasOwnProperty("getPropertyDescriptor"))y("no-override-get-property-descriptor","Overriding ReactiveElement.getPropertyDescriptor() is deprecated. The override will not be called with standard decorators")}}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let s of i)t.unshift(G(s))}else if(e!==void 0)t.push(G(e));return t}static __attributeNameForProperty(e,t){let i=t.attribute;return i===!1?void 0:typeof i==="string"?i:typeof e==="string"?e.toLowerCase():void 0}constructor(){super();this.__instanceProperties=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this.__reflectingProperty=null,this.__initialize()}__initialize(){this.__updatePromise=new Promise((e)=>this.enableUpdating=e),this._$changedProperties=new Map,this.__saveInstanceProperties(),this.requestUpdate(),this.constructor._initializers?.forEach((e)=>e(this))}addController(e){if((this.__controllers??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected)e.hostConnected?.()}removeController(e){this.__controllers?.delete(e)}__saveInstanceProperties(){let e=new Map,t=this.constructor.elementProperties;for(let i of t.keys())if(this.hasOwnProperty(i))e.set(i,this[i]),delete this[i];if(e.size>0)this.__instanceProperties=e}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return ue(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this.__controllers?.forEach((e)=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this.__controllers?.forEach((e)=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$attributeToProperty(e,i)}__propertyToAttribute(e,t){let s=this.constructor.elementProperties.get(e),n=this.constructor.__attributeNameForProperty(e,s);if(n!==void 0&&s.reflect===!0){let o=(s.converter?.toAttribute!==void 0?s.converter:Z).toAttribute(t,s.type);if(f&&this.constructor.enabledWarnings.includes("migration")&&o===void 0)y("undefined-attribute-value",`The attribute value for the ${e} property is undefined on element ${this.localName}. The attribute will be removed, but in the previous version of \`ReactiveElement\`, the attribute would not have changed.`);if(this.__reflectingProperty=e,o==null)this.removeAttribute(n);else this.setAttribute(n,o);this.__reflectingProperty=null}}_$attributeToProperty(e,t){let i=this.constructor,s=i.__attributeToPropertyMap.get(e);if(s!==void 0&&this.__reflectingProperty!==s){let n=i.getPropertyOptions(s),r=typeof n.converter==="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:Z;this.__reflectingProperty=s;let o=r.fromAttribute(t,n.type);this[s]=o??this.__defaultValues?.get(s)??o,this.__reflectingProperty=null}}requestUpdate(e,t,i,s=!1,n){if(e!==void 0){if(f&&e instanceof Event)y("","The requestUpdate() method was called with an Event as the property name. This is probably a mistake caused by binding this.requestUpdate as an event listener. Instead bind a function that will call it with no arguments: () => this.requestUpdate()");let r=this.constructor;if(s===!1)n=this[e];if(i??=r.getPropertyOptions(e),(i.hasChanged??be)(n,t)||i.useDefault&&i.reflect&&n===this.__defaultValues?.get(e)&&!this.hasAttribute(r.__attributeNameForProperty(e,i)))this._$changeProperty(e,t,i);else return}if(this.isUpdatePending===!1)this.__updatePromise=this.__enqueueUpdate()}_$changeProperty(e,t,{useDefault:i,reflect:s,wrapped:n},r){if(i&&!(this.__defaultValues??=new Map).has(e)){if(this.__defaultValues.set(e,r??t??this[e]),n!==!0||r!==void 0)return}if(!this._$changedProperties.has(e)){if(!this.hasUpdated&&!i)t=void 0;this._$changedProperties.set(e,t)}if(s===!0&&this.__reflectingProperty!==e)(this.__reflectingProperties??=new Set).add(e)}async __enqueueUpdate(){this.isUpdatePending=!0;try{await this.__updatePromise}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();if(e!=null)await e;return!this.isUpdatePending}scheduleUpdate(){let e=this.performUpdate();if(f&&this.constructor.enabledWarnings.includes("async-perform-update")&&typeof e?.then==="function")y("async-perform-update",`Element ${this.localName} returned a Promise from performUpdate(). This behavior is deprecated and will be removed in a future version of ReactiveElement.`);return e}performUpdate(){if(!this.isUpdatePending)return;if(Ye?.({kind:"update"}),!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),f){let n=[...this.constructor.elementProperties.keys()].filter((r)=>this.hasOwnProperty(r)&&(r in fe(this)));if(n.length)throw Error(`The following properties on element ${this.localName} will not trigger updates as expected because they are set using class fields: ${n.join(", ")}. Native class fields and some compiled output will overwrite accessors used for detecting changes. See https://lit.dev/msg/class-field-shadowing for more information.`)}if(this.__instanceProperties){for(let[s,n]of this.__instanceProperties)this[s]=n;this.__instanceProperties=void 0}let i=this.constructor.elementProperties;if(i.size>0)for(let[s,n]of i){let{wrapped:r}=n,o=this[s];if(r===!0&&!this._$changedProperties.has(s)&&o!==void 0)this._$changeProperty(s,void 0,n,o)}}let e=!1,t=this._$changedProperties;try{if(e=this.shouldUpdate(t),e)this.willUpdate(t),this.__controllers?.forEach((i)=>i.hostUpdate?.()),this.update(t);else this.__markUpdated()}catch(i){throw e=!1,this.__markUpdated(),i}if(e)this._$didUpdate(t)}willUpdate(e){}_$didUpdate(e){if(this.__controllers?.forEach((t)=>t.hostUpdated?.()),!this.hasUpdated)this.hasUpdated=!0,this.firstUpdated(e);if(this.updated(e),f&&this.isUpdatePending&&this.constructor.enabledWarnings.includes("change-in-update"))y("change-in-update",`Element ${this.localName} scheduled an update (generally because a property was set) after an update completed, causing a new update to be scheduled. This is inefficient and should be avoided unless the next update can only be scheduled as a side effect of the previous update.`)}__markUpdated(){this._$changedProperties=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.__updatePromise}shouldUpdate(e){return!0}update(e){this.__reflectingProperties&&=this.__reflectingProperties.forEach((t)=>this.__propertyToAttribute(t,this[t])),this.__markUpdated()}updated(e){}firstUpdated(e){}}_.elementStyles=[];_.shadowRootOptions={mode:"open"};_[M("elementProperties",_)]=new Map;_[M("finalized",_)]=new Map;ye?.({ReactiveElement:_});if(f){_.enabledWarnings=["change-in-update","async-perform-update"];let e=function(t){if(!t.hasOwnProperty(M("enabledWarnings",t)))t.enabledWarnings=t.enabledWarnings.slice()};_.enableWarning=function(t){if(e(this),!this.enabledWarnings.includes(t))this.enabledWarnings.push(t)},_.disableWarning=function(t){e(this);let i=this.enabledWarnings.indexOf(t);if(i>=0)this.enabledWarnings.splice(i,1)}}(m.reactiveElementVersions??=[]).push("2.1.2");if(f&&m.reactiveElementVersions.length>1)queueMicrotask(()=>{y("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});var g=globalThis,a=(e)=>{if(!g.emitLitDebugLogEvents)return;g.dispatchEvent(new CustomEvent("lit-debug",{detail:e}))},Ke=0,V;g.litIssuedWarnings??=new Set,V=(e,t)=>{if(t+=e?` See https://lit.dev/msg/${e} for more information.`:"",!g.litIssuedWarnings.has(t)&&!g.litIssuedWarnings.has(e))console.warn(t),g.litIssuedWarnings.add(t)},queueMicrotask(()=>{V("dev-mode","Lit is in dev mode. Not recommended for production!")});var b=g.ShadyDOM?.inUse&&g.ShadyDOM?.noPatch===!0?g.ShadyDOM.wrap:(e)=>e,F=g.trustedTypes,Ee=F?F.createPolicy("lit-html",{createHTML:(e)=>e}):void 0,Xe=(e)=>e,K=(e,t,i)=>Xe,Je=(e)=>{if(v!==K)throw Error("Attempted to overwrite existing lit-html security policy. setSanitizeDOMValueFactory should be called at most once.");v=e},Qe=()=>{v=K},ne=(e,t,i)=>v(e,t,i),Oe="$lit$",S=`lit$${Math.random().toFixed(9).slice(2)}$`,Ne="?"+S,Ge=`<${Ne}>`,C=document,I=()=>C.createComment(""),L=(e)=>e===null||typeof e!="object"&&typeof e!="function",re=Array.isArray,Ze=(e)=>re(e)||typeof e?.[Symbol.iterator]==="function",ee=`[
|
|
2
|
+
\f\r]`,et=`[^
|
|
3
|
+
\f\r"'\`<>=]`,tt=`[^\\s"'>=/]`,R=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,$e=1,te=2,it=3,Se=/-->/g,we=/>/g,x=new RegExp(`>|${ee}(?:(${tt}+)(${ee}*=${ee}*(?:${et}|("|')|))|$)`,"g"),st=0,Te=1,nt=2,xe=3,ie=/'/g,se=/"/g,Ce=/^(?:script|style|textarea|title)$/i,rt=1,q=2,j=3,oe=1,Y=2,ot=3,at=4,lt=5,ae=6,dt=7,le=(e)=>(t,...i)=>{if(t.some((s)=>s===void 0))console.warn(`Some template strings are undefined.
|
|
4
|
+
This is probably caused by illegal octal escape sequences.`);if(i.some((s)=>s?._$litStatic$))V("",`Static values 'literal' or 'unsafeStatic' cannot be used as values to non-static templates.
|
|
5
|
+
Please use the static 'html' tag function. See https://lit.dev/docs/templates/expressions/#static-expressions`);return{["_$litType$"]:e,strings:t,values:i}},U=le(rt),bt=le(q),Et=le(j),D=Symbol.for("lit-noChange"),c=Symbol.for("lit-nothing"),Pe=new WeakMap,N=C.createTreeWalker(C,129),v=K;function De(e,t){if(!re(e)||!e.hasOwnProperty("raw")){let i="invalid template strings array";throw i=`
|
|
6
|
+
Internal Error: expected template strings to be an array
|
|
7
|
+
with a 'raw' field. Faking a template strings array by
|
|
8
|
+
calling html or svg like an ordinary function is effectively
|
|
9
|
+
the same as calling unsafeHtml and can lead to major security
|
|
10
|
+
issues, e.g. opening your code up to XSS attacks.
|
|
11
|
+
If you're using the html or svg tagged template functions normally
|
|
12
|
+
and still seeing this error, please file a bug at
|
|
13
|
+
https://github.com/lit/lit/issues/new?template=bug_report.md
|
|
14
|
+
and include information about your build tooling, if any.
|
|
15
|
+
`.trim().replace(/\n */g,`
|
|
16
|
+
`),Error(i)}return Ee!==void 0?Ee.createHTML(t):t}var ct=(e,t)=>{let i=e.length-1,s=[],n=t===q?"<svg>":t===j?"<math>":"",r,o=R;for(let h=0;h<i;h++){let E=e[h],d=-1,u,T=0,p;while(T<E.length){if(o.lastIndex=T,p=o.exec(E),p===null)break;if(T=o.lastIndex,o===R){if(p[$e]==="!--")o=Se;else if(p[$e]!==void 0)o=we;else if(p[te]!==void 0){if(Ce.test(p[te]))r=new RegExp(`</${p[te]}`,"g");o=x}else if(p[it]!==void 0)throw Error("Bindings in tag names are not supported. Please use static templates instead. See https://lit.dev/docs/templates/expressions/#static-expressions")}else if(o===x)if(p[st]===">")o=r??R,d=-1;else if(p[Te]===void 0)d=-2;else d=o.lastIndex-p[nt].length,u=p[Te],o=p[xe]===void 0?x:p[xe]==='"'?se:ie;else if(o===se||o===ie)o=x;else if(o===Se||o===we)o=R;else o=x,r=void 0}console.assert(d===-1||o===x||o===ie||o===se,"unexpected parse state B");let O=o===x&&e[h+1].startsWith("/>")?" ":"";n+=o===R?E+Ge:d>=0?(s.push(u),E.slice(0,d)+Oe+E.slice(d))+S+O:E+S+(d===-2?h:O)}let l=n+(e[i]||"<?>")+(t===q?"</svg>":t===j?"</math>":"");return[De(e,l),s]};class W{constructor({strings:e,["_$litType$"]:t},i){this.parts=[];let s,n=0,r=0,o=e.length-1,l=this.parts,[h,E]=ct(e,t);if(this.el=W.createElement(h,i),N.currentNode=this.el.content,t===q||t===j){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}while((s=N.nextNode())!==null&&l.length<o){if(s.nodeType===1){{let d=s.localName;if(/^(?:textarea|template)$/i.test(d)&&s.innerHTML.includes(S)){let u=`Expressions are not supported inside \`${d}\` elements. See https://lit.dev/msg/expression-in-${d} for more information.`;if(d==="template")throw Error(u);else V("",u)}}if(s.hasAttributes()){for(let d of s.getAttributeNames())if(d.endsWith(Oe)){let u=E[r++],p=s.getAttribute(d).split(S),O=/([.?@])?(.*)/.exec(u);l.push({type:oe,index:n,name:O[2],strings:p,ctor:O[1]==="."?Me:O[1]==="?"?Ae:O[1]==="@"?Ue:H}),s.removeAttribute(d)}else if(d.startsWith(S))l.push({type:ae,index:n}),s.removeAttribute(d)}if(Ce.test(s.tagName)){let d=s.textContent.split(S),u=d.length-1;if(u>0){s.textContent=F?F.emptyScript:"";for(let T=0;T<u;T++)s.append(d[T],I()),N.nextNode(),l.push({type:Y,index:++n});s.append(d[u],I())}}}else if(s.nodeType===8)if(s.data===Ne)l.push({type:Y,index:n});else{let u=-1;while((u=s.data.indexOf(S,u+1))!==-1)l.push({type:dt,index:n}),u+=S.length-1}n++}if(E.length!==r)throw Error('Detected duplicate attribute bindings. This occurs if your template has duplicate attributes on an element tag. For example "<input ?disabled=${true} ?disabled=${false}>" contains a duplicate "disabled" attribute. The error was detected in the following template: \n`'+e.join("${...}")+"`");a&&a({kind:"template prep",template:this,clonableTemplate:this.el,parts:this.parts,strings:e})}static createElement(e,t){let i=C.createElement("template");return i.innerHTML=e,i}}function A(e,t,i=e,s){if(t===D)return t;let n=s!==void 0?i.__directives?.[s]:i.__directive,r=L(t)?void 0:t._$litDirective$;if(n?.constructor!==r){if(n?._$notifyDirectiveConnectionChanged?.(!1),r===void 0)n=void 0;else n=new r(e),n._$initialize(e,i,s);if(s!==void 0)(i.__directives??=[])[s]=n;else i.__directive=n}if(n!==void 0)t=A(e,n._$resolve(e,t.values),n,s);return t}class ve{constructor(e,t){this._$parts=[],this._$disconnectableChildren=void 0,this._$template=e,this._$parent=t}get parentNode(){return this._$parent.parentNode}get _$isConnected(){return this._$parent._$isConnected}_clone(e){let{el:{content:t},parts:i}=this._$template,s=(e?.creationScope??C).importNode(t,!0);N.currentNode=s;let n=N.nextNode(),r=0,o=0,l=i[0];while(l!==void 0){if(r===l.index){let h;if(l.type===Y)h=new z(n,n.nextSibling,this,e);else if(l.type===oe)h=new l.ctor(n,l.name,l.strings,this,e);else if(l.type===ae)h=new Re(n,this,e);this._$parts.push(h),l=i[++o]}if(r!==l?.index)n=N.nextNode(),r++}return N.currentNode=C,s}_update(e){let t=0;for(let i of this._$parts){if(i!==void 0)if(a&&a({kind:"set part",part:i,value:e[t],valueIndex:t,values:e,templateInstance:this}),i.strings!==void 0)i._$setValue(e,i,t),t+=i.strings.length-2;else i._$setValue(e[t]);t++}}}class z{get _$isConnected(){return this._$parent?._$isConnected??this.__isConnected}constructor(e,t,i,s){this.type=Y,this._$committedValue=c,this._$disconnectableChildren=void 0,this._$startNode=e,this._$endNode=t,this._$parent=i,this.options=s,this.__isConnected=s?.isConnected??!0,this._textSanitizer=void 0}get parentNode(){let e=b(this._$startNode).parentNode,t=this._$parent;if(t!==void 0&&e?.nodeType===11)e=t.parentNode;return e}get startNode(){return this._$startNode}get endNode(){return this._$endNode}_$setValue(e,t=this){if(this.parentNode===null)throw Error("This `ChildPart` has no `parentNode` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's `innerHTML` or `textContent` can do this.");if(e=A(this,e,t),L(e)){if(e===c||e==null||e===""){if(this._$committedValue!==c)a&&a({kind:"commit nothing to child",start:this._$startNode,end:this._$endNode,parent:this._$parent,options:this.options}),this._$clear();this._$committedValue=c}else if(e!==this._$committedValue&&e!==D)this._commitText(e)}else if(e._$litType$!==void 0)this._commitTemplateResult(e);else if(e.nodeType!==void 0){if(this.options?.host===e){this._commitText("[probable mistake: rendered a template's host in itself (commonly caused by writing ${this} in a template]"),console.warn("Attempted to render the template host",e,"inside itself. This is almost always a mistake, and in dev mode ","we render some warning text. In production however, we'll ","render it, which will usually result in an error, and sometimes ","in the element disappearing from the DOM.");return}this._commitNode(e)}else if(Ze(e))this._commitIterable(e);else this._commitText(e)}_insert(e){return b(b(this._$startNode).parentNode).insertBefore(e,this._$endNode)}_commitNode(e){if(this._$committedValue!==e){if(this._$clear(),v!==K){let t=this._$startNode.parentNode?.nodeName;if(t==="STYLE"||t==="SCRIPT"){let i="Forbidden";if(t==="STYLE")i="Lit does not support binding inside style nodes. This is a security risk, as style injection attacks can exfiltrate data and spoof UIs. Consider instead using css`...` literals to compose styles, and do dynamic styling with css custom properties, ::parts, <slot>s, and by mutating the DOM rather than stylesheets.";else i="Lit does not support binding inside script nodes. This is a security risk, as it could allow arbitrary code execution.";throw Error(i)}}a&&a({kind:"commit node",start:this._$startNode,parent:this._$parent,value:e,options:this.options}),this._$committedValue=this._insert(e)}}_commitText(e){if(this._$committedValue!==c&&L(this._$committedValue)){let t=b(this._$startNode).nextSibling;if(this._textSanitizer===void 0)this._textSanitizer=ne(t,"data","property");e=this._textSanitizer(e),a&&a({kind:"commit text",node:t,value:e,options:this.options}),t.data=e}else{let t=C.createTextNode("");if(this._commitNode(t),this._textSanitizer===void 0)this._textSanitizer=ne(t,"data","property");e=this._textSanitizer(e),a&&a({kind:"commit text",node:t,value:e,options:this.options}),t.data=e}this._$committedValue=e}_commitTemplateResult(e){let{values:t,["_$litType$"]:i}=e,s=typeof i==="number"?this._$getTemplate(e):(i.el===void 0&&(i.el=W.createElement(De(i.h,i.h[0]),this.options)),i);if(this._$committedValue?._$template===s)a&&a({kind:"template updating",template:s,instance:this._$committedValue,parts:this._$committedValue._$parts,options:this.options,values:t}),this._$committedValue._update(t);else{let n=new ve(s,this),r=n._clone(this.options);a&&a({kind:"template instantiated",template:s,instance:n,parts:n._$parts,options:this.options,fragment:r,values:t}),n._update(t),a&&a({kind:"template instantiated and updated",template:s,instance:n,parts:n._$parts,options:this.options,fragment:r,values:t}),this._commitNode(r),this._$committedValue=n}}_$getTemplate(e){let t=Pe.get(e.strings);if(t===void 0)Pe.set(e.strings,t=new W(e));return t}_commitIterable(e){if(!re(this._$committedValue))this._$committedValue=[],this._$clear();let t=this._$committedValue,i=0,s;for(let n of e){if(i===t.length)t.push(s=new z(this._insert(I()),this._insert(I()),this,this.options));else s=t[i];s._$setValue(n),i++}if(i<t.length)this._$clear(s&&b(s._$endNode).nextSibling,i),t.length=i}_$clear(e=b(this._$startNode).nextSibling,t){this._$notifyConnectionChanged?.(!1,!0,t);while(e!==this._$endNode){let i=b(e).nextSibling;b(e).remove(),e=i}}setConnected(e){if(this._$parent===void 0)this.__isConnected=e,this._$notifyConnectionChanged?.(e);else throw Error("part.setConnected() may only be called on a RootPart returned from render().")}}class H{get tagName(){return this.element.tagName}get _$isConnected(){return this._$parent._$isConnected}constructor(e,t,i,s,n){if(this.type=oe,this._$committedValue=c,this._$disconnectableChildren=void 0,this.element=e,this.name=t,this._$parent=s,this.options=n,i.length>2||i[0]!==""||i[1]!=="")this._$committedValue=Array(i.length-1).fill(new String),this.strings=i;else this._$committedValue=c;this._sanitizer=void 0}_$setValue(e,t=this,i,s){let n=this.strings,r=!1;if(n===void 0){if(e=A(this,e,t,0),r=!L(e)||e!==this._$committedValue&&e!==D,r)this._$committedValue=e}else{let o=e;e=n[0];let l,h;for(l=0;l<n.length-1;l++){if(h=A(this,o[i+l],t,l),h===D)h=this._$committedValue[l];if(r||=!L(h)||h!==this._$committedValue[l],h===c)e=c;else if(e!==c)e+=(h??"")+n[l+1];this._$committedValue[l]=h}}if(r&&!s)this._commitValue(e)}_commitValue(e){if(e===c)b(this.element).removeAttribute(this.name);else{if(this._sanitizer===void 0)this._sanitizer=v(this.element,this.name,"attribute");e=this._sanitizer(e??""),a&&a({kind:"commit attribute",element:this.element,name:this.name,value:e,options:this.options}),b(this.element).setAttribute(this.name,e??"")}}}class Me extends H{constructor(){super(...arguments);this.type=ot}_commitValue(e){if(this._sanitizer===void 0)this._sanitizer=v(this.element,this.name,"property");e=this._sanitizer(e),a&&a({kind:"commit property",element:this.element,name:this.name,value:e,options:this.options}),this.element[this.name]=e===c?void 0:e}}class Ae extends H{constructor(){super(...arguments);this.type=at}_commitValue(e){a&&a({kind:"commit boolean attribute",element:this.element,name:this.name,value:!!(e&&e!==c),options:this.options}),b(this.element).toggleAttribute(this.name,!!e&&e!==c)}}class Ue extends H{constructor(e,t,i,s,n){super(e,t,i,s,n);if(this.type=lt,this.strings!==void 0)throw Error(`A \`<${e.localName}>\` has a \`@${t}=...\` listener with invalid content. Event listeners in templates must have exactly one expression and no surrounding text.`)}_$setValue(e,t=this){if(e=A(this,e,t,0)??c,e===D)return;let i=this._$committedValue,s=e===c&&i!==c||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,n=e!==c&&(i===c||s);if(a&&a({kind:"commit event listener",element:this.element,name:this.name,value:e,options:this.options,removeListener:s,addListener:n,oldListener:i}),s)this.element.removeEventListener(this.name,this,i);if(n)this.element.addEventListener(this.name,this,e);this._$committedValue=e}handleEvent(e){if(typeof this._$committedValue==="function")this._$committedValue.call(this.options?.host??this.element,e);else this._$committedValue.handleEvent(e)}}class Re{constructor(e,t,i){this.element=e,this.type=ae,this._$disconnectableChildren=void 0,this._$parent=t,this.options=i}get _$isConnected(){return this._$parent._$isConnected}_$setValue(e){a&&a({kind:"commit to element binding",element:this.element,value:e,options:this.options}),A(this,e)}}var ht=g.litHtmlPolyfillSupportDevMode;ht?.(W,z);(g.litHtmlVersions??=[]).push("3.3.3");if(g.litHtmlVersions.length>1)queueMicrotask(()=>{V("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});var k=(e,t,i)=>{if(t==null)throw TypeError(`The container to render into may not be ${t}`);let s=Ke++,n=i?.renderBefore??t,r=n._$litPart$;if(a&&a({kind:"begin render",id:s,value:e,container:t,options:i,part:r}),r===void 0){let o=i?.renderBefore??null;n._$litPart$=r=new z(t.insertBefore(I(),o),o,void 0,i??{})}return r._$setValue(e),a&&a({kind:"end render",id:s,value:e,container:t,options:i,part:r}),r};k.setSanitizer=Je,k.createSanitizer=ne,k._testOnlyClearSanitizerFactoryDoNotCallOrElse=Qe;var pt=(e,t)=>e,de=!0,w=globalThis,ke;if(de)w.litIssuedWarnings??=new Set,ke=(e,t)=>{if(t+=` See https://lit.dev/msg/${e} for more information.`,!w.litIssuedWarnings.has(t)&&!w.litIssuedWarnings.has(e))console.warn(t),w.litIssuedWarnings.add(t)};class P extends _{constructor(){super(...arguments);this.renderOptions={host:this},this.__childPart=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();if(!this.hasUpdated)this.renderOptions.isConnected=this.isConnected;super.update(e),this.__childPart=k(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.__childPart?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.__childPart?.setConnected(!1)}render(){return D}}P._$litElement$=!0;P[pt("finalized",P)]=!0;w.litElementHydrateSupport?.({LitElement:P});var ut=de?w.litElementPolyfillSupportDevMode:w.litElementPolyfillSupport;ut?.({LitElement:P});(w.litElementVersions??=[]).push("4.2.2");if(de&&w.litElementVersions.length>1)queueMicrotask(()=>{ke("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});var mt={es:{title:"Patrocina la camiseta del evento",loading:"Cargando camiseta y pujas…",open:"Abrir en WODira",error:"No se ha podido cargar la campaña.",invalid:"Configura una campaña y una URL de WODira válidas.",retry:"Reintentar"},en:{title:"Sponsor the event shirt",loading:"Loading shirt and bids…",open:"Open in WODira",error:"The campaign could not be loaded.",invalid:"Set a valid campaign and WODira URL.",retry:"Retry"},pt:{title:"Patrocina a camisola do evento",loading:"A carregar camisola e licitações…",open:"Abrir na WODira",error:"Não foi possível carregar a campanha.",invalid:"Configura uma campanha e um URL da WODira válidos.",retry:"Tentar novamente"}};class ce extends P{static properties={campaignId:{type:String,attribute:"campaign-id"},appUrl:{type:String,attribute:"app-url"},locale:{type:String},frameHeight:{state:!0},ready:{state:!0},failed:{state:!0},attempt:{state:!0}};static styles=pe`
|
|
17
|
+
:host {
|
|
18
|
+
display: block;
|
|
19
|
+
width: 100%;
|
|
20
|
+
color: var(--wodira-text, #0b093f);
|
|
21
|
+
font: inherit;
|
|
22
|
+
}
|
|
23
|
+
.shell {
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
border: 1px solid var(--wodira-border, #e6e3ed);
|
|
26
|
+
border-radius: var(--wodira-radius, 16px);
|
|
27
|
+
background: var(--wodira-background, #fff);
|
|
28
|
+
}
|
|
29
|
+
iframe {
|
|
30
|
+
display: block;
|
|
31
|
+
border: 0;
|
|
32
|
+
width: 100%;
|
|
33
|
+
}
|
|
34
|
+
.status,
|
|
35
|
+
footer {
|
|
36
|
+
padding: 16px;
|
|
37
|
+
}
|
|
38
|
+
footer {
|
|
39
|
+
display: flex;
|
|
40
|
+
flex-wrap: wrap;
|
|
41
|
+
gap: 12px;
|
|
42
|
+
justify-content: space-between;
|
|
43
|
+
border-top: 1px solid var(--wodira-border, #e6e3ed);
|
|
44
|
+
font-size: 14px;
|
|
45
|
+
}
|
|
46
|
+
a {
|
|
47
|
+
color: var(--wodira-primary, #a90a65);
|
|
48
|
+
text-underline-offset: 3px;
|
|
49
|
+
}
|
|
50
|
+
button {
|
|
51
|
+
font: inherit;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
padding: 8px 14px;
|
|
54
|
+
}
|
|
55
|
+
a:focus-visible,
|
|
56
|
+
button:focus-visible {
|
|
57
|
+
outline: 3px solid var(--wodira-primary, #a90a65);
|
|
58
|
+
outline-offset: 4px;
|
|
59
|
+
}
|
|
60
|
+
`;channel=globalThis.crypto.randomUUID();timeout;constructor(){super();this.campaignId="",this.appUrl="https://wodira.app",this.locale="auto",this.frameHeight=960,this.ready=!1,this.failed=!1,this.attempt=0}get language(){let t=(this.locale==="auto"?this.ownerDocument.documentElement.lang||navigator.language:this.locale).toLowerCase().split("-")[0];return t==="en"||t==="pt"?t:"es"}get urls(){try{if(!/^[a-zA-Z0-9_-]{1,160}$/.test(this.campaignId))return null;let e=new URL(this.appUrl),t=["localhost","127.0.0.1","[::1]"].includes(e.hostname);if(e.username||e.password||e.protocol!=="https:"&&!(t&&e.protocol==="http:"))return null;let i=t?"":`/${this.language}`,s=new URL(`${i}/patrocinios/camisetas/${this.campaignId}`,e.origin),n=new URL(`${i}/embed/shirt-sponsors/${this.campaignId}`,e.origin);return n.searchParams.set("parentOrigin",location.origin),n.searchParams.set("channel",this.channel),n.searchParams.set("attempt",String(this.attempt)),{publicUrl:s.href,embed:n.href,origin:e.origin}}catch{return null}}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this.onMessage),this.startTimeout()}disconnectedCallback(){window.removeEventListener("message",this.onMessage),clearTimeout(this.timeout),super.disconnectedCallback()}willUpdate(e){if(e.has("campaignId")||e.has("appUrl")||e.has("locale"))this.channel=globalThis.crypto.randomUUID(),this.reset()}reset(){this.ready=!1,this.failed=!1,this.frameHeight=960,this.startTimeout()}startTimeout(){if(clearTimeout(this.timeout),this.isConnected)this.timeout=setTimeout(()=>{if(!this.ready)this.failed=!0},30000)}retry(){this.channel=globalThis.crypto.randomUUID(),this.reset(),this.attempt++}onMessage=(e)=>{let t=this.renderRoot.querySelector("iframe");if(e.origin!==this.urls?.origin||!t||e.source!==t.contentWindow)return;let i=e.data;if(!i||typeof i!=="object"||!("channel"in i)||i.channel!==this.channel||!("type"in i))return;if(i.type==="wodira:shirt:resize"&&"height"in i&&typeof i.height==="number"&&Number.isFinite(i.height))this.frameHeight=Math.max(360,Math.min(12000,Math.ceil(i.height))),this.ready=!0,this.failed=!1,clearTimeout(this.timeout);if(i.type==="wodira:shirt:paid")this.dispatchEvent(new CustomEvent("wodira:shirt:paid",{bubbles:!0,composed:!0,detail:{campaignId:this.campaignId}}))};render(){let e=mt[this.language],t=this.urls;return U`<section class="shell" part="container" aria-label=${e.title}>
|
|
61
|
+
${!t?U`<p class="status" role="alert">${e.invalid}</p>`:U`
|
|
62
|
+
${!this.ready||this.failed?U`<div class="status" role="status">
|
|
63
|
+
${this.failed?e.error:e.loading}
|
|
64
|
+
${this.failed?U`<button @click=${this.retry}>${e.retry}</button>`:c}
|
|
65
|
+
</div>`:c}
|
|
66
|
+
<iframe
|
|
67
|
+
part="frame"
|
|
68
|
+
title=${e.title}
|
|
69
|
+
src=${t.embed}
|
|
70
|
+
height=${this.frameHeight}
|
|
71
|
+
loading="eager"
|
|
72
|
+
allow="payment *"
|
|
73
|
+
referrerpolicy="strict-origin-when-cross-origin"
|
|
74
|
+
sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation"
|
|
75
|
+
></iframe>
|
|
76
|
+
<footer part="footer">
|
|
77
|
+
<span>WODira</span
|
|
78
|
+
><a href=${t.publicUrl} target="_blank" rel="noopener noreferrer"
|
|
79
|
+
>${e.open} ↗</a
|
|
80
|
+
>
|
|
81
|
+
</footer>
|
|
82
|
+
`}
|
|
83
|
+
</section>`}}function Ve(){if(!globalThis.customElements)throw Error("WODira shirt elements require a browser.");if(!customElements.get("wodira-shirt-auction"))customElements.define("wodira-shirt-auction",ce)}Ve();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WodiraShirtAuction } from './shirt-auction.js';
|
|
2
|
+
export { WodiraShirtAuction } from './shirt-auction.js';
|
|
3
|
+
export declare function defineWodiraShirtElements(): void;
|
|
4
|
+
declare global {
|
|
5
|
+
interface HTMLElementTagNameMap {
|
|
6
|
+
'wodira-shirt-auction': WodiraShirtAuction;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/shirt-sponsors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,wBAAgB,yBAAyB,IAAI,IAAI,CAIhD;AACD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,sBAAsB,EAAE,kBAAkB,CAAC;KAC5C;CACF"}
|