pinyin-ime 1.0.1 → 1.0.2

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/dist/index.d.ts CHANGED
@@ -404,12 +404,14 @@ declare class PinyinIMEController<T extends HTMLInputElement | HTMLTextAreaEleme
404
404
  * @remarks
405
405
  * 仅在松开「最后一个」仍按下的物理 Shift 键且本轮未组合其它键时生效;
406
406
  * 与 {@link PinyinIMEController.handleKeyDown} 中的 Shift 计数及 `shiftGestureOtherKeySeen` 配合。
407
+ * `key === "Shift"` 且 `code` 为空或非标准时与左右 Shift 同等对待。
407
408
  */
408
409
  handleKeyUp(e: KeyboardEvent): void;
409
410
  /**
410
411
  * 处理 `keydown`(建议在 capture 阶段调用)。
411
412
  *
412
413
  * @param e - 原生 `KeyboardEvent`
414
+ * @remarks `key === "Shift"` 且 `code` 为空或非标准时与左右 Shift 同等对待。
413
415
  */
414
416
  handleKeyDown(e: KeyboardEvent): void;
415
417
  }
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- function joinClassNames(...parts){return parts.filter(Boolean).join(" ")}var _defaultEngine=null;function registerDefaultEngine(engine){_defaultEngine=engine;}function getDefaultEngine(){return _defaultEngine}function buildWordMaxFreqByWord(dict){let map=new Map;for(let key in dict){let list=dict[key];if(list)for(let item of list){let prev=map.get(item.w);(prev===void 0||item.f>prev)&&map.set(item.w,item.f);}}return map}function buildWordKeysIndex(dict){let index=new Map;for(let key in dict){let list=dict[key];if(list)for(let item of list){let keys=index.get(item.w);keys?keys.push(key):index.set(item.w,[key]);}}return index}function createPinyinKeyTrieNode(){return {children:new Map,keysUnderPrefix:[]}}function buildPinyinKeyTrie(dict){let root=createPinyinKeyTrieNode();for(let key in dict){if(!dict[key])continue;let node=root;node.keysUnderPrefix.push(key);for(let ch of key){let next=node.children.get(ch);next||(next=createPinyinKeyTrieNode(),node.children.set(ch,next)),node=next,node.keysUnderPrefix.push(key);}}return root}function getKeysByPrefix(root,prefix){let node=root;for(let ch of prefix)if(node=node.children.get(ch),!node)return [];return node.keysUnderPrefix}var pinyinEngineByDict=new WeakMap;function createPinyinEngineUncached(dict){let d3=dict,wordMaxFreqByWord=buildWordMaxFreqByWord(d3),wordKeysIndex=buildWordKeysIndex(d3),keyTrieRoot=buildPinyinKeyTrie(d3),prefixWordsCache=new Map,syllableSet=new Set(Object.keys(d3).filter(k2=>/^[a-z]{1,6}$/.test(k2)&&/[aeiouv]/.test(k2)));function mergeAndSort(groups){let map=new Map;for(let group of groups)for(let item of group){let existing=map.get(item.w);(existing===void 0||item.f>existing)&&map.set(item.w,item.f);}return Array.from(map.entries()).sort((a3,b3)=>b3[1]-a3[1]).map(([w2,f4])=>({w:w2,f:f4}))}function collectWordsForPrefixKey(prefix){let cached=prefixWordsCache.get(prefix);if(cached)return cached;let fullGroups=[],exactMatch=d3[prefix];if(exactMatch)fullGroups.push(exactMatch);else {let prefixKeys=getKeysByPrefix(keyTrieRoot,prefix);for(let key of prefixKeys){let val=d3[key];val&&fullGroups.push(val);}}let merged=mergeAndSort(fullGroups);return prefixWordsCache.set(prefix,merged),merged}function getWordKeys(word){return wordKeysIndex.get(word)??[]}function splitToSyllables(key){let memo=new Map,dfs=start=>{if(start===key.length)return [];let cached=memo.get(start);if(cached!==void 0)return cached;for(let end=Math.min(key.length,start+6);end>start;end--){let seg=key.substring(start,end);if(!syllableSet.has(seg))continue;let rest=dfs(end);if(rest){let result=[seg,...rest];return memo.set(start,result),result}}return memo.set(start,null),null};return dfs(0)}function matchMixedConsumedLength(input,key){if(input.startsWith(key))return key.length;let syllables=splitToSyllables(key);if(!syllables)return 0;let best=0,dfs=(idx,pos)=>{if(pos>best&&(best=pos),idx>=syllables.length||pos>=input.length)return;let syl=syllables[idx];input.startsWith(syl,pos)&&dfs(idx+1,pos+syl.length),input[pos]===syl[0]&&dfs(idx+1,pos+1);};return dfs(0,0),best}function matchSubsequenceConsumedLength(input,key){if(!input||!key)return 0;let consumed=0,keyPos=0;for(;consumed<input.length&&keyPos<key.length;){let ch=input[consumed];for(;keyPos<key.length&&key[keyPos]!==ch;)keyPos+=1;if(keyPos>=key.length)break;consumed+=1,keyPos+=1;}return consumed}function upsertCandidate(list,indexMap,word,matchedLength){let idx=indexMap.get(word);if(idx===void 0){indexMap.set(word,list.length),list.push({word,matchedLength});return}matchedLength>list[idx].matchedLength&&(list[idx]={...list[idx],matchedLength});}function getWordMaxFreq(word){return wordMaxFreqByWord.get(word)??0}function sortCandidatesByMatchThenFreq(items,inputLen){let isShortInput=inputLen<=2,getScore=item=>{let score=getWordMaxFreq(item.word);return isShortInput&&item.word.length===1&&(score+=5e4),score};return [...items].sort((a3,b3)=>b3.matchedLength!==a3.matchedLength?b3.matchedLength-a3.matchedLength:getScore(b3)-getScore(a3))}function applyShortInputSingleCharFloor(items,inputLen){if(inputLen>2||items.length===0)return items;let top=items.slice(0,Math.min(items.length,10)),existingSingleCount=top.filter(it=>it.word.length===1).length;if(existingSingleCount>=2)return items;let missing=2-existingSingleCount,promote=items.slice(top.length).filter(it=>it.word.length===1).slice(0,missing);if(promote.length===0)return items;let result=[...items];for(let p3 of promote){let idx=result.indexOf(p3);idx>=0&&result.splice(idx,1);}let insertAt=Math.min(result.length,Math.max(2,existingSingleCount));return result.splice(insertAt,0,...promote),result}function computeMatchedLength2(word,input,fallback){let normalized=input.toLowerCase().replace(/'/g,"");if(!normalized)return 0;let maxLen=fallback,keys=getWordKeys(word);for(let key of keys){let consumed=Math.max(matchMixedConsumedLength(normalized,key),matchSubsequenceConsumedLength(normalized,key));consumed>maxLen&&(maxLen=consumed);}return maxLen}function getCandidates2(input){if(!input)return {candidates:[]};let normalized=input.toLowerCase().replace(/'/g,""),result=[],indexMap=new Map,fullWords=collectWordsForPrefixKey(normalized);for(let{w:w2}of fullWords)upsertCandidate(result,indexMap,w2,normalized.length);if(normalized.length>=2)for(let sylLen=1;sylLen<normalized.length;sylLen++){let syl=normalized.substring(0,sylLen),sylWords=collectWordsForPrefixKey(syl);sylLen===1&&normalized.length>sylLen&&sylWords.length>200&&(sylWords=sylWords.slice(0,200));for(let{w:w2}of sylWords)upsertCandidate(result,indexMap,w2,sylLen);}if(result.length===0)for(let len=normalized.length-1;len>=1;len--){let prefix=normalized.substring(0,len),fallbackWords=collectWordsForPrefixKey(prefix);if(fallbackWords.length>0){for(let{w:w2}of fallbackWords)upsertCandidate(result,indexMap,w2,len);break}}let sorted=sortCandidatesByMatchThenFreq(result,normalized.length),floored=applyShortInputSingleCharFloor(sorted,normalized.length);return floored.length<=300?{candidates:floored}:{candidates:floored.slice(0,300)}}return {getCandidates:getCandidates2,computeMatchedLength:computeMatchedLength2}}function createPinyinEngine(dict){let hit=pinyinEngineByDict.get(dict);if(hit)return hit;let engine=createPinyinEngineUncached(dict);return pinyinEngineByDict.set(dict,engine),engine}var DictionaryLoadError=class extends Error{constructor(message,options){super(message,options),this.name="DictionaryLoadError";}};function assertPinyinDictShape(data){if(data===null||typeof data!="object"||Array.isArray(data))throw new DictionaryLoadError("Dictionary JSON must be a plain object");let o7=data;for(let key of Object.keys(o7)){let arr=o7[key];if(!Array.isArray(arr))throw new DictionaryLoadError(`Dictionary key "${key}" must map to an array`);for(let i5=0;i5<arr.length;i5++){let row=arr[i5];if(row===null||typeof row!="object"||typeof row.w!="string"||typeof row.f!="number")throw new DictionaryLoadError(`Invalid entry at "${key}"[${i5}]: expected { w: string, f: number }`)}}return o7}async function loadPinyinDictFromUrl(url,init){let res;try{res=await fetch(url,init);}catch(e5){throw new DictionaryLoadError("Failed to fetch dictionary",{cause:e5})}if(!res.ok)throw new DictionaryLoadError(`Dictionary request failed: HTTP ${res.status} ${res.statusText}`);let json;try{json=await res.json();}catch(e5){throw new DictionaryLoadError("Dictionary response is not valid JSON",{cause:e5})}return assertPinyinDictShape(json)}function computeMatchedLength(word,input,fallback){let engine=getDefaultEngine();return engine?engine.computeMatchedLength(word,input,fallback):fallback}function getCandidates(input){let engine=getDefaultEngine();return engine?engine.getCandidates(input):{candidates:[]}}var IME_PAGE_SIZE=5;function clampIMPageSize(n6){return Number.isFinite(n6)?Math.min(9,Math.max(1,Math.floor(n6))):5}function isPagingOrControlSymbolKey(e5){if(["=",".","-",","].includes(e5.key)||e5.key==="+"||e5.key==="_")return true;let c5=e5.code;return c5==="Equal"||c5==="Minus"||c5==="Period"||c5==="Comma"||c5==="NumpadSubtract"||c5==="NumpadAdd"||c5==="NumpadDecimal"}function isNextPageKey(e5){if(e5.key==="="||e5.key==="."||e5.key==="+")return true;let c5=e5.code;return c5==="Equal"||c5==="Period"||c5==="NumpadAdd"||c5==="NumpadDecimal"}function isPrevPageKey(e5){if(e5.key==="-"||e5.key===","||e5.key==="_")return true;let c5=e5.code;return c5==="Minus"||c5==="Comma"||c5==="NumpadSubtract"}function isDigitSelectKey(key,pageSize){let d3=parseInt(key,10);return /^[1-9]$/.test(key)&&d3>=1&&d3<=pageSize}function isShiftPhysicalCode(code){return code==="ShiftLeft"||code==="ShiftRight"}var PinyinIMEController=class{options;listeners=new Set;pinyinInput="";pinyinCursorPosition=0;pinyinSelectionStart=0;pinyinSelectionEnd=0;candidates=[];page=0;pageSize=5;highlightedCandidateIndex=null;recomputeRafId=null;missPrefixLock=null;chineseMode=true;shiftPhysicalDown=0;shiftGestureOtherKeySeen=false;cachedSnapshot=null;constructor(options){this.options=options,this.pageSize=clampIMPageSize(options.pageSize??5);}setOptions(patch){this.cancelScheduledRecompute(),this.options={...this.options,...patch},patch.pageSize!==void 0&&(this.pageSize=clampIMPageSize(patch.pageSize),this.page=0),this.recomputeCandidates(),this.emit();}subscribe(onStoreChange){return this.listeners.add(onStoreChange),()=>this.listeners.delete(onStoreChange)}getSnapshot(){if(this.cachedSnapshot===null){let displayCandidates=this.candidates.slice(this.page*this.pageSize,(this.page+1)*this.pageSize);this.cachedSnapshot={pinyinInput:this.pinyinInput,pinyinCursorPosition:this.pinyinCursorPosition,pinyinSelectionStart:this.pinyinSelectionStart,pinyinSelectionEnd:this.pinyinSelectionEnd,candidates:this.candidates,displayCandidates,page:this.page,pageSize:this.pageSize,highlightedCandidateIndex:this.highlightedCandidateIndex,hasActiveComposition:this.pinyinInput.length>0,chineseMode:this.chineseMode};}return this.cachedSnapshot}emit(){this.cachedSnapshot=null;for(let l3 of this.listeners)l3();}setPinyinSelection(start,end){let max=this.pinyinInput.length,s5=Math.max(0,Math.min(max,start)),e5=Math.max(0,Math.min(max,end));this.pinyinSelectionStart=Math.min(s5,e5),this.pinyinSelectionEnd=Math.max(s5,e5),this.pinyinCursorPosition=e5;}collapsePinyinSelection(cursor){this.setPinyinSelection(cursor,cursor);}hasPinyinSelection(){return this.pinyinSelectionStart!==this.pinyinSelectionEnd}replacePinyinSelection(text){let before=this.pinyinInput.substring(0,this.pinyinSelectionStart),after=this.pinyinInput.substring(this.pinyinSelectionEnd);this.pinyinInput=before+text+after,this.collapsePinyinSelection(before.length+text.length);}deleteSelectedPinyin(){return this.hasPinyinSelection()?(this.replacePinyinSelection(""),true):false}syncHighlightedCandidate(){if(this.candidates.length===0){this.highlightedCandidateIndex=null;return}if(this.highlightedCandidateIndex!==null&&this.highlightedCandidateIndex>=0&&this.highlightedCandidateIndex<this.candidates.length)return;let firstIndex=this.page*this.pageSize;this.highlightedCandidateIndex=Math.min(firstIndex,this.candidates.length-1);}cancelScheduledRecompute(){this.recomputeRafId!==null&&(cancelAnimationFrame(this.recomputeRafId),this.recomputeRafId=null);}flushRecomputeAndEmit(){this.cancelScheduledRecompute(),this.recomputeCandidates(),this.emit();}scheduleRecomputeAndEmit(){this.recomputeRafId===null&&(this.recomputeRafId=requestAnimationFrame(()=>{this.recomputeRafId=null,this.recomputeCandidates(),this.emit();}));}clearMissPrefixLock(){this.missPrefixLock=null;}shouldSkipByMissPrefixLock(input){let lock=this.missPrefixLock;return lock?input.length>lock.length&&input.startsWith(lock):false}updateMissPrefixLock(input){if(input.length===0){this.clearMissPrefixLock();return}if(this.candidates.length===0){(this.missPrefixLock===null||input.length<this.missPrefixLock.length||!input.startsWith(this.missPrefixLock))&&(this.missPrefixLock=input);return}this.clearMissPrefixLock();}recomputeCandidates(){let engine=this.options.getEngine();if(!this.pinyinInput||!engine){this.candidates=[],this.page=0,this.highlightedCandidateIndex=null,this.clearMissPrefixLock();return}if(this.shouldSkipByMissPrefixLock(this.pinyinInput)){this.candidates=[],this.page=0,this.highlightedCandidateIndex=null;return}this.candidates=engine.getCandidates(this.pinyinInput).candidates;let maxPage=Math.max(0,Math.ceil(this.candidates.length/this.pageSize)-1);this.page>maxPage&&(this.page=maxPage),this.updateMissPrefixLock(this.pinyinInput),this.syncHighlightedCandidate();}selectCandidate(item){this.cancelScheduledRecompute();let engine=this.options.getEngine();if(!engine)return;this.insertText(item.word);let len=engine.computeMatchedLength(item.word,this.pinyinInput,item.matchedLength),remaining=this.pinyinInput.substring(len),nextInput=remaining.startsWith("'")?remaining.substring(1):remaining;this.pinyinInput=nextInput,this.collapsePinyinSelection(nextInput.length),this.clearMissPrefixLock(),this.recomputeCandidates(),this.page=0,this.highlightedCandidateIndex=this.candidates.length>0?0:null,this.emit();}addPage(delta){this.setPage(p3=>Math.max(0,p3+delta));}setPage(updater){let next=updater(this.page),maxPage=Math.max(0,Math.ceil(this.candidates.length/this.pageSize)-1);this.page=Math.min(maxPage,Math.max(0,next)),this.highlightedCandidateIndex=this.candidates.length>0?Math.min(this.page*this.pageSize,this.candidates.length-1):null,this.emit();}insertText(text){let el=this.options.getElement();if(!el)return;let start=el.selectionStart??0,end=el.selectionEnd??start,currentVal=String(this.options.getValue()||""),newValue=currentVal.substring(0,start)+text+currentVal.substring(end);this.options.onValueChange(newValue),requestAnimationFrame(()=>{el.selectionStart=el.selectionEnd=start+text.length,el.focus();});}commitPinyinBufferAsRaw(){this.insertText(this.pinyinInput),this.pinyinInput="",this.collapsePinyinSelection(0),this.clearMissPrefixLock(),this.recomputeCandidates(),this.emit();}resetShiftGestureState(){this.shiftPhysicalDown=0,this.shiftGestureOtherKeySeen=false;}handleBeforeInput(e5){if(this.options.enabled===false||e5.inputType==="insertFromPaste"||e5.inputType==="insertFromDrop"||e5.inputType==="insertCompositionText"||e5.inputType==="insertFromComposition"||e5.inputType!=="insertText"||!e5.data||e5.data.length!==1)return;let d3=e5.data;if(this.pinyinInput.length>0){if(d3===" "){e5.preventDefault();return}if(isDigitSelectKey(d3,this.pageSize)){e5.preventDefault();return}if(/^[=\-.,]$/.test(d3)){e5.preventDefault();return}}this.chineseMode&&/^[a-zA-Z']$/.test(d3)&&e5.preventDefault();}handleKeyUp(e5){if(this.options.enabled===false||!isShiftPhysicalCode(e5.code)||this.shiftPhysicalDown===0||(this.shiftPhysicalDown-=1,this.shiftPhysicalDown>0))return;let solo=!this.shiftGestureOtherKeySeen;this.shiftGestureOtherKeySeen=false,solo&&(e5.preventDefault(),this.pinyinInput.length>0?this.commitPinyinBufferAsRaw():(this.chineseMode=!this.chineseMode,this.emit()));}handleKeyDown(e5){if(this.options.enabled===false){this.options.onKeyDown?.(e5);return}if(isShiftPhysicalCode(e5.code)){this.shiftPhysicalDown===0&&(this.shiftGestureOtherKeySeen=false),this.shiftPhysicalDown++,this.options.onKeyDown?.(e5);return}if(this.shiftPhysicalDown>0&&(this.shiftGestureOtherKeySeen=true),this.pinyinInput.length>0&&isPagingOrControlSymbolKey(e5)&&(e5.preventDefault(),e5.stopPropagation()),this.pinyinInput.length>0){if(e5.key.toLowerCase()==="a"&&e5.ctrlKey&&!e5.altKey&&!e5.metaKey){e5.preventDefault(),this.setPinyinSelection(0,this.pinyinInput.length),this.emit();return}if(/^[a-z']$/i.test(e5.key)||this.flushRecomputeAndEmit(),e5.key==="Backspace"){if(e5.preventDefault(),this.deleteSelectedPinyin()){this.scheduleRecomputeAndEmit();return}this.pinyinCursorPosition>0&&(this.setPinyinSelection(this.pinyinCursorPosition-1,this.pinyinCursorPosition),this.deleteSelectedPinyin(),this.scheduleRecomputeAndEmit());return}if(e5.key==="Delete"){if(e5.preventDefault(),this.deleteSelectedPinyin()){this.scheduleRecomputeAndEmit();return}this.pinyinCursorPosition<this.pinyinInput.length&&(this.setPinyinSelection(this.pinyinCursorPosition,this.pinyinCursorPosition+1),this.deleteSelectedPinyin(),this.scheduleRecomputeAndEmit());return}if(e5.key==="ArrowLeft"){e5.preventDefault();let nextCursor=this.pinyinCursorPosition>0?this.pinyinCursorPosition-1:this.pinyinInput.length;if(e5.shiftKey){let anchor=this.hasPinyinSelection()?this.pinyinSelectionStart:this.pinyinCursorPosition;this.setPinyinSelection(anchor,nextCursor);}else this.collapsePinyinSelection(nextCursor);this.emit();return}if(e5.key==="ArrowRight"){e5.preventDefault();let nextCursor=this.pinyinCursorPosition<this.pinyinInput.length?this.pinyinCursorPosition+1:0;if(e5.shiftKey){let anchor=this.hasPinyinSelection()?this.pinyinSelectionEnd:this.pinyinCursorPosition;this.setPinyinSelection(anchor,nextCursor);}else this.collapsePinyinSelection(nextCursor);this.emit();return}if(e5.key==="ArrowDown"){if(e5.preventDefault(),this.candidates.length>0){let current=this.highlightedCandidateIndex??this.page*this.pageSize,next=Math.min(this.candidates.length-1,current+1);this.highlightedCandidateIndex=next,this.page=Math.floor(next/this.pageSize),this.emit();}return}if(e5.key==="ArrowUp"){if(e5.preventDefault(),this.candidates.length>0){let current=this.highlightedCandidateIndex??this.page*this.pageSize,next=Math.max(0,current-1);this.highlightedCandidateIndex=next,this.page=Math.floor(next/this.pageSize),this.emit();}return}if(e5.key==="Enter"){e5.preventDefault(),this.commitPinyinBufferAsRaw();return}if(e5.key==="Escape"){e5.preventDefault(),this.pinyinInput="",this.collapsePinyinSelection(0),this.clearMissPrefixLock(),this.recomputeCandidates(),this.emit();return}if(e5.key===" "){if(e5.preventDefault(),this.candidates.length>0){let index=this.highlightedCandidateIndex??this.page*this.pageSize,clamped=Math.min(Math.max(0,index),this.candidates.length-1);this.selectCandidate(this.candidates[clamped]);}else this.insertText(this.pinyinInput),this.pinyinInput="",this.collapsePinyinSelection(0),this.clearMissPrefixLock(),this.recomputeCandidates(),this.emit();return}if(isDigitSelectKey(e5.key,this.pageSize)){e5.preventDefault();let index=parseInt(e5.key,10)-1,globalIndex=this.page*this.pageSize+index;globalIndex<this.candidates.length&&this.selectCandidate(this.candidates[globalIndex]);return}if(isNextPageKey(e5)){(this.page+1)*this.pageSize<this.candidates.length&&this.setPage(p3=>p3+1);return}if(isPrevPageKey(e5)){this.page>0&&this.setPage(p3=>p3-1);return}}if(this.chineseMode&&/^[a-z']$/i.test(e5.key)&&!e5.ctrlKey&&!e5.altKey&&!e5.metaKey){e5.preventDefault(),e5.stopPropagation();let ch=e5.key.toLowerCase();this.replacePinyinSelection(ch),this.scheduleRecomputeAndEmit();return}this.pinyinInput.length>0&&isPagingOrControlSymbolKey(e5)||this.options.onKeyDown?.(e5);}};var ElementInternalsShim=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(_host){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=true,this.__host=_host;}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),true}reportValidity(){return true}setFormValue(){}setValidity(){}};var __classPrivateFieldSet=function(receiver,state,value,kind,f4){if(typeof state=="function"?receiver!==state||true:!state.has(receiver))throw new TypeError("Cannot write private member to an object whose class did not declare it");return state.set(receiver,value),value},__classPrivateFieldGet=function(receiver,state,kind,f4){if(typeof state=="function"?receiver!==state||!f4:!state.has(receiver))throw new TypeError("Cannot read private member from an object whose class did not declare it");return kind==="m"?f4:kind==="a"?f4.call(receiver):f4?f4.value:state.get(receiver)},_Event_cancelable,_Event_bubbles,_Event_composed,_Event_defaultPrevented,_Event_timestamp,_Event_propagationStopped,_Event_type,_Event_target,_Event_isBeingDispatched,_a,_CustomEvent_detail,_b,isCaptureEventListener=options=>typeof options=="boolean"?options:options?.capture??false;var EventTarget=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map;}addEventListener(type,callback,options){if(callback==null)return;let eventListenersMap=isCaptureEventListener(options)?this.__captureEventListeners:this.__eventListeners,eventListeners=eventListenersMap.get(type);if(eventListeners===void 0)eventListeners=new Map,eventListenersMap.set(type,eventListeners);else if(eventListeners.has(callback))return;let normalizedOptions=typeof options=="object"&&options?options:{};normalizedOptions.signal?.addEventListener("abort",()=>this.removeEventListener(type,callback,options)),eventListeners.set(callback,normalizedOptions??{});}removeEventListener(type,callback,options){if(callback==null)return;let eventListenersMap=isCaptureEventListener(options)?this.__captureEventListeners:this.__eventListeners,eventListeners=eventListenersMap.get(type);eventListeners!==void 0&&(eventListeners.delete(callback),eventListeners.size||eventListenersMap.delete(type));}dispatchEvent(event){let composedPath=[this],parent=this.__eventTargetParent;if(event.composed)for(;parent;)composedPath.push(parent),parent=parent.__eventTargetParent;else for(;parent&&parent!==this.__host;)composedPath.push(parent),parent=parent.__eventTargetParent;let stopPropagation=false,stopImmediatePropagation=false,eventPhase=0,target=null,tmpTarget=null,currentTarget=null,originalStopPropagation=event.stopPropagation,originalStopImmediatePropagation=event.stopImmediatePropagation;Object.defineProperties(event,{target:{get(){return target??tmpTarget},...enumerableProperty},srcElement:{get(){return event.target},...enumerableProperty},currentTarget:{get(){return currentTarget},...enumerableProperty},eventPhase:{get(){return eventPhase},...enumerableProperty},composedPath:{value:()=>composedPath,...enumerableProperty},stopPropagation:{value:()=>{stopPropagation=true,originalStopPropagation.call(event);},...enumerableProperty},stopImmediatePropagation:{value:()=>{stopImmediatePropagation=true,originalStopImmediatePropagation.call(event);},...enumerableProperty}});let invokeEventListener=(listener,options,eventListenerMap)=>{typeof listener=="function"?listener(event):typeof listener?.handleEvent=="function"&&listener.handleEvent(event),options.once&&eventListenerMap.delete(listener);},finishDispatch=()=>(currentTarget=null,eventPhase=0,!event.defaultPrevented),captureEventPath=composedPath.slice().reverse();target=!this.__host||!event.composed?this:null;let retarget=eventTargets=>{for(tmpTarget=this;tmpTarget.__host&&eventTargets.includes(tmpTarget.__host);)tmpTarget=tmpTarget.__host;};for(let eventTarget of captureEventPath){!target&&(!tmpTarget||tmpTarget===eventTarget.__host)&&retarget(captureEventPath.slice(captureEventPath.indexOf(eventTarget))),currentTarget=eventTarget,eventPhase=eventTarget===event.target?2:1;let captureEventListeners=eventTarget.__captureEventListeners.get(event.type);if(captureEventListeners){for(let[listener,options]of captureEventListeners)if(invokeEventListener(listener,options,captureEventListeners),stopImmediatePropagation)return finishDispatch()}if(stopPropagation)return finishDispatch()}let bubbleEventPath=event.bubbles?composedPath:[this];tmpTarget=null;for(let eventTarget of bubbleEventPath){!target&&(!tmpTarget||eventTarget===tmpTarget.__host)&&retarget(bubbleEventPath.slice(0,bubbleEventPath.indexOf(eventTarget)+1)),currentTarget=eventTarget,eventPhase=eventTarget===event.target?2:3;let captureEventListeners=eventTarget.__eventListeners.get(event.type);if(captureEventListeners){for(let[listener,options]of captureEventListeners)if(invokeEventListener(listener,options,captureEventListeners),stopImmediatePropagation)return finishDispatch()}if(stopPropagation)return finishDispatch()}return finishDispatch()}},EventTargetShimWithRealType=EventTarget;var enumerableProperty={__proto__:null};enumerableProperty.enumerable=true;Object.freeze(enumerableProperty);var EventShim=(_a=class{constructor(type,options={}){if(_Event_cancelable.set(this,false),_Event_bubbles.set(this,false),_Event_composed.set(this,false),_Event_defaultPrevented.set(this,false),_Event_timestamp.set(this,Date.now()),_Event_propagationStopped.set(this,false),_Event_type.set(this,void 0),_Event_target.set(this,void 0),_Event_isBeingDispatched.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof options!="object"||!options)throw new Error('The "options" argument must be an object');let{bubbles,cancelable,composed}=options;__classPrivateFieldSet(this,_Event_cancelable,!!cancelable),__classPrivateFieldSet(this,_Event_bubbles,!!bubbles),__classPrivateFieldSet(this,_Event_composed,!!composed),__classPrivateFieldSet(this,_Event_type,`${type}`),__classPrivateFieldSet(this,_Event_target,null),__classPrivateFieldSet(this,_Event_isBeingDispatched,false);}initEvent(_type,_bubbles,_cancelable){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation();}preventDefault(){__classPrivateFieldSet(this,_Event_defaultPrevented,true);}get target(){return __classPrivateFieldGet(this,_Event_target,"f")}get currentTarget(){return __classPrivateFieldGet(this,_Event_target,"f")}get srcElement(){return __classPrivateFieldGet(this,_Event_target,"f")}get type(){return __classPrivateFieldGet(this,_Event_type,"f")}get cancelable(){return __classPrivateFieldGet(this,_Event_cancelable,"f")}get defaultPrevented(){return __classPrivateFieldGet(this,_Event_cancelable,"f")&&__classPrivateFieldGet(this,_Event_defaultPrevented,"f")}get timeStamp(){return __classPrivateFieldGet(this,_Event_timestamp,"f")}composedPath(){return __classPrivateFieldGet(this,_Event_isBeingDispatched,"f")?[__classPrivateFieldGet(this,_Event_target,"f")]:[]}get returnValue(){return !__classPrivateFieldGet(this,_Event_cancelable,"f")||!__classPrivateFieldGet(this,_Event_defaultPrevented,"f")}get bubbles(){return __classPrivateFieldGet(this,_Event_bubbles,"f")}get composed(){return __classPrivateFieldGet(this,_Event_composed,"f")}get eventPhase(){return __classPrivateFieldGet(this,_Event_isBeingDispatched,"f")?_a.AT_TARGET:_a.NONE}get cancelBubble(){return __classPrivateFieldGet(this,_Event_propagationStopped,"f")}set cancelBubble(value){value&&__classPrivateFieldSet(this,_Event_propagationStopped,true);}stopPropagation(){__classPrivateFieldSet(this,_Event_propagationStopped,true);}get isTrusted(){return false}},_Event_cancelable=new WeakMap,_Event_bubbles=new WeakMap,_Event_composed=new WeakMap,_Event_defaultPrevented=new WeakMap,_Event_timestamp=new WeakMap,_Event_propagationStopped=new WeakMap,_Event_type=new WeakMap,_Event_target=new WeakMap,_Event_isBeingDispatched=new WeakMap,_a.NONE=0,_a.CAPTURING_PHASE=1,_a.AT_TARGET=2,_a.BUBBLING_PHASE=3,_a);Object.defineProperties(EventShim.prototype,{initEvent:enumerableProperty,stopImmediatePropagation:enumerableProperty,preventDefault:enumerableProperty,target:enumerableProperty,currentTarget:enumerableProperty,srcElement:enumerableProperty,type:enumerableProperty,cancelable:enumerableProperty,defaultPrevented:enumerableProperty,timeStamp:enumerableProperty,composedPath:enumerableProperty,returnValue:enumerableProperty,bubbles:enumerableProperty,composed:enumerableProperty,eventPhase:enumerableProperty,cancelBubble:enumerableProperty,stopPropagation:enumerableProperty,isTrusted:enumerableProperty});var CustomEventShim=(_b=class extends EventShim{constructor(type,options={}){super(type,options),_CustomEvent_detail.set(this,void 0),__classPrivateFieldSet(this,_CustomEvent_detail,options?.detail??null);}initCustomEvent(_type,_bubbles,_cancelable,_detail){throw new Error("Method not implemented.")}get detail(){return __classPrivateFieldGet(this,_CustomEvent_detail,"f")}},_CustomEvent_detail=new WeakMap,_b);Object.defineProperties(CustomEventShim.prototype,{detail:enumerableProperty});var EventShimWithRealType=EventShim,CustomEventShimWithRealType=CustomEventShim;var _a2;(_a2=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.__parentStyleSheet=null,this.cssText="";}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},_a2.STYLE_RULE=1,_a2.CHARSET_RULE=2,_a2.IMPORT_RULE=3,_a2.MEDIA_RULE=4,_a2.FONT_FACE_RULE=5,_a2.PAGE_RULE=6,_a2.NAMESPACE_RULE=10,_a2.KEYFRAMES_RULE=7,_a2.KEYFRAME_RULE=8,_a2.SUPPORTS_RULE=12,_a2.COUNTER_STYLE_RULE=11,_a2.FONT_FEATURE_VALUES_RULE=14,_a2);globalThis.Event??=EventShimWithRealType;globalThis.CustomEvent??=CustomEventShimWithRealType;var attributes=new WeakMap,attributesForElement=element=>{let attrs=attributes.get(element);return attrs===void 0&&attributes.set(element,attrs=new Map),attrs},ElementShim=class extends EventTargetShimWithRealType{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null;}get attributes(){return Array.from(attributesForElement(this)).map(([name,value])=>({name,value}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(name,value){attributesForElement(this).set(name,String(value));}removeAttribute(name){attributesForElement(this).delete(name);}toggleAttribute(name,force){if(this.hasAttribute(name)){if(force===void 0||!force)return this.removeAttribute(name),false}else return force===void 0||force?(this.setAttribute(name,""),true):false;return true}hasAttribute(name){return attributesForElement(this).has(name)}attachShadow(init){let shadowRoot={host:this};return this.__shadowRootMode=init.mode,init&&init.mode==="open"&&(this.__shadowRoot=shadowRoot),shadowRoot}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let internals=new ElementInternalsShim(this);return this.__internals=internals,internals}getAttribute(name){return attributesForElement(this).get(name)??null}};var HTMLElementShim=class extends ElementShim{},HTMLElementShimWithRealType=HTMLElementShim;globalThis.litServerRoot??=Object.defineProperty(new HTMLElementShimWithRealType,"localName",{get(){return "lit-server-root"}});function promiseWithResolvers(){let resolve,reject;return {promise:new Promise((res,rej)=>{resolve=res,reject=rej;}),resolve,reject}}var CustomElementRegistry=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map;}define(name,ctor){if(this.__definitions.has(name))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${name}" has already been used with this registry`);if(this.__reverseDefinitions.has(ctor))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(ctor)}`);ctor.__localName=name,this.__definitions.set(name,{ctor,observedAttributes:ctor.observedAttributes??[]}),this.__reverseDefinitions.set(ctor,name),this.__pendingWhenDefineds.get(name)?.resolve(ctor),this.__pendingWhenDefineds.delete(name);}get(name){return this.__definitions.get(name)?.ctor}getName(ctor){return this.__reverseDefinitions.get(ctor)??null}upgrade(_element){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(name){let definition=this.__definitions.get(name);if(definition)return definition.ctor;let withResolvers=this.__pendingWhenDefineds.get(name);return withResolvers||(withResolvers=promiseWithResolvers(),this.__pendingWhenDefineds.set(name,withResolvers)),withResolvers.promise}},CustomElementRegistryShimWithRealType=CustomElementRegistry;var customElements2=new CustomElementRegistryShimWithRealType;var t=globalThis,e=t.ShadowRoot&&(t.ShadyCSS===void 0||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),o=new WeakMap,n=class{constructor(t5,e5,o7){if(this._$cssResult$=true,o7!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t5,this.t=e5;}get styleSheet(){let t5=this.o,s5=this.t;if(e&&t5===void 0){let e5=s5!==void 0&&s5.length===1;e5&&(t5=o.get(s5)),t5===void 0&&((this.o=t5=new CSSStyleSheet).replaceSync(this.cssText),e5&&o.set(s5,t5));}return t5}toString(){return this.cssText}},r=t5=>new n(typeof t5=="string"?t5:t5+"",void 0,s);var S=(s5,o7)=>{if(e)s5.adoptedStyleSheets=o7.map(t5=>t5 instanceof CSSStyleSheet?t5:t5.styleSheet);else for(let e5 of o7){let o8=document.createElement("style"),n6=t.litNonce;n6!==void 0&&o8.setAttribute("nonce",n6),o8.textContent=e5.cssText,s5.appendChild(o8);}},c=e||t.CSSStyleSheet===void 0?t5=>t5:t5=>t5 instanceof CSSStyleSheet?(t6=>{let e5="";for(let s5 of t6.cssRules)e5+=s5.cssText;return r(e5)})(t5):t5;var{is:h,defineProperty:r2,getOwnPropertyDescriptor:o2,getOwnPropertyNames:n2,getOwnPropertySymbols:a,getPrototypeOf:c2}=Object,l=globalThis;l.customElements??=customElements2;var p=l.trustedTypes,d=p?p.emptyScript:"",u=l.reactiveElementPolyfillSupport,f=(t5,s5)=>t5,b={toAttribute(t5,s5){switch(s5){case Boolean:t5=t5?d:null;break;case Object:case Array:t5=t5==null?t5:JSON.stringify(t5);}return t5},fromAttribute(t5,s5){let i5=t5;switch(s5){case Boolean:i5=t5!==null;break;case Number:i5=t5===null?null:Number(t5);break;case Object:case Array:try{i5=JSON.parse(t5);}catch{i5=null;}}return i5}},m=(t5,s5)=>!h(t5,s5),y={attribute:true,type:String,converter:b,reflect:false,useDefault:false,hasChanged:m};Symbol.metadata??=Symbol("metadata"),l.litPropertyMetadata??=new WeakMap;var g=class extends(globalThis.HTMLElement??HTMLElementShimWithRealType){static addInitializer(t5){this._$Ei(),(this.l??=[]).push(t5);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t5,s5=y){if(s5.state&&(s5.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t5)&&((s5=Object.create(s5)).wrapped=true),this.elementProperties.set(t5,s5),!s5.noAccessor){let i5=Symbol(),e5=this.getPropertyDescriptor(t5,i5,s5);e5!==void 0&&r2(this.prototype,t5,e5);}}static getPropertyDescriptor(t5,s5,i5){let{get:e5,set:h5}=o2(this.prototype,t5)??{get(){return this[s5]},set(t6){this[s5]=t6;}};return {get:e5,set(s6){let r6=e5?.call(this);h5?.call(this,s6),this.requestUpdate(t5,r6,i5);},configurable:true,enumerable:true}}static getPropertyOptions(t5){return this.elementProperties.get(t5)??y}static _$Ei(){if(this.hasOwnProperty(f("elementProperties")))return;let t5=c2(this);t5.finalize(),t5.l!==void 0&&(this.l=[...t5.l]),this.elementProperties=new Map(t5.elementProperties);}static finalize(){if(this.hasOwnProperty(f("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(f("properties"))){let t6=this.properties,s5=[...n2(t6),...a(t6)];for(let i5 of s5)this.createProperty(i5,t6[i5]);}let t5=this[Symbol.metadata];if(t5!==null){let s5=litPropertyMetadata.get(t5);if(s5!==void 0)for(let[t6,i5]of s5)this.elementProperties.set(t6,i5);}this._$Eh=new Map;for(let[t6,s5]of this.elementProperties){let i5=this._$Eu(t6,s5);i5!==void 0&&this._$Eh.set(i5,t6);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(t5){let s5=[];if(Array.isArray(t5)){let e5=new Set(t5.flat(1/0).reverse());for(let t6 of e5)s5.unshift(c(t6));}else t5!==void 0&&s5.push(c(t5));return s5}static _$Eu(t5,s5){let i5=s5.attribute;return i5===false?void 0:typeof i5=="string"?i5:typeof t5=="string"?t5.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise(t5=>this.enableUpdating=t5),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t5=>t5(this));}addController(t5){(this._$EO??=new Set).add(t5),this.renderRoot!==void 0&&this.isConnected&&t5.hostConnected?.();}removeController(t5){this._$EO?.delete(t5);}_$E_(){let t5=new Map,s5=this.constructor.elementProperties;for(let i5 of s5.keys())this.hasOwnProperty(i5)&&(t5.set(i5,this[i5]),delete this[i5]);t5.size>0&&(this._$Ep=t5);}createRenderRoot(){let t5=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S(t5,this.constructor.elementStyles),t5}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach(t5=>t5.hostConnected?.());}enableUpdating(t5){}disconnectedCallback(){this._$EO?.forEach(t5=>t5.hostDisconnected?.());}attributeChangedCallback(t5,s5,i5){this._$AK(t5,i5);}_$ET(t5,s5){let i5=this.constructor.elementProperties.get(t5),e5=this.constructor._$Eu(t5,i5);if(e5!==void 0&&i5.reflect===true){let h5=(i5.converter?.toAttribute!==void 0?i5.converter:b).toAttribute(s5,i5.type);this._$Em=t5,h5==null?this.removeAttribute(e5):this.setAttribute(e5,h5),this._$Em=null;}}_$AK(t5,s5){let i5=this.constructor,e5=i5._$Eh.get(t5);if(e5!==void 0&&this._$Em!==e5){let t6=i5.getPropertyOptions(e5),h5=typeof t6.converter=="function"?{fromAttribute:t6.converter}:t6.converter?.fromAttribute!==void 0?t6.converter:b;this._$Em=e5;let r6=h5.fromAttribute(s5,t6.type);this[e5]=r6??this._$Ej?.get(e5)??r6,this._$Em=null;}}requestUpdate(t5,s5,i5,e5=false,h5){if(t5!==void 0){let r6=this.constructor;if(e5===false&&(h5=this[t5]),i5??=r6.getPropertyOptions(t5),!((i5.hasChanged??m)(h5,s5)||i5.useDefault&&i5.reflect&&h5===this._$Ej?.get(t5)&&!this.hasAttribute(r6._$Eu(t5,i5))))return;this.C(t5,s5,i5);}this.isUpdatePending===false&&(this._$ES=this._$EP());}C(t5,s5,{useDefault:i5,reflect:e5,wrapped:h5},r6){i5&&!(this._$Ej??=new Map).has(t5)&&(this._$Ej.set(t5,r6??s5??this[t5]),h5!==true||r6!==void 0)||(this._$AL.has(t5)||(this.hasUpdated||i5||(s5=void 0),this._$AL.set(t5,s5)),e5===true&&this._$Em!==t5&&(this._$Eq??=new Set).add(t5));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t6){Promise.reject(t6);}let t5=this.scheduleUpdate();return t5!=null&&await t5,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[t7,s6]of this._$Ep)this[t7]=s6;this._$Ep=void 0;}let t6=this.constructor.elementProperties;if(t6.size>0)for(let[s6,i5]of t6){let{wrapped:t7}=i5,e5=this[s6];t7!==true||this._$AL.has(s6)||e5===void 0||this.C(s6,void 0,i5,e5);}}let t5=false,s5=this._$AL;try{t5=this.shouldUpdate(s5),t5?(this.willUpdate(s5),this._$EO?.forEach(t6=>t6.hostUpdate?.()),this.update(s5)):this._$EM();}catch(s6){throw t5=false,this._$EM(),s6}t5&&this._$AE(s5);}willUpdate(t5){}_$AE(t5){this._$EO?.forEach(t6=>t6.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t5)),this.updated(t5);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t5){return true}update(t5){this._$Eq&&=this._$Eq.forEach(t6=>this._$ET(t6,this[t6])),this._$EM();}updated(t5){}firstUpdated(t5){}};g.elementStyles=[],g.shadowRootOptions={mode:"open"},g[f("elementProperties")]=new Map,g[f("finalized")]=new Map,u?.({ReactiveElement:g}),(l.reactiveElementVersions??=[]).push("2.1.2");var t2=globalThis,i2=t5=>t5,s2=t2.trustedTypes,e2=s2?s2.createPolicy("lit-html",{createHTML:t5=>t5}):void 0,h2="$lit$",o3=`lit$${Math.random().toFixed(9).slice(2)}$`,n3="?"+o3,r3=`<${n3}>`,l2=t2.document===void 0?{createTreeWalker:()=>({})}:document,c3=()=>l2.createComment(""),a2=t5=>t5===null||typeof t5!="object"&&typeof t5!="function",u2=Array.isArray,d2=t5=>u2(t5)||typeof t5?.[Symbol.iterator]=="function",f2=`[
1
+ function joinClassNames(...parts){return parts.filter(Boolean).join(" ")}var _defaultEngine=null;function registerDefaultEngine(engine){_defaultEngine=engine;}function getDefaultEngine(){return _defaultEngine}function buildWordMaxFreqByWord(dict){let map=new Map;for(let key in dict){let list=dict[key];if(list)for(let item of list){let prev=map.get(item.w);(prev===void 0||item.f>prev)&&map.set(item.w,item.f);}}return map}function buildWordKeysIndex(dict){let index=new Map;for(let key in dict){let list=dict[key];if(list)for(let item of list){let keys=index.get(item.w);keys?keys.push(key):index.set(item.w,[key]);}}return index}function createPinyinKeyTrieNode(){return {children:new Map,keysUnderPrefix:[]}}function buildPinyinKeyTrie(dict){let root=createPinyinKeyTrieNode();for(let key in dict){if(!dict[key])continue;let node=root;node.keysUnderPrefix.push(key);for(let ch of key){let next=node.children.get(ch);next||(next=createPinyinKeyTrieNode(),node.children.set(ch,next)),node=next,node.keysUnderPrefix.push(key);}}return root}function getKeysByPrefix(root,prefix){let node=root;for(let ch of prefix)if(node=node.children.get(ch),!node)return [];return node.keysUnderPrefix}var pinyinEngineByDict=new WeakMap;function createPinyinEngineUncached(dict){let d3=dict,wordMaxFreqByWord=buildWordMaxFreqByWord(d3),wordKeysIndex=buildWordKeysIndex(d3),keyTrieRoot=buildPinyinKeyTrie(d3),prefixWordsCache=new Map,syllableSet=new Set(Object.keys(d3).filter(k2=>/^[a-z]{1,6}$/.test(k2)&&/[aeiouv]/.test(k2)));function mergeAndSort(groups){let map=new Map;for(let group of groups)for(let item of group){let existing=map.get(item.w);(existing===void 0||item.f>existing)&&map.set(item.w,item.f);}return Array.from(map.entries()).sort((a3,b3)=>b3[1]-a3[1]).map(([w2,f4])=>({w:w2,f:f4}))}function collectWordsForPrefixKey(prefix){let cached=prefixWordsCache.get(prefix);if(cached)return cached;let fullGroups=[],exactMatch=d3[prefix];if(exactMatch)fullGroups.push(exactMatch);else {let prefixKeys=getKeysByPrefix(keyTrieRoot,prefix);for(let key of prefixKeys){let val=d3[key];val&&fullGroups.push(val);}}let merged=mergeAndSort(fullGroups);return prefixWordsCache.set(prefix,merged),merged}function getWordKeys(word){return wordKeysIndex.get(word)??[]}function splitToSyllables(key){let memo=new Map,dfs=start=>{if(start===key.length)return [];let cached=memo.get(start);if(cached!==void 0)return cached;for(let end=Math.min(key.length,start+6);end>start;end--){let seg=key.substring(start,end);if(!syllableSet.has(seg))continue;let rest=dfs(end);if(rest){let result=[seg,...rest];return memo.set(start,result),result}}return memo.set(start,null),null};return dfs(0)}function matchMixedConsumedLength(input,key){if(input.startsWith(key))return key.length;let syllables=splitToSyllables(key);if(!syllables)return 0;let best=0,dfs=(idx,pos)=>{if(pos>best&&(best=pos),idx>=syllables.length||pos>=input.length)return;let syl=syllables[idx];input.startsWith(syl,pos)&&dfs(idx+1,pos+syl.length),input[pos]===syl[0]&&dfs(idx+1,pos+1);};return dfs(0,0),best}function matchSubsequenceConsumedLength(input,key){if(!input||!key)return 0;let consumed=0,keyPos=0;for(;consumed<input.length&&keyPos<key.length;){let ch=input[consumed];for(;keyPos<key.length&&key[keyPos]!==ch;)keyPos+=1;if(keyPos>=key.length)break;consumed+=1,keyPos+=1;}return consumed}function upsertCandidate(list,indexMap,word,matchedLength){let idx=indexMap.get(word);if(idx===void 0){indexMap.set(word,list.length),list.push({word,matchedLength});return}matchedLength>list[idx].matchedLength&&(list[idx]={...list[idx],matchedLength});}function getWordMaxFreq(word){return wordMaxFreqByWord.get(word)??0}function sortCandidatesByMatchThenFreq(items,inputLen){let isShortInput=inputLen<=2,getScore=item=>{let score=getWordMaxFreq(item.word);return isShortInput&&item.word.length===1&&(score+=5e4),score};return [...items].sort((a3,b3)=>b3.matchedLength!==a3.matchedLength?b3.matchedLength-a3.matchedLength:getScore(b3)-getScore(a3))}function applyShortInputSingleCharFloor(items,inputLen){if(inputLen>2||items.length===0)return items;let top=items.slice(0,Math.min(items.length,10)),existingSingleCount=top.filter(it=>it.word.length===1).length;if(existingSingleCount>=2)return items;let missing=2-existingSingleCount,promote=items.slice(top.length).filter(it=>it.word.length===1).slice(0,missing);if(promote.length===0)return items;let result=[...items];for(let p3 of promote){let idx=result.indexOf(p3);idx>=0&&result.splice(idx,1);}let insertAt=Math.min(result.length,Math.max(2,existingSingleCount));return result.splice(insertAt,0,...promote),result}function computeMatchedLength2(word,input,fallback){let normalized=input.toLowerCase().replace(/'/g,"");if(!normalized)return 0;let maxLen=fallback,keys=getWordKeys(word);for(let key of keys){let consumed=Math.max(matchMixedConsumedLength(normalized,key),matchSubsequenceConsumedLength(normalized,key));consumed>maxLen&&(maxLen=consumed);}return maxLen}function getCandidates2(input){if(!input)return {candidates:[]};let normalized=input.toLowerCase().replace(/'/g,""),result=[],indexMap=new Map,fullWords=collectWordsForPrefixKey(normalized);for(let{w:w2}of fullWords)upsertCandidate(result,indexMap,w2,normalized.length);if(normalized.length>=2)for(let sylLen=1;sylLen<normalized.length;sylLen++){let syl=normalized.substring(0,sylLen),sylWords=collectWordsForPrefixKey(syl);sylLen===1&&normalized.length>sylLen&&sylWords.length>200&&(sylWords=sylWords.slice(0,200));for(let{w:w2}of sylWords)upsertCandidate(result,indexMap,w2,sylLen);}if(result.length===0)for(let len=normalized.length-1;len>=1;len--){let prefix=normalized.substring(0,len),fallbackWords=collectWordsForPrefixKey(prefix);if(fallbackWords.length>0){for(let{w:w2}of fallbackWords)upsertCandidate(result,indexMap,w2,len);break}}let sorted=sortCandidatesByMatchThenFreq(result,normalized.length),floored=applyShortInputSingleCharFloor(sorted,normalized.length);return floored.length<=300?{candidates:floored}:{candidates:floored.slice(0,300)}}return {getCandidates:getCandidates2,computeMatchedLength:computeMatchedLength2}}function createPinyinEngine(dict){let hit=pinyinEngineByDict.get(dict);if(hit)return hit;let engine=createPinyinEngineUncached(dict);return pinyinEngineByDict.set(dict,engine),engine}var DictionaryLoadError=class extends Error{constructor(message,options){super(message,options),this.name="DictionaryLoadError";}};function assertPinyinDictShape(data){if(data===null||typeof data!="object"||Array.isArray(data))throw new DictionaryLoadError("Dictionary JSON must be a plain object");let o7=data;for(let key of Object.keys(o7)){let arr=o7[key];if(!Array.isArray(arr))throw new DictionaryLoadError(`Dictionary key "${key}" must map to an array`);for(let i5=0;i5<arr.length;i5++){let row=arr[i5];if(row===null||typeof row!="object"||typeof row.w!="string"||typeof row.f!="number")throw new DictionaryLoadError(`Invalid entry at "${key}"[${i5}]: expected { w: string, f: number }`)}}return o7}async function loadPinyinDictFromUrl(url,init){let res;try{res=await fetch(url,init);}catch(e5){throw new DictionaryLoadError("Failed to fetch dictionary",{cause:e5})}if(!res.ok)throw new DictionaryLoadError(`Dictionary request failed: HTTP ${res.status} ${res.statusText}`);let json;try{json=await res.json();}catch(e5){throw new DictionaryLoadError("Dictionary response is not valid JSON",{cause:e5})}return assertPinyinDictShape(json)}function computeMatchedLength(word,input,fallback){let engine=getDefaultEngine();return engine?engine.computeMatchedLength(word,input,fallback):fallback}function getCandidates(input){let engine=getDefaultEngine();return engine?engine.getCandidates(input):{candidates:[]}}var IME_PAGE_SIZE=5;function clampIMPageSize(n6){return Number.isFinite(n6)?Math.min(9,Math.max(1,Math.floor(n6))):5}function isPagingOrControlSymbolKey(e5){if(["=",".","-",","].includes(e5.key)||e5.key==="+"||e5.key==="_")return true;let c5=e5.code;return c5==="Equal"||c5==="Minus"||c5==="Period"||c5==="Comma"||c5==="NumpadSubtract"||c5==="NumpadAdd"||c5==="NumpadDecimal"}function isNextPageKey(e5){if(e5.key==="="||e5.key==="."||e5.key==="+")return true;let c5=e5.code;return c5==="Equal"||c5==="Period"||c5==="NumpadAdd"||c5==="NumpadDecimal"}function isPrevPageKey(e5){if(e5.key==="-"||e5.key===","||e5.key==="_")return true;let c5=e5.code;return c5==="Minus"||c5==="Comma"||c5==="NumpadSubtract"}function isDigitSelectKey(key,pageSize){let d3=parseInt(key,10);return /^[1-9]$/.test(key)&&d3>=1&&d3<=pageSize}function isShiftPhysicalCode(code){return code==="ShiftLeft"||code==="ShiftRight"}function isPhysicalShiftKeyEvent(e5){if(isShiftPhysicalCode(e5.code))return true;if(e5.key!=="Shift")return false;let c5=(e5.code??"").trim();return !c5||c5==="Unidentified"||c5==="Shift"}var PinyinIMEController=class{options;listeners=new Set;pinyinInput="";pinyinCursorPosition=0;pinyinSelectionStart=0;pinyinSelectionEnd=0;candidates=[];page=0;pageSize=5;highlightedCandidateIndex=null;recomputeRafId=null;missPrefixLock=null;chineseMode=true;shiftPhysicalDown=0;shiftGestureOtherKeySeen=false;cachedSnapshot=null;constructor(options){this.options=options,this.pageSize=clampIMPageSize(options.pageSize??5);}setOptions(patch){this.cancelScheduledRecompute(),this.options={...this.options,...patch},patch.pageSize!==void 0&&(this.pageSize=clampIMPageSize(patch.pageSize),this.page=0),this.recomputeCandidates(),this.emit();}subscribe(onStoreChange){return this.listeners.add(onStoreChange),()=>this.listeners.delete(onStoreChange)}getSnapshot(){if(this.cachedSnapshot===null){let displayCandidates=this.candidates.slice(this.page*this.pageSize,(this.page+1)*this.pageSize);this.cachedSnapshot={pinyinInput:this.pinyinInput,pinyinCursorPosition:this.pinyinCursorPosition,pinyinSelectionStart:this.pinyinSelectionStart,pinyinSelectionEnd:this.pinyinSelectionEnd,candidates:this.candidates,displayCandidates,page:this.page,pageSize:this.pageSize,highlightedCandidateIndex:this.highlightedCandidateIndex,hasActiveComposition:this.pinyinInput.length>0,chineseMode:this.chineseMode};}return this.cachedSnapshot}emit(){this.cachedSnapshot=null;for(let l3 of this.listeners)l3();}setPinyinSelection(start,end){let max=this.pinyinInput.length,s5=Math.max(0,Math.min(max,start)),e5=Math.max(0,Math.min(max,end));this.pinyinSelectionStart=Math.min(s5,e5),this.pinyinSelectionEnd=Math.max(s5,e5),this.pinyinCursorPosition=e5;}collapsePinyinSelection(cursor){this.setPinyinSelection(cursor,cursor);}hasPinyinSelection(){return this.pinyinSelectionStart!==this.pinyinSelectionEnd}replacePinyinSelection(text){let before=this.pinyinInput.substring(0,this.pinyinSelectionStart),after=this.pinyinInput.substring(this.pinyinSelectionEnd);this.pinyinInput=before+text+after,this.collapsePinyinSelection(before.length+text.length);}deleteSelectedPinyin(){return this.hasPinyinSelection()?(this.replacePinyinSelection(""),true):false}syncHighlightedCandidate(){if(this.candidates.length===0){this.highlightedCandidateIndex=null;return}if(this.highlightedCandidateIndex!==null&&this.highlightedCandidateIndex>=0&&this.highlightedCandidateIndex<this.candidates.length)return;let firstIndex=this.page*this.pageSize;this.highlightedCandidateIndex=Math.min(firstIndex,this.candidates.length-1);}cancelScheduledRecompute(){this.recomputeRafId!==null&&(cancelAnimationFrame(this.recomputeRafId),this.recomputeRafId=null);}flushRecomputeAndEmit(){this.cancelScheduledRecompute(),this.recomputeCandidates(),this.emit();}scheduleRecomputeAndEmit(){this.recomputeRafId===null&&(this.recomputeRafId=requestAnimationFrame(()=>{this.recomputeRafId=null,this.recomputeCandidates(),this.emit();}));}clearMissPrefixLock(){this.missPrefixLock=null;}shouldSkipByMissPrefixLock(input){let lock=this.missPrefixLock;return lock?input.length>lock.length&&input.startsWith(lock):false}updateMissPrefixLock(input){if(input.length===0){this.clearMissPrefixLock();return}if(this.candidates.length===0){(this.missPrefixLock===null||input.length<this.missPrefixLock.length||!input.startsWith(this.missPrefixLock))&&(this.missPrefixLock=input);return}this.clearMissPrefixLock();}recomputeCandidates(){let engine=this.options.getEngine();if(!this.pinyinInput||!engine){this.candidates=[],this.page=0,this.highlightedCandidateIndex=null,this.clearMissPrefixLock();return}if(this.shouldSkipByMissPrefixLock(this.pinyinInput)){this.candidates=[],this.page=0,this.highlightedCandidateIndex=null;return}this.candidates=engine.getCandidates(this.pinyinInput).candidates;let maxPage=Math.max(0,Math.ceil(this.candidates.length/this.pageSize)-1);this.page>maxPage&&(this.page=maxPage),this.updateMissPrefixLock(this.pinyinInput),this.syncHighlightedCandidate();}selectCandidate(item){this.cancelScheduledRecompute();let engine=this.options.getEngine();if(!engine)return;this.insertText(item.word);let len=engine.computeMatchedLength(item.word,this.pinyinInput,item.matchedLength),remaining=this.pinyinInput.substring(len),nextInput=remaining.startsWith("'")?remaining.substring(1):remaining;this.pinyinInput=nextInput,this.collapsePinyinSelection(nextInput.length),this.clearMissPrefixLock(),this.recomputeCandidates(),this.page=0,this.highlightedCandidateIndex=this.candidates.length>0?0:null,this.emit();}addPage(delta){this.setPage(p3=>Math.max(0,p3+delta));}setPage(updater){let next=updater(this.page),maxPage=Math.max(0,Math.ceil(this.candidates.length/this.pageSize)-1);this.page=Math.min(maxPage,Math.max(0,next)),this.highlightedCandidateIndex=this.candidates.length>0?Math.min(this.page*this.pageSize,this.candidates.length-1):null,this.emit();}insertText(text){let el=this.options.getElement();if(!el)return;let start=el.selectionStart??0,end=el.selectionEnd??start,currentVal=String(this.options.getValue()||""),newValue=currentVal.substring(0,start)+text+currentVal.substring(end);this.options.onValueChange(newValue),requestAnimationFrame(()=>{el.selectionStart=el.selectionEnd=start+text.length,el.focus();});}commitPinyinBufferAsRaw(){this.insertText(this.pinyinInput),this.pinyinInput="",this.collapsePinyinSelection(0),this.clearMissPrefixLock(),this.recomputeCandidates(),this.emit();}resetShiftGestureState(){this.shiftPhysicalDown=0,this.shiftGestureOtherKeySeen=false;}handleBeforeInput(e5){if(this.options.enabled===false||e5.inputType==="insertFromPaste"||e5.inputType==="insertFromDrop"||e5.inputType==="insertCompositionText"||e5.inputType==="insertFromComposition"||e5.inputType!=="insertText"||!e5.data||e5.data.length!==1)return;let d3=e5.data;if(this.pinyinInput.length>0){if(d3===" "){e5.preventDefault();return}if(isDigitSelectKey(d3,this.pageSize)){e5.preventDefault();return}if(/^[=\-.,]$/.test(d3)){e5.preventDefault();return}}this.chineseMode&&/^[a-zA-Z']$/.test(d3)&&e5.preventDefault();}handleKeyUp(e5){if(this.options.enabled===false||!isPhysicalShiftKeyEvent(e5)||this.shiftPhysicalDown===0||(this.shiftPhysicalDown-=1,this.shiftPhysicalDown>0))return;let solo=!this.shiftGestureOtherKeySeen;this.shiftGestureOtherKeySeen=false,solo&&(e5.preventDefault(),this.pinyinInput.length>0?this.commitPinyinBufferAsRaw():(this.chineseMode=!this.chineseMode,this.emit()));}handleKeyDown(e5){if(this.options.enabled===false){this.options.onKeyDown?.(e5);return}if(isPhysicalShiftKeyEvent(e5)){this.shiftPhysicalDown===0&&(this.shiftGestureOtherKeySeen=false),this.shiftPhysicalDown++,this.options.onKeyDown?.(e5);return}if(this.shiftPhysicalDown>0&&(this.shiftGestureOtherKeySeen=true),this.pinyinInput.length>0&&isPagingOrControlSymbolKey(e5)&&(e5.preventDefault(),e5.stopPropagation()),this.pinyinInput.length>0){if(e5.key.toLowerCase()==="a"&&e5.ctrlKey&&!e5.altKey&&!e5.metaKey){e5.preventDefault(),this.setPinyinSelection(0,this.pinyinInput.length),this.emit();return}if(/^[a-z']$/i.test(e5.key)||this.flushRecomputeAndEmit(),e5.key==="Backspace"){if(e5.preventDefault(),this.deleteSelectedPinyin()){this.scheduleRecomputeAndEmit();return}this.pinyinCursorPosition>0&&(this.setPinyinSelection(this.pinyinCursorPosition-1,this.pinyinCursorPosition),this.deleteSelectedPinyin(),this.scheduleRecomputeAndEmit());return}if(e5.key==="Delete"){if(e5.preventDefault(),this.deleteSelectedPinyin()){this.scheduleRecomputeAndEmit();return}this.pinyinCursorPosition<this.pinyinInput.length&&(this.setPinyinSelection(this.pinyinCursorPosition,this.pinyinCursorPosition+1),this.deleteSelectedPinyin(),this.scheduleRecomputeAndEmit());return}if(e5.key==="ArrowLeft"){e5.preventDefault();let nextCursor=this.pinyinCursorPosition>0?this.pinyinCursorPosition-1:this.pinyinInput.length;if(e5.shiftKey){let anchor=this.hasPinyinSelection()?this.pinyinSelectionStart:this.pinyinCursorPosition;this.setPinyinSelection(anchor,nextCursor);}else this.collapsePinyinSelection(nextCursor);this.emit();return}if(e5.key==="ArrowRight"){e5.preventDefault();let nextCursor=this.pinyinCursorPosition<this.pinyinInput.length?this.pinyinCursorPosition+1:0;if(e5.shiftKey){let anchor=this.hasPinyinSelection()?this.pinyinSelectionEnd:this.pinyinCursorPosition;this.setPinyinSelection(anchor,nextCursor);}else this.collapsePinyinSelection(nextCursor);this.emit();return}if(e5.key==="ArrowDown"){if(e5.preventDefault(),this.candidates.length>0){let current=this.highlightedCandidateIndex??this.page*this.pageSize,next=Math.min(this.candidates.length-1,current+1);this.highlightedCandidateIndex=next,this.page=Math.floor(next/this.pageSize),this.emit();}return}if(e5.key==="ArrowUp"){if(e5.preventDefault(),this.candidates.length>0){let current=this.highlightedCandidateIndex??this.page*this.pageSize,next=Math.max(0,current-1);this.highlightedCandidateIndex=next,this.page=Math.floor(next/this.pageSize),this.emit();}return}if(e5.key==="Enter"){e5.preventDefault(),this.commitPinyinBufferAsRaw();return}if(e5.key==="Escape"){e5.preventDefault(),this.pinyinInput="",this.collapsePinyinSelection(0),this.clearMissPrefixLock(),this.recomputeCandidates(),this.emit();return}if(e5.key===" "){if(e5.preventDefault(),this.candidates.length>0){let index=this.highlightedCandidateIndex??this.page*this.pageSize,clamped=Math.min(Math.max(0,index),this.candidates.length-1);this.selectCandidate(this.candidates[clamped]);}else this.insertText(this.pinyinInput),this.pinyinInput="",this.collapsePinyinSelection(0),this.clearMissPrefixLock(),this.recomputeCandidates(),this.emit();return}if(isDigitSelectKey(e5.key,this.pageSize)){e5.preventDefault();let index=parseInt(e5.key,10)-1,globalIndex=this.page*this.pageSize+index;globalIndex<this.candidates.length&&this.selectCandidate(this.candidates[globalIndex]);return}if(isNextPageKey(e5)){(this.page+1)*this.pageSize<this.candidates.length&&this.setPage(p3=>p3+1);return}if(isPrevPageKey(e5)){this.page>0&&this.setPage(p3=>p3-1);return}}if(this.chineseMode&&/^[a-z']$/i.test(e5.key)&&!e5.ctrlKey&&!e5.altKey&&!e5.metaKey){e5.preventDefault(),e5.stopPropagation();let ch=e5.key.toLowerCase();this.replacePinyinSelection(ch),this.scheduleRecomputeAndEmit();return}this.pinyinInput.length>0&&isPagingOrControlSymbolKey(e5)||this.options.onKeyDown?.(e5);}};var ElementInternalsShim=class{get shadowRoot(){return this.__host.__shadowRoot}constructor(_host){this.ariaActiveDescendantElement=null,this.ariaAtomic="",this.ariaAutoComplete="",this.ariaBrailleLabel="",this.ariaBrailleRoleDescription="",this.ariaBusy="",this.ariaChecked="",this.ariaColCount="",this.ariaColIndex="",this.ariaColIndexText="",this.ariaColSpan="",this.ariaControlsElements=null,this.ariaCurrent="",this.ariaDescribedByElements=null,this.ariaDescription="",this.ariaDetailsElements=null,this.ariaDisabled="",this.ariaErrorMessageElements=null,this.ariaExpanded="",this.ariaFlowToElements=null,this.ariaHasPopup="",this.ariaHidden="",this.ariaInvalid="",this.ariaKeyShortcuts="",this.ariaLabel="",this.ariaLabelledByElements=null,this.ariaLevel="",this.ariaLive="",this.ariaModal="",this.ariaMultiLine="",this.ariaMultiSelectable="",this.ariaOrientation="",this.ariaOwnsElements=null,this.ariaPlaceholder="",this.ariaPosInSet="",this.ariaPressed="",this.ariaReadOnly="",this.ariaRelevant="",this.ariaRequired="",this.ariaRoleDescription="",this.ariaRowCount="",this.ariaRowIndex="",this.ariaRowIndexText="",this.ariaRowSpan="",this.ariaSelected="",this.ariaSetSize="",this.ariaSort="",this.ariaValueMax="",this.ariaValueMin="",this.ariaValueNow="",this.ariaValueText="",this.role="",this.form=null,this.labels=[],this.states=new Set,this.validationMessage="",this.validity={},this.willValidate=true,this.__host=_host;}checkValidity(){return console.warn("`ElementInternals.checkValidity()` was called on the server.This method always returns true."),true}reportValidity(){return true}setFormValue(){}setValidity(){}};var __classPrivateFieldSet=function(receiver,state,value,kind,f4){if(typeof state=="function"?receiver!==state||true:!state.has(receiver))throw new TypeError("Cannot write private member to an object whose class did not declare it");return state.set(receiver,value),value},__classPrivateFieldGet=function(receiver,state,kind,f4){if(typeof state=="function"?receiver!==state||!f4:!state.has(receiver))throw new TypeError("Cannot read private member from an object whose class did not declare it");return kind==="m"?f4:kind==="a"?f4.call(receiver):f4?f4.value:state.get(receiver)},_Event_cancelable,_Event_bubbles,_Event_composed,_Event_defaultPrevented,_Event_timestamp,_Event_propagationStopped,_Event_type,_Event_target,_Event_isBeingDispatched,_a,_CustomEvent_detail,_b,isCaptureEventListener=options=>typeof options=="boolean"?options:options?.capture??false;var EventTarget=class{constructor(){this.__eventListeners=new Map,this.__captureEventListeners=new Map;}addEventListener(type,callback,options){if(callback==null)return;let eventListenersMap=isCaptureEventListener(options)?this.__captureEventListeners:this.__eventListeners,eventListeners=eventListenersMap.get(type);if(eventListeners===void 0)eventListeners=new Map,eventListenersMap.set(type,eventListeners);else if(eventListeners.has(callback))return;let normalizedOptions=typeof options=="object"&&options?options:{};normalizedOptions.signal?.addEventListener("abort",()=>this.removeEventListener(type,callback,options)),eventListeners.set(callback,normalizedOptions??{});}removeEventListener(type,callback,options){if(callback==null)return;let eventListenersMap=isCaptureEventListener(options)?this.__captureEventListeners:this.__eventListeners,eventListeners=eventListenersMap.get(type);eventListeners!==void 0&&(eventListeners.delete(callback),eventListeners.size||eventListenersMap.delete(type));}dispatchEvent(event){let composedPath=[this],parent=this.__eventTargetParent;if(event.composed)for(;parent;)composedPath.push(parent),parent=parent.__eventTargetParent;else for(;parent&&parent!==this.__host;)composedPath.push(parent),parent=parent.__eventTargetParent;let stopPropagation=false,stopImmediatePropagation=false,eventPhase=0,target=null,tmpTarget=null,currentTarget=null,originalStopPropagation=event.stopPropagation,originalStopImmediatePropagation=event.stopImmediatePropagation;Object.defineProperties(event,{target:{get(){return target??tmpTarget},...enumerableProperty},srcElement:{get(){return event.target},...enumerableProperty},currentTarget:{get(){return currentTarget},...enumerableProperty},eventPhase:{get(){return eventPhase},...enumerableProperty},composedPath:{value:()=>composedPath,...enumerableProperty},stopPropagation:{value:()=>{stopPropagation=true,originalStopPropagation.call(event);},...enumerableProperty},stopImmediatePropagation:{value:()=>{stopImmediatePropagation=true,originalStopImmediatePropagation.call(event);},...enumerableProperty}});let invokeEventListener=(listener,options,eventListenerMap)=>{typeof listener=="function"?listener(event):typeof listener?.handleEvent=="function"&&listener.handleEvent(event),options.once&&eventListenerMap.delete(listener);},finishDispatch=()=>(currentTarget=null,eventPhase=0,!event.defaultPrevented),captureEventPath=composedPath.slice().reverse();target=!this.__host||!event.composed?this:null;let retarget=eventTargets=>{for(tmpTarget=this;tmpTarget.__host&&eventTargets.includes(tmpTarget.__host);)tmpTarget=tmpTarget.__host;};for(let eventTarget of captureEventPath){!target&&(!tmpTarget||tmpTarget===eventTarget.__host)&&retarget(captureEventPath.slice(captureEventPath.indexOf(eventTarget))),currentTarget=eventTarget,eventPhase=eventTarget===event.target?2:1;let captureEventListeners=eventTarget.__captureEventListeners.get(event.type);if(captureEventListeners){for(let[listener,options]of captureEventListeners)if(invokeEventListener(listener,options,captureEventListeners),stopImmediatePropagation)return finishDispatch()}if(stopPropagation)return finishDispatch()}let bubbleEventPath=event.bubbles?composedPath:[this];tmpTarget=null;for(let eventTarget of bubbleEventPath){!target&&(!tmpTarget||eventTarget===tmpTarget.__host)&&retarget(bubbleEventPath.slice(0,bubbleEventPath.indexOf(eventTarget)+1)),currentTarget=eventTarget,eventPhase=eventTarget===event.target?2:3;let captureEventListeners=eventTarget.__eventListeners.get(event.type);if(captureEventListeners){for(let[listener,options]of captureEventListeners)if(invokeEventListener(listener,options,captureEventListeners),stopImmediatePropagation)return finishDispatch()}if(stopPropagation)return finishDispatch()}return finishDispatch()}},EventTargetShimWithRealType=EventTarget;var enumerableProperty={__proto__:null};enumerableProperty.enumerable=true;Object.freeze(enumerableProperty);var EventShim=(_a=class{constructor(type,options={}){if(_Event_cancelable.set(this,false),_Event_bubbles.set(this,false),_Event_composed.set(this,false),_Event_defaultPrevented.set(this,false),_Event_timestamp.set(this,Date.now()),_Event_propagationStopped.set(this,false),_Event_type.set(this,void 0),_Event_target.set(this,void 0),_Event_isBeingDispatched.set(this,void 0),this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,arguments.length===0)throw new Error("The type argument must be specified");if(typeof options!="object"||!options)throw new Error('The "options" argument must be an object');let{bubbles,cancelable,composed}=options;__classPrivateFieldSet(this,_Event_cancelable,!!cancelable),__classPrivateFieldSet(this,_Event_bubbles,!!bubbles),__classPrivateFieldSet(this,_Event_composed,!!composed),__classPrivateFieldSet(this,_Event_type,`${type}`),__classPrivateFieldSet(this,_Event_target,null),__classPrivateFieldSet(this,_Event_isBeingDispatched,false);}initEvent(_type,_bubbles,_cancelable){throw new Error("Method not implemented.")}stopImmediatePropagation(){this.stopPropagation();}preventDefault(){__classPrivateFieldSet(this,_Event_defaultPrevented,true);}get target(){return __classPrivateFieldGet(this,_Event_target,"f")}get currentTarget(){return __classPrivateFieldGet(this,_Event_target,"f")}get srcElement(){return __classPrivateFieldGet(this,_Event_target,"f")}get type(){return __classPrivateFieldGet(this,_Event_type,"f")}get cancelable(){return __classPrivateFieldGet(this,_Event_cancelable,"f")}get defaultPrevented(){return __classPrivateFieldGet(this,_Event_cancelable,"f")&&__classPrivateFieldGet(this,_Event_defaultPrevented,"f")}get timeStamp(){return __classPrivateFieldGet(this,_Event_timestamp,"f")}composedPath(){return __classPrivateFieldGet(this,_Event_isBeingDispatched,"f")?[__classPrivateFieldGet(this,_Event_target,"f")]:[]}get returnValue(){return !__classPrivateFieldGet(this,_Event_cancelable,"f")||!__classPrivateFieldGet(this,_Event_defaultPrevented,"f")}get bubbles(){return __classPrivateFieldGet(this,_Event_bubbles,"f")}get composed(){return __classPrivateFieldGet(this,_Event_composed,"f")}get eventPhase(){return __classPrivateFieldGet(this,_Event_isBeingDispatched,"f")?_a.AT_TARGET:_a.NONE}get cancelBubble(){return __classPrivateFieldGet(this,_Event_propagationStopped,"f")}set cancelBubble(value){value&&__classPrivateFieldSet(this,_Event_propagationStopped,true);}stopPropagation(){__classPrivateFieldSet(this,_Event_propagationStopped,true);}get isTrusted(){return false}},_Event_cancelable=new WeakMap,_Event_bubbles=new WeakMap,_Event_composed=new WeakMap,_Event_defaultPrevented=new WeakMap,_Event_timestamp=new WeakMap,_Event_propagationStopped=new WeakMap,_Event_type=new WeakMap,_Event_target=new WeakMap,_Event_isBeingDispatched=new WeakMap,_a.NONE=0,_a.CAPTURING_PHASE=1,_a.AT_TARGET=2,_a.BUBBLING_PHASE=3,_a);Object.defineProperties(EventShim.prototype,{initEvent:enumerableProperty,stopImmediatePropagation:enumerableProperty,preventDefault:enumerableProperty,target:enumerableProperty,currentTarget:enumerableProperty,srcElement:enumerableProperty,type:enumerableProperty,cancelable:enumerableProperty,defaultPrevented:enumerableProperty,timeStamp:enumerableProperty,composedPath:enumerableProperty,returnValue:enumerableProperty,bubbles:enumerableProperty,composed:enumerableProperty,eventPhase:enumerableProperty,cancelBubble:enumerableProperty,stopPropagation:enumerableProperty,isTrusted:enumerableProperty});var CustomEventShim=(_b=class extends EventShim{constructor(type,options={}){super(type,options),_CustomEvent_detail.set(this,void 0),__classPrivateFieldSet(this,_CustomEvent_detail,options?.detail??null);}initCustomEvent(_type,_bubbles,_cancelable,_detail){throw new Error("Method not implemented.")}get detail(){return __classPrivateFieldGet(this,_CustomEvent_detail,"f")}},_CustomEvent_detail=new WeakMap,_b);Object.defineProperties(CustomEventShim.prototype,{detail:enumerableProperty});var EventShimWithRealType=EventShim,CustomEventShimWithRealType=CustomEventShim;var _a2;(_a2=class{constructor(){this.STYLE_RULE=1,this.CHARSET_RULE=2,this.IMPORT_RULE=3,this.MEDIA_RULE=4,this.FONT_FACE_RULE=5,this.PAGE_RULE=6,this.NAMESPACE_RULE=10,this.KEYFRAMES_RULE=7,this.KEYFRAME_RULE=8,this.SUPPORTS_RULE=12,this.COUNTER_STYLE_RULE=11,this.FONT_FEATURE_VALUES_RULE=14,this.__parentStyleSheet=null,this.cssText="";}get parentRule(){return null}get parentStyleSheet(){return this.__parentStyleSheet}get type(){return 0}},_a2.STYLE_RULE=1,_a2.CHARSET_RULE=2,_a2.IMPORT_RULE=3,_a2.MEDIA_RULE=4,_a2.FONT_FACE_RULE=5,_a2.PAGE_RULE=6,_a2.NAMESPACE_RULE=10,_a2.KEYFRAMES_RULE=7,_a2.KEYFRAME_RULE=8,_a2.SUPPORTS_RULE=12,_a2.COUNTER_STYLE_RULE=11,_a2.FONT_FEATURE_VALUES_RULE=14,_a2);globalThis.Event??=EventShimWithRealType;globalThis.CustomEvent??=CustomEventShimWithRealType;var attributes=new WeakMap,attributesForElement=element=>{let attrs=attributes.get(element);return attrs===void 0&&attributes.set(element,attrs=new Map),attrs},ElementShim=class extends EventTargetShimWithRealType{constructor(){super(...arguments),this.__shadowRootMode=null,this.__shadowRoot=null,this.__internals=null;}get attributes(){return Array.from(attributesForElement(this)).map(([name,value])=>({name,value}))}get shadowRoot(){return this.__shadowRootMode==="closed"?null:this.__shadowRoot}get localName(){return this.constructor.__localName}get tagName(){return this.localName?.toUpperCase()}setAttribute(name,value){attributesForElement(this).set(name,String(value));}removeAttribute(name){attributesForElement(this).delete(name);}toggleAttribute(name,force){if(this.hasAttribute(name)){if(force===void 0||!force)return this.removeAttribute(name),false}else return force===void 0||force?(this.setAttribute(name,""),true):false;return true}hasAttribute(name){return attributesForElement(this).has(name)}attachShadow(init){let shadowRoot={host:this};return this.__shadowRootMode=init.mode,init&&init.mode==="open"&&(this.__shadowRoot=shadowRoot),shadowRoot}attachInternals(){if(this.__internals!==null)throw new Error("Failed to execute 'attachInternals' on 'HTMLElement': ElementInternals for the specified element was already attached.");let internals=new ElementInternalsShim(this);return this.__internals=internals,internals}getAttribute(name){return attributesForElement(this).get(name)??null}};var HTMLElementShim=class extends ElementShim{},HTMLElementShimWithRealType=HTMLElementShim;globalThis.litServerRoot??=Object.defineProperty(new HTMLElementShimWithRealType,"localName",{get(){return "lit-server-root"}});function promiseWithResolvers(){let resolve,reject;return {promise:new Promise((res,rej)=>{resolve=res,reject=rej;}),resolve,reject}}var CustomElementRegistry=class{constructor(){this.__definitions=new Map,this.__reverseDefinitions=new Map,this.__pendingWhenDefineds=new Map;}define(name,ctor){if(this.__definitions.has(name))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the name "${name}" has already been used with this registry`);if(this.__reverseDefinitions.has(ctor))throw new Error(`Failed to execute 'define' on 'CustomElementRegistry': the constructor has already been used with this registry for the tag name ${this.__reverseDefinitions.get(ctor)}`);ctor.__localName=name,this.__definitions.set(name,{ctor,observedAttributes:ctor.observedAttributes??[]}),this.__reverseDefinitions.set(ctor,name),this.__pendingWhenDefineds.get(name)?.resolve(ctor),this.__pendingWhenDefineds.delete(name);}get(name){return this.__definitions.get(name)?.ctor}getName(ctor){return this.__reverseDefinitions.get(ctor)??null}upgrade(_element){throw new Error("customElements.upgrade is not currently supported in SSR. Please file a bug if you need it.")}async whenDefined(name){let definition=this.__definitions.get(name);if(definition)return definition.ctor;let withResolvers=this.__pendingWhenDefineds.get(name);return withResolvers||(withResolvers=promiseWithResolvers(),this.__pendingWhenDefineds.set(name,withResolvers)),withResolvers.promise}},CustomElementRegistryShimWithRealType=CustomElementRegistry;var customElements2=new CustomElementRegistryShimWithRealType;var t=globalThis,e=t.ShadowRoot&&(t.ShadyCSS===void 0||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),o=new WeakMap,n=class{constructor(t5,e5,o7){if(this._$cssResult$=true,o7!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t5,this.t=e5;}get styleSheet(){let t5=this.o,s5=this.t;if(e&&t5===void 0){let e5=s5!==void 0&&s5.length===1;e5&&(t5=o.get(s5)),t5===void 0&&((this.o=t5=new CSSStyleSheet).replaceSync(this.cssText),e5&&o.set(s5,t5));}return t5}toString(){return this.cssText}},r=t5=>new n(typeof t5=="string"?t5:t5+"",void 0,s);var S=(s5,o7)=>{if(e)s5.adoptedStyleSheets=o7.map(t5=>t5 instanceof CSSStyleSheet?t5:t5.styleSheet);else for(let e5 of o7){let o8=document.createElement("style"),n6=t.litNonce;n6!==void 0&&o8.setAttribute("nonce",n6),o8.textContent=e5.cssText,s5.appendChild(o8);}},c=e||t.CSSStyleSheet===void 0?t5=>t5:t5=>t5 instanceof CSSStyleSheet?(t6=>{let e5="";for(let s5 of t6.cssRules)e5+=s5.cssText;return r(e5)})(t5):t5;var{is:h,defineProperty:r2,getOwnPropertyDescriptor:o2,getOwnPropertyNames:n2,getOwnPropertySymbols:a,getPrototypeOf:c2}=Object,l=globalThis;l.customElements??=customElements2;var p=l.trustedTypes,d=p?p.emptyScript:"",u=l.reactiveElementPolyfillSupport,f=(t5,s5)=>t5,b={toAttribute(t5,s5){switch(s5){case Boolean:t5=t5?d:null;break;case Object:case Array:t5=t5==null?t5:JSON.stringify(t5);}return t5},fromAttribute(t5,s5){let i5=t5;switch(s5){case Boolean:i5=t5!==null;break;case Number:i5=t5===null?null:Number(t5);break;case Object:case Array:try{i5=JSON.parse(t5);}catch{i5=null;}}return i5}},m=(t5,s5)=>!h(t5,s5),y={attribute:true,type:String,converter:b,reflect:false,useDefault:false,hasChanged:m};Symbol.metadata??=Symbol("metadata"),l.litPropertyMetadata??=new WeakMap;var g=class extends(globalThis.HTMLElement??HTMLElementShimWithRealType){static addInitializer(t5){this._$Ei(),(this.l??=[]).push(t5);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t5,s5=y){if(s5.state&&(s5.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(t5)&&((s5=Object.create(s5)).wrapped=true),this.elementProperties.set(t5,s5),!s5.noAccessor){let i5=Symbol(),e5=this.getPropertyDescriptor(t5,i5,s5);e5!==void 0&&r2(this.prototype,t5,e5);}}static getPropertyDescriptor(t5,s5,i5){let{get:e5,set:h5}=o2(this.prototype,t5)??{get(){return this[s5]},set(t6){this[s5]=t6;}};return {get:e5,set(s6){let r6=e5?.call(this);h5?.call(this,s6),this.requestUpdate(t5,r6,i5);},configurable:true,enumerable:true}}static getPropertyOptions(t5){return this.elementProperties.get(t5)??y}static _$Ei(){if(this.hasOwnProperty(f("elementProperties")))return;let t5=c2(this);t5.finalize(),t5.l!==void 0&&(this.l=[...t5.l]),this.elementProperties=new Map(t5.elementProperties);}static finalize(){if(this.hasOwnProperty(f("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(f("properties"))){let t6=this.properties,s5=[...n2(t6),...a(t6)];for(let i5 of s5)this.createProperty(i5,t6[i5]);}let t5=this[Symbol.metadata];if(t5!==null){let s5=litPropertyMetadata.get(t5);if(s5!==void 0)for(let[t6,i5]of s5)this.elementProperties.set(t6,i5);}this._$Eh=new Map;for(let[t6,s5]of this.elementProperties){let i5=this._$Eu(t6,s5);i5!==void 0&&this._$Eh.set(i5,t6);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(t5){let s5=[];if(Array.isArray(t5)){let e5=new Set(t5.flat(1/0).reverse());for(let t6 of e5)s5.unshift(c(t6));}else t5!==void 0&&s5.push(c(t5));return s5}static _$Eu(t5,s5){let i5=s5.attribute;return i5===false?void 0:typeof i5=="string"?i5:typeof t5=="string"?t5.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise(t5=>this.enableUpdating=t5),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t5=>t5(this));}addController(t5){(this._$EO??=new Set).add(t5),this.renderRoot!==void 0&&this.isConnected&&t5.hostConnected?.();}removeController(t5){this._$EO?.delete(t5);}_$E_(){let t5=new Map,s5=this.constructor.elementProperties;for(let i5 of s5.keys())this.hasOwnProperty(i5)&&(t5.set(i5,this[i5]),delete this[i5]);t5.size>0&&(this._$Ep=t5);}createRenderRoot(){let t5=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return S(t5,this.constructor.elementStyles),t5}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach(t5=>t5.hostConnected?.());}enableUpdating(t5){}disconnectedCallback(){this._$EO?.forEach(t5=>t5.hostDisconnected?.());}attributeChangedCallback(t5,s5,i5){this._$AK(t5,i5);}_$ET(t5,s5){let i5=this.constructor.elementProperties.get(t5),e5=this.constructor._$Eu(t5,i5);if(e5!==void 0&&i5.reflect===true){let h5=(i5.converter?.toAttribute!==void 0?i5.converter:b).toAttribute(s5,i5.type);this._$Em=t5,h5==null?this.removeAttribute(e5):this.setAttribute(e5,h5),this._$Em=null;}}_$AK(t5,s5){let i5=this.constructor,e5=i5._$Eh.get(t5);if(e5!==void 0&&this._$Em!==e5){let t6=i5.getPropertyOptions(e5),h5=typeof t6.converter=="function"?{fromAttribute:t6.converter}:t6.converter?.fromAttribute!==void 0?t6.converter:b;this._$Em=e5;let r6=h5.fromAttribute(s5,t6.type);this[e5]=r6??this._$Ej?.get(e5)??r6,this._$Em=null;}}requestUpdate(t5,s5,i5,e5=false,h5){if(t5!==void 0){let r6=this.constructor;if(e5===false&&(h5=this[t5]),i5??=r6.getPropertyOptions(t5),!((i5.hasChanged??m)(h5,s5)||i5.useDefault&&i5.reflect&&h5===this._$Ej?.get(t5)&&!this.hasAttribute(r6._$Eu(t5,i5))))return;this.C(t5,s5,i5);}this.isUpdatePending===false&&(this._$ES=this._$EP());}C(t5,s5,{useDefault:i5,reflect:e5,wrapped:h5},r6){i5&&!(this._$Ej??=new Map).has(t5)&&(this._$Ej.set(t5,r6??s5??this[t5]),h5!==true||r6!==void 0)||(this._$AL.has(t5)||(this.hasUpdated||i5||(s5=void 0),this._$AL.set(t5,s5)),e5===true&&this._$Em!==t5&&(this._$Eq??=new Set).add(t5));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(t6){Promise.reject(t6);}let t5=this.scheduleUpdate();return t5!=null&&await t5,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[t7,s6]of this._$Ep)this[t7]=s6;this._$Ep=void 0;}let t6=this.constructor.elementProperties;if(t6.size>0)for(let[s6,i5]of t6){let{wrapped:t7}=i5,e5=this[s6];t7!==true||this._$AL.has(s6)||e5===void 0||this.C(s6,void 0,i5,e5);}}let t5=false,s5=this._$AL;try{t5=this.shouldUpdate(s5),t5?(this.willUpdate(s5),this._$EO?.forEach(t6=>t6.hostUpdate?.()),this.update(s5)):this._$EM();}catch(s6){throw t5=false,this._$EM(),s6}t5&&this._$AE(s5);}willUpdate(t5){}_$AE(t5){this._$EO?.forEach(t6=>t6.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t5)),this.updated(t5);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t5){return true}update(t5){this._$Eq&&=this._$Eq.forEach(t6=>this._$ET(t6,this[t6])),this._$EM();}updated(t5){}firstUpdated(t5){}};g.elementStyles=[],g.shadowRootOptions={mode:"open"},g[f("elementProperties")]=new Map,g[f("finalized")]=new Map,u?.({ReactiveElement:g}),(l.reactiveElementVersions??=[]).push("2.1.2");var t2=globalThis,i2=t5=>t5,s2=t2.trustedTypes,e2=s2?s2.createPolicy("lit-html",{createHTML:t5=>t5}):void 0,h2="$lit$",o3=`lit$${Math.random().toFixed(9).slice(2)}$`,n3="?"+o3,r3=`<${n3}>`,l2=t2.document===void 0?{createTreeWalker:()=>({})}:document,c3=()=>l2.createComment(""),a2=t5=>t5===null||typeof t5!="object"&&typeof t5!="function",u2=Array.isArray,d2=t5=>u2(t5)||typeof t5?.[Symbol.iterator]=="function",f2=`[
2
2
  \f\r]`,v=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_=/-->/g,m2=/>/g,p2=RegExp(`>|${f2}(?:([^\\s"'>=/]+)(${f2}*=${f2}*(?:[^
3
3
  \f\r"'\`<>=]|("|')|))|$)`,"g"),g2=/'/g,$=/"/g,y2=/^(?:script|style|textarea|title)$/i,x=t5=>(i5,...s5)=>({_$litType$:t5,strings:i5,values:s5}),T=x(1),E=Symbol.for("lit-noChange"),A=Symbol.for("lit-nothing"),C=new WeakMap,P=l2.createTreeWalker(l2,129);function V(t5,i5){if(!u2(t5)||!t5.hasOwnProperty("raw"))throw Error("invalid template strings array");return e2!==void 0?e2.createHTML(i5):i5}var N=(t5,i5)=>{let s5=t5.length-1,e5=[],n6,l3=i5===2?"<svg>":i5===3?"<math>":"",c5=v;for(let i6=0;i6<s5;i6++){let s6=t5[i6],a3,u3,d3=-1,f4=0;for(;f4<s6.length&&(c5.lastIndex=f4,u3=c5.exec(s6),u3!==null);)f4=c5.lastIndex,c5===v?u3[1]==="!--"?c5=_:u3[1]!==void 0?c5=m2:u3[2]!==void 0?(y2.test(u3[2])&&(n6=RegExp("</"+u3[2],"g")),c5=p2):u3[3]!==void 0&&(c5=p2):c5===p2?u3[0]===">"?(c5=n6??v,d3=-1):u3[1]===void 0?d3=-2:(d3=c5.lastIndex-u3[2].length,a3=u3[1],c5=u3[3]===void 0?p2:u3[3]==='"'?$:g2):c5===$||c5===g2?c5=p2:c5===_||c5===m2?c5=v:(c5=p2,n6=void 0);let x2=c5===p2&&t5[i6+1].startsWith("/>")?" ":"";l3+=c5===v?s6+r3:d3>=0?(e5.push(a3),s6.slice(0,d3)+h2+s6.slice(d3)+o3+x2):s6+o3+(d3===-2?i6:x2);}return [V(t5,l3+(t5[s5]||"<?>")+(i5===2?"</svg>":i5===3?"</math>":"")),e5]},S2=class _S{constructor({strings:t5,_$litType$:i5},e5){let r6;this.parts=[];let l3=0,a3=0,u3=t5.length-1,d3=this.parts,[f4,v2]=N(t5,i5);if(this.el=_S.createElement(f4,e5),P.currentNode=this.el.content,i5===2||i5===3){let t6=this.el.content.firstChild;t6.replaceWith(...t6.childNodes);}for(;(r6=P.nextNode())!==null&&d3.length<u3;){if(r6.nodeType===1){if(r6.hasAttributes())for(let t6 of r6.getAttributeNames())if(t6.endsWith(h2)){let i6=v2[a3++],s5=r6.getAttribute(t6).split(o3),e6=/([.?@])?(.*)/.exec(i6);d3.push({type:1,index:l3,name:e6[2],strings:s5,ctor:e6[1]==="."?I:e6[1]==="?"?L:e6[1]==="@"?z:H}),r6.removeAttribute(t6);}else t6.startsWith(o3)&&(d3.push({type:6,index:l3}),r6.removeAttribute(t6));if(y2.test(r6.tagName)){let t6=r6.textContent.split(o3),i6=t6.length-1;if(i6>0){r6.textContent=s2?s2.emptyScript:"";for(let s5=0;s5<i6;s5++)r6.append(t6[s5],c3()),P.nextNode(),d3.push({type:2,index:++l3});r6.append(t6[i6],c3());}}}else if(r6.nodeType===8)if(r6.data===n3)d3.push({type:2,index:l3});else {let t6=-1;for(;(t6=r6.data.indexOf(o3,t6+1))!==-1;)d3.push({type:7,index:l3}),t6+=o3.length-1;}l3++;}}static createElement(t5,i5){let s5=l2.createElement("template");return s5.innerHTML=t5,s5}};function M(t5,i5,s5=t5,e5){if(i5===E)return i5;let h5=e5!==void 0?s5._$Co?.[e5]:s5._$Cl,o7=a2(i5)?void 0:i5._$litDirective$;return h5?.constructor!==o7&&(h5?._$AO?.(false),o7===void 0?h5=void 0:(h5=new o7(t5),h5._$AT(t5,s5,e5)),e5!==void 0?(s5._$Co??=[])[e5]=h5:s5._$Cl=h5),h5!==void 0&&(i5=M(t5,h5._$AS(t5,i5.values),h5,e5)),i5}var k=class{constructor(t5,i5){this._$AV=[],this._$AN=void 0,this._$AD=t5,this._$AM=i5;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t5){let{el:{content:i5},parts:s5}=this._$AD,e5=(t5?.creationScope??l2).importNode(i5,true);P.currentNode=e5;let h5=P.nextNode(),o7=0,n6=0,r6=s5[0];for(;r6!==void 0;){if(o7===r6.index){let i6;r6.type===2?i6=new R(h5,h5.nextSibling,this,t5):r6.type===1?i6=new r6.ctor(h5,r6.name,r6.strings,this,t5):r6.type===6&&(i6=new W(h5,this,t5)),this._$AV.push(i6),r6=s5[++n6];}o7!==r6?.index&&(h5=P.nextNode(),o7++);}return P.currentNode=l2,e5}p(t5){let i5=0;for(let s5 of this._$AV)s5!==void 0&&(s5.strings!==void 0?(s5._$AI(t5,s5,i5),i5+=s5.strings.length-2):s5._$AI(t5[i5])),i5++;}},R=class _R{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t5,i5,s5,e5){this.type=2,this._$AH=A,this._$AN=void 0,this._$AA=t5,this._$AB=i5,this._$AM=s5,this.options=e5,this._$Cv=e5?.isConnected??true;}get parentNode(){let t5=this._$AA.parentNode,i5=this._$AM;return i5!==void 0&&t5?.nodeType===11&&(t5=i5.parentNode),t5}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t5,i5=this){t5=M(this,t5,i5),a2(t5)?t5===A||t5==null||t5===""?(this._$AH!==A&&this._$AR(),this._$AH=A):t5!==this._$AH&&t5!==E&&this._(t5):t5._$litType$!==void 0?this.$(t5):t5.nodeType!==void 0?this.T(t5):d2(t5)?this.k(t5):this._(t5);}O(t5){return this._$AA.parentNode.insertBefore(t5,this._$AB)}T(t5){this._$AH!==t5&&(this._$AR(),this._$AH=this.O(t5));}_(t5){this._$AH!==A&&a2(this._$AH)?this._$AA.nextSibling.data=t5:this.T(l2.createTextNode(t5)),this._$AH=t5;}$(t5){let{values:i5,_$litType$:s5}=t5,e5=typeof s5=="number"?this._$AC(t5):(s5.el===void 0&&(s5.el=S2.createElement(V(s5.h,s5.h[0]),this.options)),s5);if(this._$AH?._$AD===e5)this._$AH.p(i5);else {let t6=new k(e5,this),s6=t6.u(this.options);t6.p(i5),this.T(s6),this._$AH=t6;}}_$AC(t5){let i5=C.get(t5.strings);return i5===void 0&&C.set(t5.strings,i5=new S2(t5)),i5}k(t5){u2(this._$AH)||(this._$AH=[],this._$AR());let i5=this._$AH,s5,e5=0;for(let h5 of t5)e5===i5.length?i5.push(s5=new _R(this.O(c3()),this.O(c3()),this,this.options)):s5=i5[e5],s5._$AI(h5),e5++;e5<i5.length&&(this._$AR(s5&&s5._$AB.nextSibling,e5),i5.length=e5);}_$AR(t5=this._$AA.nextSibling,s5){for(this._$AP?.(false,true,s5);t5!==this._$AB;){let s6=i2(t5).nextSibling;i2(t5).remove(),t5=s6;}}setConnected(t5){this._$AM===void 0&&(this._$Cv=t5,this._$AP?.(t5));}},H=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t5,i5,s5,e5,h5){this.type=1,this._$AH=A,this._$AN=void 0,this.element=t5,this.name=i5,this._$AM=e5,this.options=h5,s5.length>2||s5[0]!==""||s5[1]!==""?(this._$AH=Array(s5.length-1).fill(new String),this.strings=s5):this._$AH=A;}_$AI(t5,i5=this,s5,e5){let h5=this.strings,o7=false;if(h5===void 0)t5=M(this,t5,i5,0),o7=!a2(t5)||t5!==this._$AH&&t5!==E,o7&&(this._$AH=t5);else {let e6=t5,n6,r6;for(t5=h5[0],n6=0;n6<h5.length-1;n6++)r6=M(this,e6[s5+n6],i5,n6),r6===E&&(r6=this._$AH[n6]),o7||=!a2(r6)||r6!==this._$AH[n6],r6===A?t5=A:t5!==A&&(t5+=(r6??"")+h5[n6+1]),this._$AH[n6]=r6;}o7&&!e5&&this.j(t5);}j(t5){t5===A?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t5??"");}},I=class extends H{constructor(){super(...arguments),this.type=3;}j(t5){this.element[this.name]=t5===A?void 0:t5;}},L=class extends H{constructor(){super(...arguments),this.type=4;}j(t5){this.element.toggleAttribute(this.name,!!t5&&t5!==A);}},z=class extends H{constructor(t5,i5,s5,e5,h5){super(t5,i5,s5,e5,h5),this.type=5;}_$AI(t5,i5=this){if((t5=M(this,t5,i5,0)??A)===E)return;let s5=this._$AH,e5=t5===A&&s5!==A||t5.capture!==s5.capture||t5.once!==s5.once||t5.passive!==s5.passive,h5=t5!==A&&(s5===A||e5);e5&&this.element.removeEventListener(this.name,this,s5),h5&&this.element.addEventListener(this.name,this,t5),this._$AH=t5;}handleEvent(t5){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t5):this._$AH.handleEvent(t5);}},W=class{constructor(t5,i5,s5){this.element=t5,this.type=6,this._$AN=void 0,this._$AM=i5,this.options=s5;}get _$AU(){return this._$AM._$AU}_$AI(t5){M(this,t5);}},j=t2.litHtmlPolyfillSupport;j?.(S2,R),(t2.litHtmlVersions??=[]).push("3.3.2");var B=(t5,i5,s5)=>{let e5=s5?.renderBefore??i5,h5=e5._$litPart$;if(h5===void 0){let t6=s5?.renderBefore??null;e5._$litPart$=h5=new R(i5.insertBefore(c3(),t6),t6,void 0,s5??{});}return h5._$AI(t5),h5};var s3=globalThis,i3=class extends g{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){let t5=super.createRenderRoot();return this.renderOptions.renderBefore??=t5.firstChild,t5}update(t5){let r6=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t5),this._$Do=B(r6,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return E}};i3._$litElement$=true,i3.finalized=true,s3.litElementHydrateSupport?.({LitElement:i3});var o4=s3.litElementPolyfillSupport;o4?.({LitElement:i3});(s3.litElementVersions??=[]).push("4.2.2");var r4=o7=>o7.strings===void 0;var t4={CHILD:2},e3=t5=>(...e5)=>({_$litDirective$:t5,values:e5}),i4=class{constructor(t5){}get _$AU(){return this._$AM._$AU}_$AT(t5,e5,i5){this._$Ct=t5,this._$AM=e5,this._$Ci=i5;}_$AS(t5,e5){return this.update(t5,e5)}update(t5,e5){return this.render(...e5)}};var s4=(i5,t5)=>{let e5=i5._$AN;if(e5===void 0)return false;for(let i6 of e5)i6._$AO?.(t5,false),s4(i6,t5);return true},o5=i5=>{let t5,e5;do{if((t5=i5._$AM)===void 0)break;e5=t5._$AN,e5.delete(i5),i5=t5;}while(e5?.size===0)},r5=i5=>{for(let t5;t5=i5._$AM;i5=t5){let e5=t5._$AN;if(e5===void 0)t5._$AN=e5=new Set;else if(e5.has(i5))break;e5.add(i5),c4(t5);}};function h3(i5){this._$AN!==void 0?(o5(this),this._$AM=i5,r5(this)):this._$AM=i5;}function n4(i5,t5=false,e5=0){let r6=this._$AH,h5=this._$AN;if(h5!==void 0&&h5.size!==0)if(t5)if(Array.isArray(r6))for(let i6=e5;i6<r6.length;i6++)s4(r6[i6],false),o5(r6[i6]);else r6!=null&&(s4(r6,false),o5(r6));else s4(this,i5);}var c4=i5=>{i5.type==t4.CHILD&&(i5._$AP??=n4,i5._$AQ??=h3);},f3=class extends i4{constructor(){super(...arguments),this._$AN=void 0;}_$AT(i5,t5,e5){super._$AT(i5,t5,e5),r5(this),this.isConnected=i5._$AU;}_$AO(i5,t5=true){i5!==this.isConnected&&(this.isConnected=i5,i5?this.reconnected?.():this.disconnected?.()),t5&&(s4(this,i5),o5(this));}setValue(t5){if(r4(this._$Ct))this._$Ct._$AI(t5,this);else {let i5=[...this._$Ct._$AH];i5[this._$Ci]=t5,this._$Ct._$AI(i5,this,0);}}disconnected(){}reconnected(){}};var e4=()=>new h4,h4=class{},o6=new WeakMap,n5=e3(class extends f3{render(i5){return A}update(i5,[s5]){let e5=s5!==this.G;return e5&&this.G!==void 0&&this.rt(void 0),(e5||this.lt!==this.ct)&&(this.G=s5,this.ht=i5.options?.host,this.rt(this.ct=i5.element)),A}rt(t5){if(this.isConnected||(t5=void 0),typeof this.G=="function"){let i5=this.ht??globalThis,s5=o6.get(i5);s5===void 0&&(s5=new WeakMap,o6.set(i5,s5)),s5.get(this.G)!==void 0&&this.G.call(this.ht,void 0),s5.set(this.G,t5),t5!==void 0&&this.G.call(this.ht,t5);}else this.G.value=t5;}get lt(){return typeof this.G=="function"?o6.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0);}reconnected(){this.rt(this.ct);}});var POPUP_PLACEMENTS=new Set(["top","bottom","left","right"]);function parseEnabledFromAttribute(value){if(value===null)return true;let s5=value.trim().toLowerCase();return !(s5==="false"||s5==="0"||s5==="off"||s5==="no"||s5==="disabled")}function parsePopupPlacementFromAttribute(value){if(value===null)return "top";let s5=value.trim().toLowerCase();return POPUP_PLACEMENTS.has(s5)?s5:"top"}function popupPlacementToAttribute(placement){return POPUP_PLACEMENTS.has(placement)?placement:"top"}function parseEditorTypeFromAttribute(value){return value===null?"input":value.trim().toLowerCase()==="textarea"?"textarea":"input"}function parsePageSizeFromAttribute(value){if(value===null)return clampIMPageSize(5);let n6=Number.parseInt(value.trim(),10);return Number.isNaN(n6)?clampIMPageSize(5):clampIMPageSize(n6)}var PINYIN_IME_STYLE_TEXT=`/**\r
4
4
  * \u9ED8\u8BA4\u6837\u5F0F\uFF08\u65E0\u524D\u7F00\u6846\u67B6\uFF09\uFF1B\u4E0E \`defaultPinyinPopupClassNames\` / \u8F93\u5165\u6846\u9ED8\u8BA4 class \u5BF9\u5E94\u3002\r