PageSourceSearch

https://otterdict.com/_next/static/chunks/9717.fa42381d1b51019d.js

js otterdict.com collected 2026-10-09 04:50:31 UTC 36,064 bytes, 4 lines download raw bytes

1!function(){try{var t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},e=(new t.Error).stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="f95a99d0-c52f-41ef-83aa-bad7e26673d1",t._sentryDebugIdIdentifier="sentry-dbid-f95a99d0-c52f-41ef-83aa-bad7e26673d1")}catch(t){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9717],{89717:(t,e,r)=>{r.r(e),r.d(e,{default:()=>ty});let i="undefined"==typeof window?r.g:window,s=i.performance&&(()=>i.performance.now())||(()=>Date.now()),n=(null==(to=i.requestAnimationFrame)?void 0:to.bind(i))||(t=>setTimeout(()=>t(s()),1e3/60)),o=(null==(ta=i.cancelAnimationFrame)?void 0:ta.bind(i))||clearTimeout;function a(t){return t[t.length-1]}let h=(t,e)=>t<0?e+t:t,l=0;function u(t){return t.reduce((t,e)=>e+t,0)/t.length}function d(t){let e=t.toUpperCase().trim();if(/^#([A-F0-9]{3}){1,2}$/.test(e)){let t=e.substring(1).split("");3===t.length&&(t=[t[0],t[0],t[1],t[1],t[2],t[2]]);let r=`${t.join("")}`;return{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16),a:1}}let r=e.match(/^RGBA?\((\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d*\.?\d+))?\)$/);if(r)return{r:parseInt(r[1],10),g:parseInt(r[2],10),b:parseInt(r[3],10),a:parseFloat(r[4]||1,10)};throw Error(`Invalid color: ${t}`)}function c(t,e){let r={};for(let i=0;i<e;i++)r[i]=t;return r}let _=(null==(th=i.navigator)?void 0:th.userAgent)||"",p=_.indexOf("MSIE ")>0||_.indexOf("Trident/")>0||_.indexOf("Edge/")>0,g=()=>{};class k{constructor(t,e,r=g){this._mutationChains=[],this._onStateChange=r,this.state={options:{drawingFadeDuration:e.drawingFadeDuration,drawingWidth:e.drawingWidth,drawingColor:d(e.drawingColor),strokeColor:d(e.strokeColor),outlineColor:d(e.outlineColor),radicalColor:d(e.radicalColor||e.strokeColor),highlightColor:d(e.highlightColor)},character:{main:{opacity:+!!e.showCharacter,strokes:{}},outline:{opacity:+!!e.showOutline,strokes:{}},highlight:{opacity:1,strokes:{}}},userStrokes:null};for(let e=0;e<t.strokes.length;e++)this.state.character.main.strokes[e]={opacity:1,displayPortion:1},this.state.character.outline.strokes[e]={opacity:1,displayPortion:1},this.state.character.highlight.strokes[e]={opacity:0,displayPortion:1}}overwriteOnStateChange(t){this._onStateChange=t}updateState(t){let e=function t(e,r){let i={...e};for(let s in r){let n=e[s],o=r[s];n!==o&&(n&&o&&"object"==typeof n&&"object"==typeof o&&!Array.isArray(o)?i[s]=t(n,o):i[s]=o)}return i}(this.state,t);this._onStateChange(e,this.state),this.state=e}run(t,e={}){let r=t.map(t=>t.scope);return this.cancelMutations(r),new Promise(i=>{let s={_isActive:!0,_index:0,_resolve:i,_mutations:t,_loop:e.loop,_scopes:r};this._mutationChains.push(s),this._run(s)})}_run(t){if(!t._isActive)return;let e=t._mutations;if(t._index>=e.length)if(t._loop)t._index=0;else{t._isActive=!1,this._mutationChains=this._mutationChains.filter(e=>e!==t),t._resolve({canceled:!1});return}t._mutations[t._index].run(this).then(()=>{t._isActive&&(t._index++,this._run(t))})}_getActiveMutations(){return this._mutationChains.map(t=>t._mutations[t._index])}pauseAll(){this._getActiveMutations().forEach(t=>t.pause())}resumeAll(){this._getActiveMutations().forEach(t=>t.resume())}cancelMutations(t){for(let e of this._mutationChains)for(let r of e._scopes)for(let i of t)(r.startsWith(i)||i.startsWith(r))&&this._cancelMutationChain(e)}cancelAll(){this.cancelMutations([""])}_cancelMutationChain(t){var e;t._isActive=!1;for(let e=t._index;e<t._mutations.length;e++)t._mutations[e].cancel(this);null==(e=t._resolve)||e.call(t,{canceled:!0}),this._mutationChains=this._mutationChains.filter(e=>e!==t)}}let f=(t,e)=>({x:t.x-e.x,y:t.y-e.y}),m=t=>Math.sqrt(Math.pow(t.x,2)+Math.pow(t.y,2)),y=(t,e)=>m(f(t,e)),S=(t,e)=>t.x===e.x&&t.y===e.y,v=(t,e=1)=>{let r=10*e;return{x:Math.round(r*t.x)/r,y:Math.round(r*t.y)/r}},w=t=>{let e=t[0];return t.slice(1).reduce((t,r)=>{let i=y(r,e);return e=r,t+i},0)},C=(t,e,r)=>{let i=f(e,t),s=r/m(i);return{x:e.x+s*i.x,y:e.y+s*i.y}},P=t=>{let e=((t,e=30)=>{let r=w(t)/(e-1),i=[t[0]],s=a(t),n=t.slice(1);for(let t=0;t<e-2;t++){let t=a(i),e=r,s=!1;for(;!s;){let r=y(t,n[0]);if(r<e)e-=r,t=n.shift();else{let o=C(t,n[0],e-r);i.push(o),s=!0}}}return i.push(s),i})(t),r={x:u(e.map(t=>t.x)),y:u(e.map(t=>t.y))},i=e.map(t=>f(t,r)),s=Math.sqrt(u([Math.pow(i[0].x,2)+Math.pow(i[0].y,2),Math.pow(a(i).x,2)+Math.pow(a(i).y,2)]));return((t,e=.05)=>{let r=t.slice(0,1);for(let i of t.slice(1)){let t=r[r.length-1],s=y(i,t);if(s>e){let n=Math.ceil(s/e),o=s/n;for(let e=0;e<n;e++)r.push(C(i,t,-1*o*(e+1)))}else r.push(i)}return r})(i.map(t=>({x:t.x/s,y:t.y/s})))};function x(t,e=!1){let r=v(t[0]),i=t.slice(1),s=`M ${r.x} ${r.y}`;
1return i.forEach(t=>{let e=v(t);s+=` L ${e.x} ${e.y}`}),e&&(s+="Z"),s}let D=(t,e)=>{let r=(t=>{if(t.length<3)return t;let e=[t[0],t[1]];return t.slice(2).forEach(t=>{let r=e.length,i=f(t,e[r-1]),s=f(e[r-1],e[r-2]);i.y*s.x-i.x*s.y==0&&e.pop(),e.push(t)}),e})(t);if(r.length<2)return r;let i=C(r[1],r[0],e),s=r.slice(1);return s.unshift(i),s};class M{constructor(t,e,r,i=!1){this.path=t,this.points=e,this.strokeNum=r,this.isInRadical=i}getStartingPoint(){return this.points[0]}getEndingPoint(){return this.points[this.points.length-1]}getLength(){return w(this.points)}getVectors(){let t=this.points[0];return this.points.slice(1).map(e=>{let r=f(e,t);return t=e,r})}getDistance(t){return Math.min(...this.points.map(e=>y(e,t)))}getAverageDistance(t){return t.reduce((t,e)=>t+this.getDistance(e),0)/t.length}}class T{constructor(t,e){this.symbol=t,this.strokes=e}}let[R,$]=[{x:0,y:-124},{x:1024,y:900}],A=$.x-R.x,b=$.y-R.y;class E{constructor(t){let{padding:e,width:r,height:i}=t;this.padding=e,this.width=r,this.height=i;let s=r-2*e,n=i-2*e;this.scale=Math.min(s/A,n/b);let o=e+(s-this.scale*A)/2,a=e+(n-this.scale*b)/2;this.xOffset=-1*R.x*this.scale+o,this.yOffset=-1*R.y*this.scale+a}convertExternalPoint(t){return{x:(t.x-this.xOffset)/this.scale,y:(this.height-this.yOffset-t.y)/this.scale}}}let L=[Math.PI/16,Math.PI/32,0,-1*Math.PI/32,-1*Math.PI/16],O=(t,e,r)=>{let{leniency:i=1,isOutlineVisible:s=!1,checkBackwards:n=!0,averageDistanceThreshold:o=350}=r,a=e.getAverageDistance(t),h=a<=o*(s||e.strokeNum>0?.5:1)*i;if(!h)return{isMatch:!1,avgDist:a,meta:{isStrokeBackwards:!1}};let l=((t,e,r)=>{let i=y(e.getStartingPoint(),t[0]),s=y(e.getEndingPoint(),t[t.length-1]);return i<=250*r&&s<=250*r})(t,e,i),d=((t,e)=>{let r=(t=>{let e=[],r=t[0];return t.slice(1).forEach(t=>{e.push(f(t,r)),r=t}),e})(t),i=e.getVectors();return u(r.map(t=>Math.max(...i.map(e=>((t,e)=>(t.x*e.x+t.y*e.y)/m(t)/m(e))(e,t)))))>0})(t,e),c=((t,e,r)=>{let i=P(t),s=P(e),n=1/0;return L.forEach(t=>{let e=((t,e)=>{let r=t.length>=e.length?t:e,i=t.length>=e.length?e:t,s=(t,e,s,n)=>{if(0===t&&0===e)return y(r[0],i[0]);if(t>0&&0===e)return Math.max(s[0],y(r[t],i[0]));let o=n[n.length-1];return 0===t&&e>0?Math.max(o,y(r[0],i[e])):Math.max(Math.min(s[e],s[e-1],o),y(r[t],i[e]))},n=[];for(let t=0;t<r.length;t++){let e=[];for(let r=0;r<i.length;r++)e.push(s(t,r,n,e));n=e}return n[i.length-1]})(i,((t,e)=>t.map(t=>({x:Math.cos(e)*t.x-Math.sin(e)*t.y,y:Math.sin(e)*t.x+Math.cos(e)*t.y})))(s,t));e<n&&(n=e)}),n<=.4*r})(t,e.points,i),_=i*(w(t)+25)/(e.getLength()+25)>=.35,p=h&&l&&d&&c&&_;return n&&!p&&O([...t].reverse(),e,{...r,checkBackwards:!1}).isMatch?{isMatch:p,avgDist:a,meta:{isStrokeBackwards:!0}}:{isMatch:p,avgDist:a,meta:{isStrokeBackwards:!1}}};class z{constructor(t,e,r){this.id=t,this.points=[e],this.externalPoints=[r]}appendPoint(t,e){this.points.push(t),this.externalPoints.push(e)}}class I{constructor(t){this._duration=t,this._startTime=null,this._paused=!1,this.scope=`delay.${t}`}run(){return this._startTime=s(),this._runningPromise=new Promise(t=>{this._resolve=t,this._timeout=setTimeout(()=>this.cancel(),this._duration)}),this._runningPromise}pause(){if(this._paused)return;let t=performance.now()-(this._startTime||0);this._duration=Math.max(0,this._duration-t),clearTimeout(this._timeout),this._paused=!0}resume(){this._paused&&(this._startTime=performance.now(),this._timeout=setTimeout(()=>this.cancel(),this._duration),this._paused=!1)}cancel(){clearTimeout(this._timeout),this._resolve&&this._resolve(),this._resolve=void 0}}class F{constructor(t,e,r={}){this._tick=t=>{if(null!==this._startPauseTime)return;let e=Math.min(1,(t-this._startTime-this._pausedDuration)/this._duration);if(1===e)this._renderState.updateState(this._values),this._frameHandle=void 0,this.cancel(this._renderState);else{let t=W(e),r=function t(e,r,i){let s={};for(let n in r){let o=r[n],a=null==e?void 0:e[n];"number"==typeof a&&"number"==typeof o&&o>=0?s[n]=i*(o-a)+a:s[n]=t(a,o,i)}return s}(this._startState,this._values,t);this._renderState.updateState(r),this._frameHandle=n(this._tick)}},this.scope=t,this._valuesOrCallable=e,this._duration=r.duration||0,this._force=r.force,this._pausedDuration=0,this._startPauseTime=null}run(t){return(this._values||this._inflateValues(t),0===this._duration&&t.updateState(this._values),0===this._duration||function t(e,r){for(let i in r){let s=r[i],n=null==e?void 0:e[i];if(s>=0){if(s!==n)return!1}else if(!t(n,s))return!1}return!0}(t.state,this._values))?Promise.resolve():(this._renderState=t,this._startState=t.state,this._startTime=performance.now(),this._frameHandle=n(this._tick),new Promise(t=>{this._resolve=t}))}_inflateValues(t){let e=this._valuesOrCallable;"function"==typeof this._valuesOrCallable&&(e=this._valuesOrCallable(t.state)),this._values=function(t,e){let r=t.split("."),i={},s=i;for(let t=0;t<r.length;t++){let i=t===r.length-1?e:{};s[r[t]]=i,s=i}return i}(this.scope,e)}pause(){null===this._startPauseTime&&(this._frameHandle&&o(this._frameHandle),this._startPauseTime=performance.now())}resume(){null!==this._startPauseTime&&(this._frameHandle=n(this._tick),this._pausedDuration+=performance.now()-this._startPauseTime,this._startPauseTime=null)}cancel(t){var e;null==(e=this._resolve)||e.call(this),this._resolve=void 0,o(this._frameHandle||-1),this._frameHandle=void 0,this._force&&(this._values||this._inflateValues(t),t.updateState(this._values))}}F.Delay=I;let W=t=>-Math.cos(t*Math.PI)/2+.5,H=(t,e,r)=>[new F(`character.${t}.strokes`,c({opacity:1,displayPortion:1},e.strokes.length),{duration:r,force:!0})],q=(t,e,r)=>[new F(`character.${t}`,{opacity:1,strokes:c({opacity:1,displayPortion:1},e.strokes.length)},{duration:r,force:!0})],B=(t,e,r)=>[new F(`character.${t}
1.opacity`,0,{duration:r,force:!0}),...H(t,e,0)],N=(t,e,r)=>[new F(`options.${t}`,e,{duration:r})],j=(t,e,r)=>{let i=t.strokeNum,s=(t.getLength()+600)/(3*r);return[new F("options.highlightColor",e),new F("character.highlight",{opacity:1,strokes:{[i]:{displayPortion:0,opacity:0}}}),new F(`character.highlight.strokes.${i}`,{displayPortion:1,opacity:1},{duration:s}),new F(`character.highlight.strokes.${i}.opacity`,0,{duration:s,force:!0})]},U=(t,e,r)=>{let i=e.strokeNum,s=(e.getLength()+600)/(3*r);return[new F(`character.${t}`,{opacity:1,strokes:{[i]:{displayPortion:0,opacity:1}}}),new F(`character.${t}.strokes.${i}.displayPortion`,1,{duration:s})]},Q=(t,e,r,i,s)=>{let n=B(t,e,r);return(n=n.concat(H(t,e,0))).push(new F(`character.${t}`,{opacity:1,strokes:c({opacity:0},e.strokes.length)},{force:!0})),e.strokes.forEach((e,r)=>{r>0&&n.push(new F.Delay(s)),n=n.concat(U(t,e,i))}),n},V=t=>(null==t?void 0:t.map(t=>new F(`userStrokes.${t}`,null,{force:!0})))||[];class G{constructor(t,e,r){this._currentStrokeIndex=0,this._mistakesOnStroke=0,this._totalMistakes=0,this._character=t,this._renderState=e,this._isActive=!1,this._positioner=r}startQuiz(t){let e,r,i;this._userStrokesIds&&this._renderState.run(V(this._userStrokesIds)),this._userStrokesIds=[],this._isActive=!0,this._options=t;let s=h(t.quizStartStrokeNum,this._character.strokes.length);return this._currentStrokeIndex=Math.min(s,this._character.strokes.length-1),this._mistakesOnStroke=0,this._totalMistakes=0,this._renderState.run((e=this._character,r=t.strokeFadeDuration,i=this._currentStrokeIndex,[...B("main",e,r),new F("character.highlight",{opacity:1,strokes:c({opacity:0},e.strokes.length)},{force:!0}),new F("character.main",{opacity:1,strokes:function(t,e){let r={};for(let i=0;i<t;i++)r[i]=e(i);return r}(e.strokes.length,t=>({opacity:+(t<i)}))},{force:!0})]))}startUserStroke(t){var e;if(!this._isActive)return null;if(this._userStroke)return this.endUserStroke();let r=this._positioner.convertExternalPoint(t),i=++l;return this._userStroke=new z(i,r,t),null==(e=this._userStrokesIds)||e.push(i),this._renderState.run([new F("quiz.activeUserStrokeId",i,{force:!0}),new F(`userStrokes.${i}`,{points:[r],opacity:1},{force:!0})])}continueUserStroke(t){let e;if(!this._userStroke)return Promise.resolve();let r=this._positioner.convertExternalPoint(t);this._userStroke.appendPoint(r,t);let i=this._userStroke.points.slice(0);return this._renderState.run((e=this._userStroke.id,[new F(`userStrokes.${e}.points`,i,{force:!0})]))}setPositioner(t){this._positioner=t}endUserStroke(){var t;let e;if(!this._userStroke)return;if(this._renderState.run((e=this._userStroke.id,[new F(`userStrokes.${e}.opacity`,0,{duration:null!=(t=this._options.drawingFadeDuration)?t:300})])),1===this._userStroke.points.length){this._userStroke=void 0;return}let{acceptBackwardsStrokes:r,markStrokeCorrectAfterMisses:i}=this._options,s=this._getCurrentStroke(),{isMatch:n,meta:o}=function(t,e,r,i={}){let s=e.strokes,n=(t=>{if(t.length<2)return t;let[e,...r]=t,i=[e];for(let t of r)S(t,i[i.length-1])||i.push(t);return i})(t.points);if(n.length<2)return{isMatch:!1,meta:{isStrokeBackwards:!1}};let{isMatch:o,meta:a,avgDist:h}=O(n,s[r],i);if(!o)return{isMatch:o,meta:a};let l=s.slice(r+1),u=h;for(let t=0;t<l.length;t++){let{isMatch:e,avgDist:r}=O(n,l[t],{...i,checkBackwards:!1});e&&r<u&&(u=r)}if(u<h){let t=.6*(u+h)/(2*h),{isMatch:e,meta:o}=O(n,s[r],{...i,leniency:(i.leniency||1)*t});return{isMatch:e,meta:o}}return{isMatch:o,meta:a}}(this._userStroke,this._character,this._currentStrokeIndex,{isOutlineVisible:this._renderState.state.character.outline.opacity>0,leniency:this._options.leniency,averageDistanceThreshold:this._options.averageDistanceThreshold}),a=i&&this._mistakesOnStroke+1>=i;if(n||a||o.isStrokeBackwards&&r)this._handleSuccess(o);else{this._handleFailure(o);let{showHintAfterMisses:t,highlightColor:e,strokeHighlightSpeed:r}=this._options;!1!==t&&this._mistakesOnStroke>=t&&this._renderState.run(j(s,d(e),r))}this._userStroke=void 0}cancel(){this._isActive=!1,this._userStrokesIds&&this._renderState.run(V(this._userStrokesIds))}_getStrokeData({isCorrect:t,meta:e}){let r;return{character:this._character.symbol,strokeNum:this._currentStrokeIndex,mistakesOnStroke:this._mistakesOnStroke,totalMistakes:this._totalMistakes,strokesRemaining:this._character.strokes.length-this._currentStrokeIndex-!!t,drawnPath:{pathString:x((r=this._userStroke).externalPoints),points:r.points.map(t=>v(t))},isBackwards:e.isStrokeBackwards}}nextStroke(){let t;if(!this._options)return;
1let{strokes:e,symbol:r}=this._character,{onComplete:i,highlightOnComplete:s,strokeFadeDuration:n,highlightCompleteColor:o,highlightColor:a,strokeHighlightDuration:h}=this._options,l=(t=this._currentStrokeIndex,[new F(`character.main.strokes.${t}`,{displayPortion:1,opacity:1},{duration:n,force:!0})]);if(this._mistakesOnStroke=0,this._currentStrokeIndex+=1,this._currentStrokeIndex===e.length){let t,e,n;this._isActive=!1,null==i||i({character:r,totalMistakes:this._totalMistakes}),s&&(l=l.concat((t=this._character,e=d(o||a),n=2*(h||0),[new F("options.highlightColor",e),...B("highlight",t),...q("highlight",t,n/2),...B("highlight",t,n/2)])))}this._renderState.run(l)}_handleSuccess(t){if(!this._options)return;let{onCorrectStroke:e}=this._options;null==e||e({...this._getStrokeData({isCorrect:!0,meta:t})}),this.nextStroke()}_handleFailure(t){var e,r;this._mistakesOnStroke+=1,this._totalMistakes+=1,null==(e=(r=this._options).onMistake)||e.call(r,this._getStrokeData({isCorrect:!1,meta:t}))}_getCurrentStroke(){return this._character.strokes[this._currentStrokeIndex]}}function X(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function K(t,e,r){t.setAttributeNS(null,e,r)}function Y(t,e){Object.keys(e).forEach(r=>K(t,r,e[r]))}function J(t){var e;null==t||null==(e=t.parentNode)||e.removeChild(t)}class Z{constructor(t){this.stroke=t,this._pathLength=t.getLength()+Z.STROKE_WIDTH/2}_getStrokeDashoffset(t){return .999*this._pathLength*(1-t)}_getColor({strokeColor:t,radicalColor:e}){return e&&this.stroke.isInRadical?e:t}}Z.STROKE_WIDTH=200;class tt extends Z{constructor(t){super(t),this._oldProps=void 0}mount(t){let e;this._animationPath=X("path"),this._clip=X("clipPath"),this._strokePath=X("path");let r=`mask-${++l}`;K(this._clip,"id",r),K(this._strokePath,"d",this.stroke.path),this._animationPath.style.opacity="0",K(this._animationPath,"clip-path",(e="",window.location&&window.location.href&&(e=window.location.href.replace(/#[^#]*$/,"").replace(/"/gi,"%22")),`url("${e}#${r}")`));let i=D(this.stroke.points,100);return K(this._animationPath,"d",x(i)),Y(this._animationPath,{stroke:"#FFFFFF","stroke-width":"200",fill:"none","stroke-linecap":"round","stroke-linejoin":"miter","stroke-dasharray":`${this._pathLength},${this._pathLength}`}),this._clip.appendChild(this._strokePath),t.defs.appendChild(this._clip),t.svg.appendChild(this._animationPath),this}render(t){var e,r;if(t===this._oldProps||!this._animationPath)return;t.displayPortion!==(null==(e=this._oldProps)?void 0:e.displayPortion)&&(this._animationPath.style.strokeDashoffset=this._getStrokeDashoffset(t.displayPortion).toString());let i=this._getColor(t);if(!this._oldProps||i!==this._getColor(this._oldProps)){let{r:t,g:e,b:r,a:s}=i;Y(this._animationPath,{stroke:`rgba(${t},${e},${r},${s})`})}t.opacity!==(null==(r=this._oldProps)?void 0:r.opacity)&&(this._animationPath.style.opacity=t.opacity.toString()),this._oldProps=t}}class te{constructor(t){this._oldProps=void 0,this._strokeRenderers=t.strokes.map(t=>new tt(t))}mount(t){let e=t.createSubRenderTarget();this._group=e.svg,this._strokeRenderers.forEach(t=>{t.mount(e)})}render(t){var e,r,i,s;if(t===this._oldProps||!this._group)return;let{opacity:n,strokes:o,strokeColor:a,radicalColor:h=null}=t;n!==(null==(e=this._oldProps)?void 0:e.opacity)&&(this._group.style.opacity=n.toString(),p||(0===n?this._group.style.display="none":(null==(i=this._oldProps)?void 0:i.opacity)===0&&this._group.style.removeProperty("display")));let l=!this._oldProps||a!==this._oldProps.strokeColor||h!==this._oldProps.radicalColor;if(l||o!==(null==(r=this._oldProps)?void 0:r.strokes))for(let t=0;t<this._strokeRenderers.length;t++)(l||null==(s=this._oldProps)||!s.strokes||o[t]!==this._oldProps.strokes[t])&&this._strokeRenderers[t].render({strokeColor:a,radicalColor:h,opacity:o[t].opacity,displayPortion:o[t].displayPortion});this._oldProps=t}}class tr{constructor(){this._oldProps=void 0}mount(t){this._path=X("path"),t.svg.appendChild(this._path)}render(t){var e,r,i,s;if(this._path&&t!==this._oldProps){if(t.strokeColor!==(null==(e=this._oldProps)?void 0:e.strokeColor)||t.strokeWidth!==(null==(r=this._oldProps)?void 0:r.strokeWidth)){let{r:e,g:r,b:i,a:s}=t.strokeColor;Y(this._path,{fill:"none",stroke:`rgba(${e},${r},${i},${s})`,"stroke-width":t.strokeWidth.toString(),"stroke-linecap":"round","stroke-linejoin":"round"})}t.opacity!==(null==(i=this._oldProps)?void 0:i.opacity)&&K(this._path,"opacity",t.opacity.toString()),t.points!==(null==(s=this._oldProps)?void 0:s.points)&&K(this._path,"d",x(t.points)),this._oldProps=t}}destroy(){J(this._path)}}class ti{constructor(t,e){this._character=t,this._positioner=e,this._mainCharRenderer=new te(t),this._outlineCharRenderer=new te(t),this._highlightCharRenderer=new te(t),this._userStrokeRe
1nderers={}}mount(t){let e=t.createSubRenderTarget(),r=e.svg,{xOffset:i,yOffset:s,height:n,scale:o}=this._positioner;K(r,"transform",`translate(${i}, ${n-s}) scale(${o}, ${-1*o})`),this._outlineCharRenderer.mount(e),this._mainCharRenderer.mount(e),this._highlightCharRenderer.mount(e),this._positionedTarget=e}render(t){let{main:e,outline:r,highlight:i}=t.character,{outlineColor:s,radicalColor:n,highlightColor:o,strokeColor:a,drawingWidth:h,drawingColor:l}=t.options;this._outlineCharRenderer.render({opacity:r.opacity,strokes:r.strokes,strokeColor:s}),this._mainCharRenderer.render({opacity:e.opacity,strokes:e.strokes,strokeColor:a,radicalColor:n}),this._highlightCharRenderer.render({opacity:i.opacity,strokes:i.strokes,strokeColor:o});let u=t.userStrokes||{};for(let t in this._userStrokeRenderers)if(!u[t]){var d;null==(d=this._userStrokeRenderers[t])||d.destroy(),delete this._userStrokeRenderers[t]}for(let t in u){let e=u[t];if(!e)continue;let r={strokeWidth:h,strokeColor:l,...e};(()=>{if(this._userStrokeRenderers[t])return this._userStrokeRe
1nderers[t];let e=new tr;return e.mount(this._positionedTarget),this._userStrokeRenderers[t]=e,e})().render(r)}}destroy(){J(this._positionedTarget.svg),this._positionedTarget.defs.innerHTML=""}}class ts{constructor(t){this.node=t}addPointerStartListener(t){this.node.addEventListener("mousedown",e=>{t(this._eventify(e,this._getMousePoint))}),this.node.addEventListener("touchstart",e=>{t(this._eventify(e,this._getTouchPoint))})}addPointerMoveListener(t){this.node.addEventListener("mousemove",e=>{t(this._eventify(e,this._getMousePoint))}),this.node.addEventListener("touchmove",e=>{t(this._eventify(e,this._getTouchPoint))})}addPointerEndListener(t){document.addEventListener("mouseup",t),document.addEventListener("touchend",t)}getBoundingClientRect(){return this.node.getBoundingClientRect()}updateDimensions(t,e){this.node.setAttribute("width",`${t}`),this.node.setAttribute("height",`${e}`)}_eventify(t,e){return{getPoint:()=>e.call(this,t),preventDefault:()=>t.preventDefault()}}_getMousePoint(t){let{left:e,top:r}=this.getBoundingClientRect();return{x:t.clientX-e,y:t.clientY-r}}_getTouchPoint(t){let{left:e,top:r}=this.getBoundingClientRect();return{x:t.touches[0].clientX-e,y:t.touches[0].clientY-r}}}class tn extends ts{constructor(t,e){super(t),this.svg=t,this.defs=e,"createSVGPoint"in t&&(this._pt=t.createSVGPoint())}static init(t,e="100%",r="100%"){let i="string"==typeof t?document.getElementById(t):t;if(!i)throw Error(`HanziWriter target element not found: ${t}`);let s=i.nodeName.toUpperCase(),n=(()=>{if("SVG"===s||"G"===s)return i;{let t=X("svg");return i.appendChild(t),t}})();Y(n,{width:e,height:r});let o=X("defs");return n.appendChild(o),new tn(n,o)}createSubRenderTarget(){let t=X("g");return this.svg.appendChild(t),new tn(t,this.defs)}_getMousePoint(t){if(this._pt&&(this._pt.x=t.clientX,this._pt.y=t.clientY,"getScreenCTM"in this.node)){var e;let t=this._pt.matrixTransform(null==(e=this.node.getScreenCTM())?void 0:e.inverse());return{x:t.x,y:t.y}}return super._getMousePoint.call(this,t)}_getTouchPoint(t){if(this._pt&&(this._pt.x=t.touches[0].clientX,this._pt.y=t.touches[0].clientY,"getScreenCTM"in this.node)){var e;let t=this._pt.matrixTransform(null==(e=this.node.getScreenCTM())?void 0:e.inverse());return{x:t.x,y:t.y}}return super._getTouchPoint(t)}}var to,ta,th,tl={HanziWriterRenderer:ti,createRenderTarget:tn.init};let tu=(t,e)=>{t.beginPath();let r=e[0],i=e.slice(1);for(let e of(t.moveTo(r.x,r.y),i))t.lineTo(e.x,e.y);t.stroke()};class td extends Z{constructor(t,e=!0){super(t),e&&Path2D?this._path2D=new Path2D(this.stroke.path):this._pathCmd=(t=>{let e=t.split(/(^|\s+)(?=[A-Z])/).filter(t=>" "!==t),r=[t=>t.beginPath()];for(let t of e){let[e,...i]=t.split(/\s+/),s=i.map(t=>parseFloat(t));"M"===e?r.push(t=>t.moveTo(...s)):"L"===e?r.push(t=>t.lineTo(...s)):"C"===e?r.push(t=>t.bezierCurveTo(...s)):"Q"===e&&r.push(t=>t.quadraticCurveTo(...s))}return t=>r.forEach(e=>e(t))})(this.stroke.path),this._extendedMaskPoints=D(this.stroke.points,Z.STROKE_WIDTH/2)}render(t,e){if(e.opacity<.05)return;if(t.save(),this._path2D)t.clip(this._path2D);else{var r;null==(r=this._pathCmd)||r.call(this,t),t.globalAlpha=0,t.stroke(),t.clip()}let{r:i,g:s,b:n,a:o}=this._getColor(e),a=1===o?`rgb(${i},${s},${n})`:`rgb(${i},${s},${n},${o})`,h=this._getStrokeDashoffset(e.displayPortion);t.globalAlpha=e.opacity,t.strokeStyle=a,t.fillStyle=a,t.lineWidth=Z.STROKE_WIDTH,t.lineCap="round",t.lineJoin="round",t.setLineDash([this._pathLength,this._pathLength],h),t.lineDashOffset=h,tu(t,this._extendedMaskPoints),t.restore()}}class tc{constructor(t){this._strokeRenderers=t.strokes.map(t=>new td(t))}render(t,e){if(e.opacity<.05)return;let{opacity:r,strokeColor:i,radicalColor:s,strokes:n}=e;for(let e=0;e<this._strokeRenderers.length;e++)this._strokeRenderers[e].render(t,{strokeColor:i,radicalColor:s,opacity:n[e].opacity*r,displayPortion:n[e].displayPortion||0})}}class t_{constructor(t,e){this.destroy=g,this._character=t,this._positioner=e,this._mainCharRenderer=new tc(t),this._outlineCharRenderer=new tc(t),this._highlightCharRenderer=new tc(t)}mount(t){this._target=t}_animationFrame(t){let{width:e,height:r,scale:i,xOffset:s,yOffset:n}=this._positioner,o=this._target.getContext();o.clearRect(0,0,e,r),o.save(),o.translate(s,r-n),o.transform(1,0,0,-1,0,0),o.scale(i,i),t(o),o.restore(
1),o.draw&&o.draw()}render(t){let{outline:e,main:r,highlight:i}=t.character,{outlineColor:s,strokeColor:n,radicalColor:o,highlightColor:a,drawingColor:h,drawingWidth:l}=t.options;this._animationFrame(u=>{this._outlineCharRenderer.render(u,{opacity:e.opacity,strokes:e.strokes,strokeColor:s}),this._mainCharRenderer.render(u,{opacity:r.opacity,strokes:r.strokes,strokeColor:n,radicalColor:o}),this._highlightCharRenderer.render(u,{opacity:i.opacity,strokes:i.strokes,strokeColor:a});let d=t.userStrokes||{};for(let t in d){let e=d[t];e&&function(t,e){if(e.opacity<.05)return;let{opacity:r,strokeWidth:i,strokeColor:s,points:n}=e,{r:o,g:a,b:h,a:l}=s;t.save(),t.globalAlpha=r,t.lineWidth=i,t.strokeStyle=`rgba(${o},${a},${h},${l})`,t.lineCap="round",t.lineJoin="round",tu(t,n),t.restore()}(u,{strokeWidth:l,strokeColor:h,...e})}})}}class tp extends ts{constructor(t){super(t)}static init(t,e="100%",r="100%"){let i="string"==typeof t?document.getElementById(t):t;if(!i)throw Error(`HanziWriter target element not found: ${t}`);let s=i.nodeName.toUpperCase(),n=(()=>{if("CANVAS"===s)return i;let t=document.createElement("canvas");return i.appendChild(t),t})();return n.setAttribute("width",e),n.setAttribute("height",r),new tp(n)}getContext(){return this.node.getContext("2d")}}var tg={HanziWriterRenderer:t_,createRenderTarget:tp.init};let tk={charDataLoader:(t,e,r)=>{let i=new XMLHttpRequest;i.overrideMimeType&&i.overrideMimeType("application/json"),i.open("GET",`https://cdn.jsdelivr.net/npm/[email protected]/${t}.json`,!0),i.onerror=t=>{r(i,t)},i.onreadystatechange=()=>{4===i.readyState&&(200===i.status?e(JSON.parse(i.responseText)):0!==i.status&&r&&r(i))},i.send(null)},onLoadCharDataError:null,onLoadCharDataSuccess:null,showOutline:!0,showCharacter:!0,renderer:"svg",width:0,height:0,padding:20,strokeAnimationSpeed:1,strokeFadeDuration:400,strokeHighlightDuration:200,strokeHighlightSpeed:2,delayBetweenStrokes:1e3,delayBetweenLoops:2e3,strokeColor:"#555",radicalColor:null,highlightColor:"#AAF",outlineColor:"#DDD",drawingColor:"#333",leniency:1,showHintAfterMisses:3,highlightOnComplete:!0,highlightCompleteColor:null,markStrokeCorrectAfterMisses:!1,acceptBackwardsStrokes:!1,quizStartStrokeNum:0,averageDistanceThreshold:350,drawingFadeDuration:300,drawingWidth:4,strokeWidth:2,outlineWidth:2,rendererOverride:{}};class tf{constructor(t){this._loadCounter=0,this._isLoading=!1,this.loadingFailed=!1,this._options=t}_debouncedLoad(t,e){let r=t=>{if(e===this._loadCounter){var r;null==(r=this._resolve)||r.call(this,t)}},i=t=>{if(e===this._loadCounter){var r;null==(r=this._reject)||r.call(this,t)}},s=this._options.charDataLoader(t,r,i);s&&("then"in s?s.then(r).catch(i):r(s))}_setupLoadingPromise(){return new Promise((t,e)=>{this._resolve=t,this._reject=e}).then(t=>{var e,r;return this._isLoading=!1,null==(e=(r=this._options).onLoadCharDataSuccess)||e.call(r,t),t}).catch(t=>{if(this._isLoading=!1,this.loadingFailed=!0,this._options.onLoadCharDataError)return void this._options.onLoadCharDataError(t);if(t instanceof Error)throw t;let e=Error(`Failed to load char data for ${this._loadingChar}`);throw e.reason=t,e})}loadCharData(t){this._loadingChar=t;let e=this._setupLoadingPromise();return this.loadingFailed=!1,this._isLoading=!0,this._loadCounter++,this._debouncedLoad(t,this._loadCounter),e}}class tm{constructor(t,e={}){let{HanziWriterRenderer:r,createRenderTarget:i}="canvas"===e.renderer?tg:tl,s=e.rendererOverride||{};this._renderer={HanziWriterRenderer:s.HanziWriterRenderer||r,createRenderTarget:s.createRenderTarget||i},this.target=this._renderer.createRenderTarget(t,e.width,e.height),this._options=this._assignOptions(e),this._loadingManager=new tf(this._options),this._setupListeners()}static create(t,e,r){let i=new tm(t,r);return i.setCharacter(e),i}static loadCharacterData(t,e={}){let r=(()=>{let{_loadingManager:r,_loadingOptions:i}=tm;return(null==r?void 0:r._loadingChar)===t&&i===e?r:new tf({...tk,...e})})();return tm._loadingManager=r,tm._loadingOptions=e,r.loadCharData(t)}static getScalingTransform(t,e,r=0){let i=new E({width:t,height:e,padding:r});return{x:i.xOffset,y:i.yOffset,scale:i.scale,transform:`
2        translate(${i.xOffset}, ${i.height-i.yOffset})
3        scale(${i.scale}, ${-1*i.scale})
4      `.replace(/^\s+/,"").replace(/\s+$/,"").replace(/\s+/g," ")}}showCharacter(t={}){return this._options.showCharacter=!0,this._withData(()=>{var e;return null==(e=this._renderState)?void 0:e.run(q("main",this._character,"number"==typeof t.duration?t.duration:this._options.strokeFadeDuration)).then(e=>{var r;return null==(r=t.onComplete)||r.call(t,e),e})})}hideCharacter(t={}){return this._options.showCharacter=!1,this._withData(()=>{var e;return null==(e=this._renderState)?void 0:e.run(B("main",this._character,"number"==typeof t.duration?t.duration:this._options.strokeFadeDuration)).then(e=>{var r;return null==(r=t.onComplete)||r.call(t,e),e})})}animateCharacter(t={}){return this.cancelQuiz(),this._withData(()=>{var e;return null==(e=this._renderState)?void 0:e.run(Q("main",this._character,this._options.strokeFadeDuration,this._options.strokeAnimationSpeed,this._options.delayBetweenStrokes)).then(e=>{var r;return null==(r=t.onComplete)||r.call(t,e),e})})}animateStroke(t,e={}){return this.cancelQuiz(),this._withData(()=>{var r;return null==(r=this._renderState)?void 0:r.run(((t,e,r,i)=>{let s=e.strokes[r];return[new F(`character.${t}`,r=>{let i=r.character[t],s={opacity:1,strokes:{}};for(let t=0;t<e.strokes.length;t++)s.strokes[t]={opacity:i.opacity*i.strokes[t].opacity};return s}),...U(t,s,i)]})("main",this._character,h(t,this._character.strokes.length),this._options.strokeAnimationSpeed)).then(t=>{var r;return null==(r=e.onComplete)||r.call(e,t),t})})}highlightStroke(t,e={}){let r=()=>{if(this._character&&this._renderState){let r;return this._renderState.run(j((r=this._character.strokes)[h(t,r.length)],d(this._options.highlightColor),this._options.strokeHighlightSpeed)).then(t=>{var r;return null==(r=e.onComplete)||r.call(e,t),t})}};return this._withData(r)}
4async loopCharacterAnimation(){return this.cancelQuiz(),this._withData(()=>this._renderState.run(((t,e,r,i,s,n)=>{let o=Q(t,e,r,i,s);return o.push(new F.Delay(n)),o})("main",this._character,this._options.strokeFadeDuration,this._options.strokeAnimationSpeed,this._options.delayBetweenStrokes,this._options.delayBetweenLoops),{loop:!0}))}pauseAnimation(){return this._withData(()=>{var t;return null==(t=this._renderState)?void 0:t.pauseAll()})}resumeAnimation(){return this._withData(()=>{var t;return null==(t=this._renderState)?void 0:t.resumeAll()})}showOutline(t={}){return this._options.showOutline=!0,this._withData(()=>{var e;return null==(e=this._renderState)?void 0:e.run(q("outline",this._character,"number"==typeof t.duration?t.duration:this._options.strokeFadeDuration)).then(e=>{var r;return null==(r=t.onComplete)||r.call(t,e),e})})}hideOutline(t={}){return this._options.showOutline=!1,this._withData(()=>{var e;return null==(e=this._renderState)?void 0:e.run(B("outline",this._character,"number"==typeof t.duration?t.duration:this._options.strokeFadeDuration)).then(e=>{var r;return null==(r=t.onComplete)||r.call(t,e),e})})}updateDimensions({width:t,height:e,padding:r}){if(void 0!==t&&(this._options.width=t),void 0!==e&&(this._options.height=e),void 0!==r&&(this._options.padding=r),this.target.updateDimensions(this._options.width,this._options.height),this._character&&this._renderState&&this._hanziWriterRenderer&&this._positioner){this._hanziWriterRenderer.destroy();let t=this._initAndMountHanziWriterRenderer(this._character);this._renderState.overwriteOnStateChange(e=>t.render(e)),t.render(this._renderState.state),this._quiz&&this._quiz.setPositioner(this._positioner)}}updateColor(t,e,r={}){var i;let s=[],n=d("radicalColor"!==t||e?e:this._options.strokeColor);this._options[t]=e;let o=null!=(i=r.duration)?i:this._options.strokeFadeDuration;return s=s.concat(N(t,n,o)),"radicalColor"!==t||e||(s=s.concat(N(t,null,0))),this._withData(()=>{var t;return null==(t=this._renderState)?void 0:t.run(s).then(t=>{var e;return null==(e=r.onComplete)||e.call(r,t),t})})}quiz(t={}){return this._withData(async()=>{this._character&&this._renderState&&this._positioner&&(this.cancelQuiz(),this._quiz=new G(this._character,this._renderState,this._positioner),this._options={...this._options,...t},this._quiz.startQuiz(this._options))})}skipQuizStroke(){this._quiz&&this._quiz.nextStroke()}cancelQuiz(){this._quiz&&(this._quiz.cancel(),this._quiz=void 0)}setCharacter(t){return this.cancelQuiz(),this._char=t,this._hanziWriterRenderer&&this._hanziWriterRenderer.destroy(),this._renderState&&this._renderState.cancelAll(),this._hanziWriterRenderer=null,this._withDataPromise=this._loadingManager.loadCharData(t).then(e=>{if(!e||this._loadingManager.loadingFailed)return;this._character=new T(t,function({radStrokes:t,strokes:e,medians:r}){return e.map((e,i)=>{var s;return new M(e,r[i].map(t=>{let[e,r]=t;return{x:e,y:r}}),i,(null!=(s=null==t?void 0:t.indexOf(i))?s:-1)>=0)})}(e)),this._renderState=new k(this._character,this._options,t=>r.render(t));let r=this._initAndMountHanziWriterRenderer(this._character);r.render(this._renderState.state)}),this._withDataPromise}_initAndMountHanziWriterRenderer(t){let{width:e,height:r,padding:i}=this._options;this._positioner=new E({width:e,height:r,padding:i});let s=new this._renderer.HanziWriterRenderer(t,this._positioner);return s.mount(this.target),this._hanziWriterRenderer=s,s}async getCharacterData(){if(!this._char)throw Error("setCharacter() must be called before calling getCharacterData()");return await this._withData(()=>this._character)}_assignOptions(t){let e={...tk,...t};return t.strokeAnimationDuration&&!t.strokeAnimationSpeed&&(e.strokeAnimationSpeed=500/t.strokeAnimationDuration),t.strokeHighlightDuration&&!t.strokeHighlightSpeed&&(e.strokeHighlightSpeed=500/e.strokeHighlightDuration),t.highlightCompleteColor||(e.highlightCompleteColor=e.highlightColor),this._fillWidthAndHeight(e)}_fillWidthAndHeight(t){let e={...t};if(e.width&&!e.height)e.height=e.width;else if(e.height&&!e.width)e.width=e.height;else if(!e.width&&!e.height){let{width:t,height:r}=this.target.getBoundingClientRect(),i=Math.min(t,r);e.width=i,e.height=i}return e}_withData(t){if(this._loadingManager.loadingFailed)throw Error("Failed to load character data. Call setCharacter and try again.");return this._withDataPromise?this._withDataPromise.then(()=>
4{if(!this._loadingManager.loadingFailed)return t()}):Promise.resolve().then(t)}_setupListeners(){this.target.addPointerStartListener(t=>{this._quiz&&(t.preventDefault(),this._quiz.startUserStroke(t.getPoint()))}),this.target.addPointerMoveListener(t=>{this._quiz&&(t.preventDefault(),this._quiz.continueUserStroke(t.getPoint()))}),this.target.addPointerEndListener(()=>{var t;null==(t=this._quiz)||t.endUserStroke()})}}tm._loadingManager=null,tm._loadingOptions=null;let ty=tm}}]);

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