PageSourceSearch

https://waterdrop.rs/cdn/shop/t/5/assets/json-state-element-YeYsPIVg.js

js waterdrop.rs collected 2026-10-08 10:57:53 UTC 1,865 bytes, 1 lines download raw bytes

1import o from"./custom-html-element-Cddc4xm8.js";import{l as a}from"./logger-pamvzmAu.js";import"./event-zU-Y6ZHH.js";import"./exports-NHIMKJG4.js";class n extends o{static get observedAttributes(){return["mode","state-id","storage-type"]}constructor(){super(),this.stateId=this.getAttribute("state-id"),this.initialState=null}connectedCallback(){this.ensureGlobalState()&&this.updateState()}attributeChangedCallback(t,e,s){this.ensureGlobalState()&&(t==="mode"||t==="storage-type")&&this.updateState()}ensureGlobalState(){return!("WATERDROP"in window)||typeof window.WATERDROP!="object"?(a.error("globalState is not defined on window.WATERDROP."),!1):!0}updateState(){if(!this.ensureGlobalState())return;const t=this.getAttribute("mode")||"persist",e=this.getAttribute("storage-type")||"memory";if(!this.stateId){a.warn("State ID is required");return}const s=this.textContent.trim();if(!s){a.warn("JSON content is required");return}let r;try{r=JSON.parse(s),this.initialState=r}catch(i){a.error("Error parsing JSON",i);return}if(t==="update"||!window.WATERDROP.globalState.hasState(this.stateId))window.WATERDROP.globalState.setState(this.stateId,r,e);else if(t==="persist"&&window.WATERDROP.globalState.hasState(this.stateId)){const i=window.WATERDROP.globalState.getState(this.stateId);window.WATERDROP.globalState.setState(this.stateId,i,e)}}resetState(){if(!this.ensureGlobalState())return;const t=this.getAttribute("storage-type")||"memory";window.WATERDROP.globalState.setState(this.stateId,this.initialState,t)}getState(){return this.ensureGlobalState()?window.WATERDROP.globalState.getState(this.stateId):null}setState(t){if(!this.ensureGlobalState())return;const e=this.getAttribute("storage-type")||"memory";window.WATERDROP.globalState.setState(this.stateId,t,e)}}customElements.get("json-state-element")||customElements.define("json-state-element",n);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.