repo_id
stringlengths
6
101
file_path
stringlengths
2
269
content
stringlengths
367
5.14M
size
int64
367
5.14M
filename
stringlengths
1
248
ext
stringlengths
0
87
lang
stringclasses
88 values
program_lang
stringclasses
232 values
doc_type
stringclasses
5 values
quality_signal
stringlengths
2
1.9k
effective
stringclasses
2 values
hit_map
stringlengths
2
1.4k
00jacs/sveltekit-ultrafast
src/routes/blog/docs.md
# Blog 📖 If you want to target a specific SEO keyword, writing a few blog posts on your page will definitely help you gain traffic and thus, test your idea more thoroughly. In this example, we use [**Contentful**](https://www.contentful.com/), but you can use any other headless CMS (like Sanity). Setting this up should not take a lot of time. ## Why Contentful? Contentful has a free plan which allows 1 million API calls a month, which should be sufficient for most projects. Additionally, it's easy to set up. ## How does it work? On the `/blog` page we send a request to our CMS to get all the entries (but only the headlines, excerpts and slugs). With this, we can display a list of blog posts (I've limited it to 3, but you should adjust all of that to your needs). On the `/blog/[slug]` page, we send a request to our CMS based on the **slug** provided to get all the fields for a particular post. Then, we display the post's content with `@contentful/rich-text-html-renderer` and `@tailwindcss/typography`. ## How to set up? 1. Create your Contentful account. 2. Create a "content type" of a blog post: - headline (short text) - excerpt (short text) - slug (short text) - publish date (date) - content (rich text) - show (boolean) 3. (optional) Blog post can also have `author` and `category` fields which could be displayed. 4. Fill in your `.env` with `PRIVATE_CONTENTFUL_SPACE` and `PRIVATE_CONTENTFUL_ACCESS_TOKEN` which you can find in your Contetful developer dashboard. 5. Create an example blog post. ## In the future In the upcoming future, I plan to add Sanity integration as well. Also, a page dedicated to each blog author will be there with an avatar, name, bio, and a list of articles.
1,740
docs
md
en
markdown
text
{"qsc_doc_frac_chars_curly_bracket": 0.0, "qsc_doc_frac_words_redpajama_stop": 0.35338346, "qsc_doc_num_sentences": 26.0, "qsc_doc_num_words": 301, "qsc_doc_num_chars": 1740.0, "qsc_doc_num_lines": 37.0, "qsc_doc_mean_word_length": 4.25581395, "qsc_doc_frac_words_full_bracket": 0.0, "qsc_doc_frac_lines_end_with_readmore": 0.0, "qsc_doc_frac_lines_start_with_bullet": 0.0, "qsc_doc_frac_words_unique": 0.51827243, "qsc_doc_entropy_unigram": 4.74233653, "qsc_doc_frac_words_all_caps": 0.02255639, "qsc_doc_frac_lines_dupe_lines": 0.0, "qsc_doc_frac_chars_dupe_lines": 0.0, "qsc_doc_frac_chars_top_2grams": 0.0117096, "qsc_doc_frac_chars_top_3grams": 0.01092896, "qsc_doc_frac_chars_top_4grams": 0.01717408, "qsc_doc_frac_chars_dupe_5grams": 0.04059329, "qsc_doc_frac_chars_dupe_6grams": 0.04059329, "qsc_doc_frac_chars_dupe_7grams": 0.04059329, "qsc_doc_frac_chars_dupe_8grams": 0.04059329, "qsc_doc_frac_chars_dupe_9grams": 0.0, "qsc_doc_frac_chars_dupe_10grams": 0.0, "qsc_doc_frac_chars_replacement_symbols": 0.0, "qsc_doc_cate_code_related_file_name": 0.0, "qsc_doc_num_chars_sentence_length_mean": 26.203125, "qsc_doc_frac_chars_hyperlink_html_tag": 0.01666667, "qsc_doc_frac_chars_alphabet": 0.89964664, "qsc_doc_frac_chars_digital": 0.004947, "qsc_doc_frac_chars_whitespace": 0.18678161, "qsc_doc_frac_chars_hex_words": 0.0}
1
{"qsc_doc_frac_chars_replacement_symbols": 0, "qsc_doc_entropy_unigram": 0, "qsc_doc_frac_chars_top_2grams": 0, "qsc_doc_frac_chars_top_3grams": 0, "qsc_doc_frac_chars_top_4grams": 0, "qsc_doc_frac_chars_dupe_5grams": 0, "qsc_doc_frac_chars_dupe_6grams": 0, "qsc_doc_frac_chars_dupe_7grams": 0, "qsc_doc_frac_chars_dupe_8grams": 0, "qsc_doc_frac_chars_dupe_9grams": 0, "qsc_doc_frac_chars_dupe_10grams": 0, "qsc_doc_frac_chars_dupe_lines": 0, "qsc_doc_frac_lines_dupe_lines": 0, "qsc_doc_frac_lines_end_with_readmore": 0, "qsc_doc_frac_lines_start_with_bullet": 0, "qsc_doc_frac_words_all_caps": 0, "qsc_doc_mean_word_length": 0, "qsc_doc_num_chars": 0, "qsc_doc_num_lines": 0, "qsc_doc_num_sentences": 0, "qsc_doc_num_words": 0, "qsc_doc_frac_chars_hex_words": 0, "qsc_doc_frac_chars_hyperlink_html_tag": 0, "qsc_doc_frac_chars_alphabet": 0, "qsc_doc_frac_chars_digital": 0, "qsc_doc_frac_chars_whitespace": 0}
00jacs/sveltekit-ultrafast
src/routes/payment/+page.server.ts
import { fail, redirect, type Actions } from '@sveltejs/kit'; import Stripe from 'stripe'; import { PUBLIC_DOMAIN_URL } from '$env/static/public'; import { PRIVATE_STRIPE_SECRET_KEY } from '$env/static/private'; import logger from '$lib/utils/logger'; const stripe = new Stripe(PRIVATE_STRIPE_SECRET_KEY); export const actions: Actions = { checkout: async () => { let sessionUrl: string | null = ''; let error: string = ''; try { const session = await stripe.checkout.sessions.create({ line_items: [ { // Provide the exact Price ID (for example, pr_1234) of the product you want to sell price: 'price_1PKhjIBFGbeGEVoTsRLhHsvE', quantity: 1 } ], mode: 'payment', success_url: `${PUBLIC_DOMAIN_URL}/?success=true`, cancel_url: `${PUBLIC_DOMAIN_URL}/?canceled=true` }); if (!session.url) { error = 'Could not initialize a payment. Please try again later.'; } logger.success('Stripe session created successfully'); sessionUrl = session.url; } catch (err) { logger.error('An error occurred when initializing checkout: ', err); } if (error) { return fail(500, { message: error }); } if (!sessionUrl) { return fail(500, { message: 'The checkout session could not be generated. Please try again later' }); } return redirect(303, sessionUrl); } };
1,355
+page.server
ts
en
typescript
code
{"qsc_code_num_words": 164, "qsc_code_num_chars": 1355.0, "qsc_code_mean_word_length": 5.37804878, "qsc_code_frac_words_unique": 0.50609756, "qsc_code_frac_chars_top_2grams": 0.04081633, "qsc_code_frac_chars_top_3grams": 0.05102041, "qsc_code_frac_chars_top_4grams": 0.04988662, "qsc_code_frac_chars_dupe_5grams": 0.0, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.0139795, "qsc_code_frac_chars_whitespace": 0.20811808, "qsc_code_size_file_byte": 1355.0, "qsc_code_num_lines": 50.0, "qsc_code_num_chars_line_max": 91.0, "qsc_code_num_chars_line_mean": 27.1, "qsc_code_frac_chars_alphabet": 0.80801491, "qsc_code_frac_chars_comments": 0.06199262, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.04878049, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.24626279, "qsc_code_frac_chars_long_word_length": 0.02360346, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
008chen/InterpolatorShow
app/src/main/java/com/cl/interpolatordebugger/InterpolatorView.java
package com.cl.interpolatordebugger; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.PointF; import android.util.AttributeSet; import android.view.View; import android.view.animation.AnticipateInterpolator; import java.util.ArrayList; import java.util.List; /** * Created by cWX221950 on 2016/1/15. */ public class InterpolatorView extends View { ValueAnimator valueAnimator; Paint mCoordinatePaint; Paint mCurvePaint; Paint mBallPaint; int mDia; int Padding; PointF mOrigin; int mCoorDia; float mCurrentValueX; float mCurrentValueY; List<Float> mPathPoint; public void setInterpolator(android.animation.TimeInterpolator timeInterpolator) { TimeInterpolator = timeInterpolator; } TimeInterpolator TimeInterpolator; public void start() { if(valueAnimator!=null) { valueAnimator.cancel(); clear(); valueAnimator.start(); } } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int width = measureDimension(800, widthMeasureSpec); int height = measureDimension(800, heightMeasureSpec); mDia = Math.min(width, height); setMeasuredDimension(width, height); mOrigin = new PointF((float) (width - mDia) / 2 + Padding, (float) (height - mDia) / 2 + Padding); mCoorDia = mDia - Padding * 2; valueAnimator = ValueAnimator.ofFloat(0f, 1f); // valueAnimator.setInterpolator(new LinearInterpolator()); valueAnimator.setDuration(5000); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { // mCurrentValueX = animation.getAnimatedFraction(); mCurrentValueX = (float) animation.getAnimatedValue(); mCurrentValueY = TimeInterpolator.getInterpolation(mCurrentValueX); updatePath(); invalidate(); } }); } public int measureDimension(int defaultSize, int measureSpec) { int result; int specMode = MeasureSpec.getMode(measureSpec); int specSize = MeasureSpec.getSize(measureSpec); if (specMode == MeasureSpec.EXACTLY) { result = specSize; } else if (specMode == MeasureSpec.AT_MOST) { result = Math.min(defaultSize, specSize); } else { result = defaultSize; } return result; } @Override protected void onDraw(Canvas canvas) { // super.onDraw(canvas); canvas.save(); canvas.translate(mOrigin.x, mOrigin.y + mCoorDia); DrawCoordinateAxis(canvas, mCoordinatePaint); // canvas.drawPath(mPath, mCurvePaint); canvas.drawLines(convert2Array(mPathPoint), mCurvePaint); canvas.drawCircle(0, toY(mCurrentValueY), 16f,mBallPaint); canvas.restore(); } float[] convert2Array(List<Float> list){ float[] result = new float[list.size()]; for(int i =0;i<list.size();i++) { result[i] =list.get(i); } return result; } void DrawCoordinateAxis(Canvas canvas, Paint paint) { //draw xAxis canvas.drawLine(0, 0,toX(1), 0, paint); //draw yAxis canvas.drawLine(0, 0, 0, toY(1), paint); //刻度 float start = 0.2f; for (int i = 1; i <= 5; i++) { canvas.drawLine(toX(start * i), toY(0), toX(start * i), toY(0.2f) * 0.1f, paint); } for (int i = 1; i <= 5; i++) { canvas.drawLine(toX(0), toY(start * i), toX(0.2f) * 0.1f, toY(start * i), paint); } } void updatePath() { mPathPoint.add(toX(mCurrentValueX)); mPathPoint.add(toY(mCurrentValueY)); } public InterpolatorView(Context context) { super(context); init(); } public InterpolatorView(Context context, AttributeSet attrs) { super(context, attrs); init(); } private void init() { mCoordinatePaint = new Paint(); mCoordinatePaint.setStyle(Paint.Style.STROKE); mCoordinatePaint.setColor(Color.BLACK); mCoordinatePaint.setStrokeWidth(2f); mCoordinatePaint.setTextSize(20f); mCoordinatePaint.setAntiAlias(true); // Rect rect = new Rect(); // mCoordinatePaint.getTextBounds("0.0", 0, 2, rect); // Padding = Math.max(rect.width(), rect.height()); Padding =150; mCurvePaint = new Paint(); mCurvePaint.setStyle(Paint.Style.STROKE); mCurvePaint.setColor(Color.RED); mCurvePaint.setStrokeWidth(4f); mCurvePaint.setAntiAlias(true); mBallPaint = new Paint(); mBallPaint.setStyle(Paint.Style.FILL); mBallPaint.setColor(Color.BLUE); mBallPaint.setAntiAlias(true); mPathPoint =new ArrayList<>(); mPathPoint.add(0f); mPathPoint.add(0f); setInterpolator(new AnticipateInterpolator()); } public void clear() { mPathPoint.clear(); invalidate(); } public InterpolatorView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } private float toX(float x) { return x * mCoorDia; } private float toY(float y) { return - y * mCoorDia; } }
5,646
InterpolatorView
java
en
java
code
{"qsc_code_num_words": 522, "qsc_code_num_chars": 5646.0, "qsc_code_mean_word_length": 6.67816092, "qsc_code_frac_words_unique": 0.27586207, "qsc_code_frac_chars_top_2grams": 0.03729203, "qsc_code_frac_chars_top_3grams": 0.02409639, "qsc_code_frac_chars_top_4grams": 0.05507745, "qsc_code_frac_chars_dupe_5grams": 0.08060815, "qsc_code_frac_chars_dupe_6grams": 0.0464716, "qsc_code_frac_chars_dupe_7grams": 0.01606426, "qsc_code_frac_chars_dupe_8grams": 0.01606426, "qsc_code_frac_chars_dupe_9grams": 0.01606426, "qsc_code_frac_chars_dupe_10grams": 0.01606426, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01723719, "qsc_code_frac_chars_whitespace": 0.27045696, "qsc_code_size_file_byte": 5646.0, "qsc_code_num_lines": 212.0, "qsc_code_num_chars_line_max": 107.0, "qsc_code_num_chars_line_mean": 26.63207547, "qsc_code_frac_chars_alphabet": 0.82908473, "qsc_code_frac_chars_comments": 0.07686858, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0890411, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.08219178, "qsc_codejava_score_lines_no_logic": 0.2739726, "qsc_codejava_frac_words_no_modifier": 0.76923077, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0}
00jacs/sveltekit-ultrafast
src/routes/payment/docs.md
# Payments 💰 Stripe is the easiest payment provider to integrate into web applications. ## What do I need? First, you should set up your Stripe account if you don't already have one. This is necessary to handle payments. 1. Stripe secret key 2. Stripe publishable key 3. Stripe webhook secret The first two can be found here: https://dashboard.stripe.com/apikeys ### Webhook secret Once your app is live, you can create an endpoint and generate a production webhook secret here: https://dashboard.stripe.com/webhooks If you are developing your app locally, use this [guide](https://docs.stripe.com/webhooks) to generate a webhook secret. In short: 1. Install Stripe CLI (depends on your OS) 2. Log in to your Stripe account - `stripe login` 3. Forward your webhook - `stripe listen --forward-to localhost:5173/payment/webhook` - a webhook secret should show up ### Filling the .env file Once you have all 3 keys, you can fill in the `.env` file: ```makefile PUBLIC_STRIPE_PUBLISHABLE_KEY="your stripe publishable key" PRIVATE_STRIPE_SECRET_KEY="your stripe secret key" PRIVATE_STRIPE_WEBHOOK_SECRET="your stripe webhook secret" ``` ## How it works? You generate a checkout session link in the `+page.server.ts` file. The user is then redirected to this page. After the purchase has been completed, the `webhook/+server.ts` receives a `POST` request with the new payment status so that we know if it has been succesful or not. We can process the payment however we want - we can input that into our Supabase database or we can just send an email - it's completely up to you and it's app-dependent. ## Ready-to-go pricing pages You can use one of the fully implemented pricing pages (in the `/lib/components/page/pricing`).
1,741
docs
md
en
markdown
text
{"qsc_doc_frac_chars_curly_bracket": 0.0, "qsc_doc_frac_words_redpajama_stop": 0.31926121, "qsc_doc_num_sentences": 28.0, "qsc_doc_num_words": 293, "qsc_doc_num_chars": 1741.0, "qsc_doc_num_lines": 47.0, "qsc_doc_mean_word_length": 4.52901024, "qsc_doc_frac_words_full_bracket": 0.0, "qsc_doc_frac_lines_end_with_readmore": 0.0, "qsc_doc_frac_lines_start_with_bullet": 0.0, "qsc_doc_frac_words_unique": 0.48122867, "qsc_doc_entropy_unigram": 4.56682153, "qsc_doc_frac_words_all_caps": 0.01846966, "qsc_doc_frac_lines_dupe_lines": 0.0, "qsc_doc_frac_chars_dupe_lines": 0.0, "qsc_doc_frac_chars_top_2grams": 0.06857573, "qsc_doc_frac_chars_top_3grams": 0.03391108, "qsc_doc_frac_chars_top_4grams": 0.03617182, "qsc_doc_frac_chars_dupe_5grams": 0.04069329, "qsc_doc_frac_chars_dupe_6grams": 0.0, "qsc_doc_frac_chars_dupe_7grams": 0.0, "qsc_doc_frac_chars_dupe_8grams": 0.0, "qsc_doc_frac_chars_dupe_9grams": 0.0, "qsc_doc_frac_chars_dupe_10grams": 0.0, "qsc_doc_frac_chars_replacement_symbols": 0.0, "qsc_doc_cate_code_related_file_name": 0.0, "qsc_doc_num_chars_sentence_length_mean": 21.92105263, "qsc_doc_frac_chars_hyperlink_html_tag": 0.01952901, "qsc_doc_frac_chars_alphabet": 0.90130226, "qsc_doc_frac_chars_digital": 0.00753941, "qsc_doc_frac_chars_whitespace": 0.16197588, "qsc_doc_frac_chars_hex_words": 0.0}
1
{"qsc_doc_frac_chars_replacement_symbols": 0, "qsc_doc_entropy_unigram": 0, "qsc_doc_frac_chars_top_2grams": 0, "qsc_doc_frac_chars_top_3grams": 0, "qsc_doc_frac_chars_top_4grams": 0, "qsc_doc_frac_chars_dupe_5grams": 0, "qsc_doc_frac_chars_dupe_6grams": 0, "qsc_doc_frac_chars_dupe_7grams": 0, "qsc_doc_frac_chars_dupe_8grams": 0, "qsc_doc_frac_chars_dupe_9grams": 0, "qsc_doc_frac_chars_dupe_10grams": 0, "qsc_doc_frac_chars_dupe_lines": 0, "qsc_doc_frac_lines_dupe_lines": 0, "qsc_doc_frac_lines_end_with_readmore": 0, "qsc_doc_frac_lines_start_with_bullet": 0, "qsc_doc_frac_words_all_caps": 0, "qsc_doc_mean_word_length": 0, "qsc_doc_num_chars": 0, "qsc_doc_num_lines": 0, "qsc_doc_num_sentences": 0, "qsc_doc_num_words": 0, "qsc_doc_frac_chars_hex_words": 0, "qsc_doc_frac_chars_hyperlink_html_tag": 0, "qsc_doc_frac_chars_alphabet": 0, "qsc_doc_frac_chars_digital": 0, "qsc_doc_frac_chars_whitespace": 0}
008chen/InterpolatorShow
app/src/main/java/com/cl/interpolatordebugger/MainActivity.java
package com.cl.interpolatordebugger; import android.animation.TimeInterpolator; import android.content.Context; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; public class MainActivity extends AppCompatActivity { RecyclerView mRecyclerView; NormalRecyclerViewAdapter mNormalRecyclerViewAdapter; InterpolatorView mInterpolatorView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mInterpolatorView = (InterpolatorView) findViewById(R.id.interpolatorview); mNormalRecyclerViewAdapter = new NormalRecyclerViewAdapter(this); mRecyclerView = (RecyclerView) findViewById(R.id.recycler_view); mRecyclerView.setLayoutManager(new GridLayoutManager(this, 2)); mRecyclerView.setHasFixedSize(true); mRecyclerView.setAdapter(mNormalRecyclerViewAdapter); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } public class NormalRecyclerViewAdapter extends RecyclerView.Adapter<NormalRecyclerViewAdapter.NormalTextViewHolder> { private final LayoutInflater mLayoutInflater; private final Context mContext; private String[] mTitles; private String[] mContents; public NormalRecyclerViewAdapter(Context context) { mTitles = context.getResources().getStringArray(R.array.interpolator_titles); mContents = context.getResources().getStringArray(R.array.interpolator_contents); mContext = context; mLayoutInflater = LayoutInflater.from(context); } @Override public NormalTextViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return new NormalTextViewHolder(mLayoutInflater.inflate(R.layout.item_text, parent, false)); } @Override public void onBindViewHolder(NormalTextViewHolder holder, int position) { holder.mTextViewTitle.setText(mTitles[position]); holder.mTextViewContent.setText(mContents[position]); } private TimeInterpolator getInterpolator(String className) { return getInterpolator("android.view.animation", className, Float.NaN); } private TimeInterpolator getInterpolator(String className,float parameter) { return getInterpolator("android.view.animation", className, parameter); } private TimeInterpolator getInterpolator(String packagename, String className, float parameter) { Class<?> interpolatorClass = null; try { interpolatorClass = Class.forName(packagename + "." + className); } catch (Exception e) { e.printStackTrace(); } try { Constructor<?> con[] = interpolatorClass.getConstructors(); if(Float.isNaN(parameter)) { return (TimeInterpolator) con[0].newInstance(); } else { return (TimeInterpolator) con[0].newInstance(parameter); } // return (TimeInterpolator) interpolatorClass.newInstance(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } return null; } @Override public int getItemCount() { return mTitles == null ? 0 : mTitles.length; } public class NormalTextViewHolder extends RecyclerView.ViewHolder { TextView mTextViewTitle; TextView mTextViewContent; NormalTextViewHolder(View view) { super(view); mTextViewTitle = (TextView) view.findViewById(R.id.text_title); mTextViewContent = (TextView) view.findViewById(R.id.text_content); view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String interpolatorStr = ((TextView) v.findViewById(R.id.text_title)).getText().toString().replace(" ", ""); if (interpolatorStr.indexOf("(") != -1) { String className = interpolatorStr.substring(0, interpolatorStr.indexOf("(")); float para = Float.valueOf(interpolatorStr.substring(interpolatorStr.indexOf("(") + 1, interpolatorStr.indexOf(")"))); TimeInterpolator timeInterpolator = getInterpolator(className, para); mInterpolatorView.setInterpolator(timeInterpolator); } else { TimeInterpolator timeInterpolator = getInterpolator(interpolatorStr); mInterpolatorView.setInterpolator(timeInterpolator); } mInterpolatorView.start(); } }); } } } }
6,373
MainActivity
java
en
java
code
{"qsc_code_num_words": 500, "qsc_code_num_chars": 6373.0, "qsc_code_mean_word_length": 8.096, "qsc_code_frac_words_unique": 0.34, "qsc_code_frac_chars_top_2grams": 0.04174901, "qsc_code_frac_chars_top_3grams": 0.0222332, "qsc_code_frac_chars_top_4grams": 0.02173913, "qsc_code_frac_chars_dupe_5grams": 0.13759881, "qsc_code_frac_chars_dupe_6grams": 0.06521739, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00239339, "qsc_code_frac_chars_whitespace": 0.27883257, "qsc_code_size_file_byte": 6373.0, "qsc_code_num_lines": 157.0, "qsc_code_num_chars_line_max": 147.0, "qsc_code_num_chars_line_mean": 40.59235669, "qsc_code_frac_chars_alphabet": 0.8783725, "qsc_code_frac_chars_comments": 0.05711596, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.13385827, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00832085, "qsc_code_frac_chars_long_word_length": 0.00732235, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejava_cate_var_zero": 0.0, "qsc_codejava_frac_lines_func_ratio": 0.09448819, "qsc_codejava_score_lines_no_logic": 0.31496063, "qsc_codejava_frac_words_no_modifier": 0.66666667, "qsc_codejava_frac_words_legal_var_name": 1.0, "qsc_codejava_frac_words_legal_func_name": 1.0, "qsc_codejava_frac_words_legal_class_name": 1.0, "qsc_codejava_frac_lines_print": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejava_cate_var_zero": 0, "qsc_codejava_frac_lines_func_ratio": 0, "qsc_codejava_score_lines_no_logic": 0, "qsc_codejava_frac_lines_print": 0}
00jacs/sveltekit-ultrafast
src/routes/docs/+layout.svelte
<script lang="ts"> import { page } from '$app/stores'; import { browser } from '$app/environment'; import { Button } from '$lib/components'; import { theme, Theme, toggleTheme } from '$lib/stores/theme'; import { Icon, Bars3, XMark, Sun, Moon } from 'svelte-hero-icons'; interface DocsItem { title: string; href: string; children: { title: string; href: string; }[]; } const list: DocsItem[] = [ { title: 'Get started', href: '/docs/get-started', children: [] }, { title: 'Features', href: '/docs/features', children: [ { title: 'Authentication', href: '/docs/features/authentication' }, { title: 'Blog', href: '/docs/features/blog' }, { title: 'Payments', href: '/docs/features/payments' }, { title: 'Analytics', href: '/docs/features/analytics' }, { title: 'Database', href: '/docs/features/database' } ] }, { title: 'Components', href: '/docs/components', children: [ { title: '❗️ Read first', href: '/docs/components/read-first' }, { title: 'Button', href: '/docs/components/button' }, { title: 'Dialog', href: '/docs/components/dialog' }, { title: 'Checkbox', href: '/docs/components/checkbox' }, { title: 'Input number', href: '/docs/components/input-number' }, { title: 'Input text', href: '/docs/components/input-text' }, { title: 'Loader', href: '/docs/components/loader' }, { title: 'Popover', href: '/docs/components/popover' }, { title: 'Slideover', href: '/docs/components/slideover' } ] } ]; let mobileMenuOpen = false; let isLightTheme = $theme === Theme.LIGHT; $: if (mobileMenuOpen && browser) { document.body.style.overflow = 'hidden'; } else if (browser) { document.body.style.overflow = 'auto'; } $: $page.url.pathname.startsWith('/docs') && (mobileMenuOpen = false); </script> <div class="flex h-full"> <Button class="btn-ghost fixed left-3 top-3 z-50 bg-base-200 md:hidden" on:click={() => (mobileMenuOpen = !mobileMenuOpen)}> {#if mobileMenuOpen} <Icon src={XMark} class="h-6 w-6" /> {:else} <Icon src={Bars3} class="h-6 w-6" /> {/if} </Button> <nav id="navigation" class="left-0 top-0 z-40 hidden h-full w-64 flex-col justify-between overscroll-auto border-r-2 border-base-200 bg-base-200 bg-opacity-50 py-12 pl-8 pr-12 md:fixed md:flex {mobileMenuOpen ? '!fixed left-0 top-0 !block h-full w-full !bg-base-200' : ''}"> <ul class="text-base-content-secondary"> {#each list as item} <li class="relative mb-5 mt-4"> <a href={item.href} class="link mb-3 block no-underline {$page.url.pathname === item.href ? 'text-primary' : 'text-base-content-secondary'}" on:click={() => (mobileMenuOpen = false)}> {item.title} </a> {#if item.children && item.children.length} <ul class="ml-4"> {#each item.children as child} <li class="mb-2"> <a href={child.href} class="link no-underline {$page.url.pathname === child.href ? 'text-primary' : 'text-base-content-secondary'}"> {child.title} </a> </li> {/each} </ul> {/if} </li> {/each} </ul> <label class="swap swap-rotate mt-10"> <input type="checkbox" class="hidden" checked={isLightTheme} on:change={toggleTheme} /> <Icon src={Sun} class="swap-on h-5 w-5 fill-current" /> <Icon src={Moon} class="swap-off h-5 w-5 fill-current" /> </label> </nav> <main id="docs-content" class="w-[100%] p-8 md:absolute md:left-64 md:w-auto"> <slot /> </main> </div>
3,868
+layout
svelte
en
svelte
code
{"qsc_code_num_words": 453, "qsc_code_num_chars": 3868.0, "qsc_code_mean_word_length": 4.73289183, "qsc_code_frac_words_unique": 0.31788079, "qsc_code_frac_chars_top_2grams": 0.06343284, "qsc_code_frac_chars_top_3grams": 0.08395522, "qsc_code_frac_chars_top_4grams": 0.03358209, "qsc_code_frac_chars_dupe_5grams": 0.11287313, "qsc_code_frac_chars_dupe_6grams": 0.05037313, "qsc_code_frac_chars_dupe_7grams": 0.0363806, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01937984, "qsc_code_frac_chars_whitespace": 0.26628749, "qsc_code_size_file_byte": 3868.0, "qsc_code_num_lines": 170.0, "qsc_code_num_chars_line_max": 87.0, "qsc_code_num_chars_line_mean": 22.75294118, "qsc_code_frac_chars_alphabet": 0.73537703, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.12578616, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.02515723, "qsc_code_frac_chars_string_length": 0.27352637, "qsc_code_frac_chars_long_word_length": 0.10522234, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/routes/auth/docs.md
# Authentication 🙋🏽 The authentication uses the [Supabase Authentication](https://supabase.com/docs/guides/auth) which automatically takes care of most security issues and makes it effortless to create & manage users in your applications - which is valuable if you want to be **ultrafast**. ## How to set it up? In order to set up the authentication, you need to have a Supabase project active and fill in the proper keys in your `.env`: - `PUBLIC_DOMAIN_URL` - your domain url - `PUBLIC_SUPABASE_URL` - URL to your Supabase project - `PUBLIC_SUPABASE_ANON_KEY` - API key to your Supabase project Once you have those, you should be good to go 👇 ## Logging in There is a sample `/auth/login` route implemented. There is a simple form with `email` and `password`. ### Social providers There are also two examples of logging in with Social Providers (Google, GitHub) but it's easy to extend that and add more providers. In order to do that, go to your project Authentication dashboard and then go to "Providers" and fill in the necessary keys. Here is a full list of available providers: https://supabase.com/docs/guides/auth/social-login ## Logging out There is a `POST` endpoint on the `/auth/logout` route which should sign out the user. ## Signing up There is a `/auth/register` route which is very similar to the login route. The only difference is that there is an additional confirm password field. ## Error page [in progress] There is also a `/auth/error` page which shows up after the user has failed to log in (for example, through external providers). We should display a nice error message with support CTA and instructions on possible resolution.
1,675
docs
md
en
markdown
text
{"qsc_doc_frac_chars_curly_bracket": 0.0, "qsc_doc_frac_words_redpajama_stop": 0.36752137, "qsc_doc_num_sentences": 14.0, "qsc_doc_num_words": 277, "qsc_doc_num_chars": 1675.0, "qsc_doc_num_lines": 39.0, "qsc_doc_mean_word_length": 4.61732852, "qsc_doc_frac_words_full_bracket": 0.0, "qsc_doc_frac_lines_end_with_readmore": 0.0, "qsc_doc_frac_lines_start_with_bullet": 0.0, "qsc_doc_frac_words_unique": 0.4801444, "qsc_doc_entropy_unigram": 4.52720306, "qsc_doc_frac_words_all_caps": 0.01994302, "qsc_doc_frac_lines_dupe_lines": 0.0, "qsc_doc_frac_chars_dupe_lines": 0.0, "qsc_doc_frac_chars_top_2grams": 0.03283815, "qsc_doc_frac_chars_top_3grams": 0.02501955, "qsc_doc_frac_chars_top_4grams": 0.03127443, "qsc_doc_frac_chars_dupe_5grams": 0.04691165, "qsc_doc_frac_chars_dupe_6grams": 0.04691165, "qsc_doc_frac_chars_dupe_7grams": 0.0, "qsc_doc_frac_chars_dupe_8grams": 0.0, "qsc_doc_frac_chars_dupe_9grams": 0.0, "qsc_doc_frac_chars_dupe_10grams": 0.0, "qsc_doc_frac_chars_replacement_symbols": 0.0, "qsc_doc_cate_code_related_file_name": 0.0, "qsc_doc_num_chars_sentence_length_mean": 30.03703704, "qsc_doc_frac_chars_hyperlink_html_tag": 0.02328358, "qsc_doc_frac_chars_alphabet": 0.91798561, "qsc_doc_frac_chars_digital": 0.0, "qsc_doc_frac_chars_whitespace": 0.17014925, "qsc_doc_frac_chars_hex_words": 0.0}
1
{"qsc_doc_frac_chars_replacement_symbols": 0, "qsc_doc_entropy_unigram": 0, "qsc_doc_frac_chars_top_2grams": 0, "qsc_doc_frac_chars_top_3grams": 0, "qsc_doc_frac_chars_top_4grams": 0, "qsc_doc_frac_chars_dupe_5grams": 0, "qsc_doc_frac_chars_dupe_6grams": 0, "qsc_doc_frac_chars_dupe_7grams": 0, "qsc_doc_frac_chars_dupe_8grams": 0, "qsc_doc_frac_chars_dupe_9grams": 0, "qsc_doc_frac_chars_dupe_10grams": 0, "qsc_doc_frac_chars_dupe_lines": 0, "qsc_doc_frac_lines_dupe_lines": 0, "qsc_doc_frac_lines_end_with_readmore": 0, "qsc_doc_frac_lines_start_with_bullet": 0, "qsc_doc_frac_words_all_caps": 0, "qsc_doc_mean_word_length": 0, "qsc_doc_num_chars": 0, "qsc_doc_num_lines": 0, "qsc_doc_num_sentences": 0, "qsc_doc_num_words": 0, "qsc_doc_frac_chars_hex_words": 0, "qsc_doc_frac_chars_hyperlink_html_tag": 0, "qsc_doc_frac_chars_alphabet": 0, "qsc_doc_frac_chars_digital": 0, "qsc_doc_frac_chars_whitespace": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_debug.h
/** * @file lv_debug.h * */ #ifndef LV_DEBUG_H #define LV_DEBUG_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #include "../lv_conf_internal.h" #if LV_USE_DEBUG #include <stdbool.h> /********************* * DEFINES *********************/ /********************** * TYPEDEFS **********************/ /********************** * GLOBAL PROTOTYPES **********************/ bool lv_debug_check_null(const void * p); bool lv_debug_check_mem_integrity(void); bool lv_debug_check_str(const void * str); void lv_debug_log_error(const char * msg, uint64_t value); /********************** * MACROS **********************/ #ifndef LV_DEBUG_ASSERT #define LV_DEBUG_ASSERT(expr, msg, value) \ do { \ if(!(expr)) { \ LV_LOG_ERROR(__func__); \ lv_debug_log_error(msg, (uint64_t)((uintptr_t)value)); \ while(1); \ } \ } while(0) #endif /*---------------- * CHECKS *----------------*/ #ifndef LV_DEBUG_IS_NULL #define LV_DEBUG_IS_NULL(p) (lv_debug_check_null(p)) #endif #ifndef LV_DEBUG_CHECK_MEM_INTEGRITY #define LV_DEBUG_CHECK_MEM_INTEGRITY() (lv_debug_check_mem_integrity()) #endif #ifndef LV_DEBUG_IS_STR #define LV_DEBUG_IS_STR(str) (lv_debug_check_null(str) && \ lv_debug_check_str(str)) #endif /*----------------- * ASSERTS *-----------------*/ /*clang-format off*/ #if LV_USE_ASSERT_NULL # ifndef LV_ASSERT_NULL # define LV_ASSERT_NULL(p) LV_DEBUG_ASSERT(LV_DEBUG_IS_NULL(p), "NULL pointer", p); # endif #else # define LV_ASSERT_NULL(p) true #endif #if LV_USE_ASSERT_MEM # ifndef LV_ASSERT_MEM # define LV_ASSERT_MEM(p) LV_DEBUG_ASSERT(LV_DEBUG_IS_NULL(p), "Out of memory", p); # endif #else # define LV_ASSERT_MEM(p) true #endif #if LV_USE_ASSERT_MEM_INTEGRITY # ifndef LV_ASSERT_MEM_INTEGRITY # define LV_ASSERT_MEM_INTEGRITY() LV_DEBUG_ASSERT(LV_DEBUG_CHECK_MEM_INTEGRITY(), "Memory integrity error", 0); # endif #else # define LV_ASSERT_MEM_INTEGRITY() true #endif #if LV_USE_ASSERT_STR # ifndef LV_ASSERT_STR # define LV_ASSERT_STR(str) LV_DEBUG_ASSERT(LV_DEBUG_IS_STR(str), "Strange or invalid string", str); # endif #else /* LV_USE_ASSERT_OBJ == 0 */ # if LV_USE_ASSERT_NULL /*Use at least LV_ASSERT_NULL if enabled*/ # define LV_ASSERT_STR(str) LV_ASSERT_NULL(str) # else # define LV_ASSERT_STR(str) true # endif #endif #else /* LV_USE_DEBUG == 0 */ #define LV_DEBUG_ASSERT(expr, msg, value) do{}while(0) #define LV_ASSERT_NULL(p) true #define LV_ASSERT_MEM(p) true #define LV_ASSERT_MEM_INTEGRITY() true #define LV_ASSERT_STR(p) true #define LV_ASSERT_OBJ(obj, obj_type) true #endif /* LV_USE_DEBUG */ /*clang-format on*/ #ifdef __cplusplus } /* extern "C" */ #endif #endif /*LV_DEBUG_H*/
2,991
lv_debug
h
el
c
code
{"qsc_code_num_words": 398, "qsc_code_num_chars": 2991.0, "qsc_code_mean_word_length": 4.06030151, "qsc_code_frac_words_unique": 0.17336683, "qsc_code_frac_chars_top_2grams": 0.1299505, "qsc_code_frac_chars_top_3grams": 0.12128713, "qsc_code_frac_chars_top_4grams": 0.06311881, "qsc_code_frac_chars_dupe_5grams": 0.48205446, "qsc_code_frac_chars_dupe_6grams": 0.26299505, "qsc_code_frac_chars_dupe_7grams": 0.10767327, "qsc_code_frac_chars_dupe_8grams": 0.10767327, "qsc_code_frac_chars_dupe_9grams": 0.03465347, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00422119, "qsc_code_frac_chars_whitespace": 0.2079572, "qsc_code_size_file_byte": 2991.0, "qsc_code_num_lines": 133.0, "qsc_code_num_chars_line_max": 114.0, "qsc_code_num_chars_line_mean": 22.4887218, "qsc_code_frac_chars_alphabet": 0.67792317, "qsc_code_frac_chars_comments": 0.2116349, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.43421053, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.03986429, "qsc_code_frac_chars_long_word_length": 0.00890585, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.34210526, "qsc_codec_frac_lines_func_ratio": 0.30263158, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 1.0, "qsc_codec_score_lines_no_logic": 0.32894737, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 1, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_math.h
/** * @file math_base.h * */ #ifndef LV_MATH_H #define LV_MATH_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #include "../lv_conf_internal.h" #include <stdint.h> /********************* * DEFINES *********************/ #define LV_MATH_MIN(a, b) ((a) < (b) ? (a) : (b)) #define LV_MATH_MIN3(a, b, c) (LV_MATH_MIN(LV_MATH_MIN(a,b), c)) #define LV_MATH_MIN4(a, b, c, d) (LV_MATH_MIN(LV_MATH_MIN(a,b), LV_MATH_MIN(c,d))) #define LV_MATH_MAX(a, b) ((a) > (b) ? (a) : (b)) #define LV_MATH_MAX3(a, b, c) (LV_MATH_MAX(LV_MATH_MAX(a,b), c)) #define LV_MATH_MAX4(a, b, c, d) (LV_MATH_MAX(LV_MATH_MAX(a,b), LV_MATH_MAX(c,d))) #define LV_MATH_ABS(x) ((x) > 0 ? (x) : (-(x))) #define LV_MATH_UDIV255(x) ((uint32_t)((uint32_t) (x) * 0x8081) >> 0x17) #define LV_IS_SIGNED(t) (((t)(-1)) < ((t) 0)) #define LV_UMAX_OF(t) (((0x1ULL << ((sizeof(t) * 8ULL) - 1ULL)) - 1ULL) | (0xFULL << ((sizeof(t) * 8ULL) - 4ULL))) #define LV_SMAX_OF(t) (((0x1ULL << ((sizeof(t) * 8ULL) - 1ULL)) - 1ULL) | (0x7ULL << ((sizeof(t) * 8ULL) - 4ULL))) #define LV_MAX_OF(t) ((unsigned long) (LV_IS_SIGNED(t) ? LV_SMAX_OF(t) : LV_UMAX_OF(t))) #define LV_TRIGO_SIN_MAX 32767 #define LV_TRIGO_SHIFT 15 /**< >> LV_TRIGO_SHIFT to normalize*/ #define LV_BEZIER_VAL_MAX 1024 /**< Max time in Bezier functions (not [0..1] to use integers) */ #define LV_BEZIER_VAL_SHIFT 10 /**< log2(LV_BEZIER_VAL_MAX): used to normalize up scaled values*/ /********************** * TYPEDEFS **********************/ typedef struct { uint16_t i; uint16_t f; } lv_sqrt_res_t; /********************** * GLOBAL PROTOTYPES **********************/ //! @cond Doxygen_Suppress /** * Return with sinus of an angle * @param angle * @return sinus of 'angle'. sin(-90) = -32767, sin(90) = 32767 */ LV_ATTRIBUTE_FAST_MEM int16_t _lv_trigo_sin(int16_t angle); //! @endcond /** * Calculate a value of a Cubic Bezier function. * @param t time in range of [0..LV_BEZIER_VAL_MAX] * @param u0 start values in range of [0..LV_BEZIER_VAL_MAX] * @param u1 control value 1 values in range of [0..LV_BEZIER_VAL_MAX] * @param u2 control value 2 in range of [0..LV_BEZIER_VAL_MAX] * @param u3 end values in range of [0..LV_BEZIER_VAL_MAX] * @return the value calculated from the given parameters in range of [0..LV_BEZIER_VAL_MAX] */ int32_t _lv_bezier3(uint32_t t, int32_t u0, int32_t u1, int32_t u2, int32_t u3); /** * Calculate the atan2 of a vector. * @param x * @param y * @return the angle in degree calculated from the given parameters in range of [0..360] */ uint16_t _lv_atan2(int x, int y); //! @cond Doxygen_Suppress /** * Get the square root of a number * @param x integer which square root should be calculated * @param q store the result here. q->i: integer part, q->f: fractional part in 1/256 unit * @param mask: optional to skip some iterations if the magnitude of the root is known. * Set to 0x8000 by default. * If root < 16: mask = 0x80 * If root < 256: mask = 0x800 * Else: mask = 0x8000 */ LV_ATTRIBUTE_FAST_MEM void _lv_sqrt(uint32_t x, lv_sqrt_res_t * q, uint32_t mask); //! @endcond /** * Calculate the integer exponents. * @param base * @param power * @return base raised to the power exponent */ int64_t _lv_pow(int64_t base, int8_t exp); /********************** * MACROS **********************/ #ifdef __cplusplus } /* extern "C" */ #endif #endif
3,435
lv_math
h
en
c
code
{"qsc_code_num_words": 560, "qsc_code_num_chars": 3435.0, "qsc_code_mean_word_length": 3.59285714, "qsc_code_frac_words_unique": 0.29464286, "qsc_code_frac_chars_top_2grams": 0.05964215, "qsc_code_frac_chars_top_3grams": 0.05367793, "qsc_code_frac_chars_top_4grams": 0.055666, "qsc_code_frac_chars_dupe_5grams": 0.30119284, "qsc_code_frac_chars_dupe_6grams": 0.25248509, "qsc_code_frac_chars_dupe_7grams": 0.21272366, "qsc_code_frac_chars_dupe_8grams": 0.21272366, "qsc_code_frac_chars_dupe_9grams": 0.13817097, "qsc_code_frac_chars_dupe_10grams": 0.03479125, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.05220743, "qsc_code_frac_chars_whitespace": 0.16914119, "qsc_code_size_file_byte": 3435.0, "qsc_code_num_lines": 123.0, "qsc_code_num_chars_line_max": 115.0, "qsc_code_num_chars_line_mean": 27.92682927, "qsc_code_frac_chars_alphabet": 0.65276804, "qsc_code_frac_chars_comments": 0.54177584, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.13888889, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01397713, "qsc_code_frac_chars_long_word_length": 0.0133418, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00635324, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.47222222, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.52777778, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 1, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 1, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
00Julian00/AI-radio
ttsManager.py
from elevenlabs import VoiceSettings from elevenlabs.client import ElevenLabs import queue import io import soundfile as sf from audioManager import play_audio_data import os import json script_dir = os.path.dirname(os.path.abspath(__file__)) config_path = os.path.join(script_dir, 'settings.config') with open(config_path, 'r') as config_file: config = json.load(config_file) elevenlabs_api_key = config['elevenlabs_api_key'] male_host_voice = config['male_host_voice'] female_host_voice = config['female_host_voice'] client = ElevenLabs( api_key=elevenlabs_api_key ) queue = queue.Queue() voice_settings = VoiceSettings( stability=0.5, similarity_boost=1, style=1, use_speaker_boost=True, ) def process_audio_stream(audio_stream): # Collect all bytes audio_data = bytes() for chunk in audio_stream: if chunk is not None and len(chunk) > 0: audio_data += chunk audio_buffer = io.BytesIO(audio_data) data, samplerate = sf.read(audio_buffer) return data def generate_conversation(conversation: list[dict]): for message in conversation: voice = male_host_voice if message["role"] == "assistant" else female_host_voice audio = client.generate( text=message["content"], voice=voice, model="eleven_multilingual_v2", voice_settings=voice_settings ) processed_audio = process_audio_stream(audio) if len(processed_audio) > 0: queue.put(processed_audio) def play_audio_from_queue(): while not queue.empty(): audio = queue.get() play_audio_data(audio)
1,661
ttsManager
py
en
python
code
{"qsc_code_num_words": 216, "qsc_code_num_chars": 1661.0, "qsc_code_mean_word_length": 5.09722222, "qsc_code_frac_words_unique": 0.38888889, "qsc_code_frac_chars_top_2grams": 0.04904632, "qsc_code_frac_chars_top_3grams": 0.05812897, "qsc_code_frac_chars_top_4grams": 0.0417802, "qsc_code_frac_chars_dupe_5grams": 0.0, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00537222, "qsc_code_frac_chars_whitespace": 0.21553281, "qsc_code_size_file_byte": 1661.0, "qsc_code_num_lines": 60.0, "qsc_code_num_chars_line_max": 89.0, "qsc_code_num_chars_line_mean": 27.68333333, "qsc_code_frac_chars_alphabet": 0.83960092, "qsc_code_frac_chars_comments": 0.0102348, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.06573341, "qsc_code_frac_chars_long_word_length": 0.01339014, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codepython_cate_ast": 1.0, "qsc_codepython_frac_lines_func_ratio": 0.06122449, "qsc_codepython_cate_var_zero": false, "qsc_codepython_frac_lines_pass": 0.0, "qsc_codepython_frac_lines_import": 0.16326531, "qsc_codepython_frac_lines_simplefunc": 0.0, "qsc_codepython_score_lines_no_logic": 0.24489796, "qsc_codepython_frac_lines_print": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codepython_cate_ast": 0, "qsc_codepython_frac_lines_func_ratio": 0, "qsc_codepython_cate_var_zero": 0, "qsc_codepython_frac_lines_pass": 0, "qsc_codepython_frac_lines_import": 0, "qsc_codepython_frac_lines_simplefunc": 0, "qsc_codepython_score_lines_no_logic": 0, "qsc_codepython_frac_lines_print": 0}
00Julian00/AI-radio
manager.py
import threading import random import os import json from musicManager import generate_song, play_song from speechManager import generate_conversation, generate_speech, play_speech, prepare_for_song, song_has_ended, print_conversation script_dir = os.path.dirname(os.path.abspath(__file__)) config_path = os.path.join(script_dir, 'settings.config') def get_random_genre(): with open(config_path, 'r') as config_file: config = json.load(config_file) genres = config['genres'] return random.choice(genres) def run(): next_genre = get_random_genre() has_lyrics = random.random() < 0.9 #First itteration is a bit different from the loop. thread_music_generation = threading.Thread(target=generate_song, args=(next_genre, has_lyrics)) thread_music_generation.start() conversation_length = random.randint(3, 6) generate_conversation(conversation_length, next_genre) generate_speech(conversation_length) play_speech() while True: thread_music_generation.join() thread_music_playback = threading.Thread(target=play_song) thread_music_playback.start() song_has_ended() next_genre = get_random_genre() conversation_length = random.randint(3, 6) generate_conversation(conversation_length, next_genre) generate_speech(conversation_length) thread_music_playback.join() has_lyrics = random.random() < 0.9 thread_music_generation = threading.Thread(target=generate_song, args=(next_genre, has_lyrics)) thread_music_generation.start() play_speech()
1,618
manager
py
en
python
code
{"qsc_code_num_words": 202, "qsc_code_num_chars": 1618.0, "qsc_code_mean_word_length": 5.54950495, "qsc_code_frac_words_unique": 0.31683168, "qsc_code_frac_chars_top_2grams": 0.07850134, "qsc_code_frac_chars_top_3grams": 0.09366637, "qsc_code_frac_chars_top_4grams": 0.03211418, "qsc_code_frac_chars_dupe_5grams": 0.46387154, "qsc_code_frac_chars_dupe_6grams": 0.42283675, "qsc_code_frac_chars_dupe_7grams": 0.38180196, "qsc_code_frac_chars_dupe_8grams": 0.38180196, "qsc_code_frac_chars_dupe_9grams": 0.38180196, "qsc_code_frac_chars_dupe_10grams": 0.38180196, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00603774, "qsc_code_frac_chars_whitespace": 0.18108776, "qsc_code_size_file_byte": 1618.0, "qsc_code_num_lines": 51.0, "qsc_code_num_chars_line_max": 132.0, "qsc_code_num_chars_line_mean": 31.7254902, "qsc_code_frac_chars_alphabet": 0.84, "qsc_code_frac_chars_comments": 0.03090235, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.44444444, "qsc_code_cate_autogen": 1.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01403061, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codepython_cate_ast": 1.0, "qsc_codepython_frac_lines_func_ratio": 0.05555556, "qsc_codepython_cate_var_zero": false, "qsc_codepython_frac_lines_pass": 0.0, "qsc_codepython_frac_lines_import": 0.16666667, "qsc_codepython_frac_lines_simplefunc": 0.0, "qsc_codepython_score_lines_no_logic": 0.25, "qsc_codepython_frac_lines_print": 0.02777778}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 1, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codepython_cate_ast": 0, "qsc_codepython_frac_lines_func_ratio": 0, "qsc_codepython_cate_var_zero": 0, "qsc_codepython_frac_lines_pass": 0, "qsc_codepython_frac_lines_import": 0, "qsc_codepython_frac_lines_simplefunc": 0, "qsc_codepython_score_lines_no_logic": 0, "qsc_codepython_frac_lines_print": 0}
00Julian00/AI-radio
README.md
# AI Radio Station (Proof of Concept) ## Version 1.0.1 This project is an AI generated radio station. It consists of 2 hosts having an AI generated conversation who are interruped by AI generated songs from time to time. This project is a proof of concept. ### How to use 1. Install [this](https://github.com/gcui-art/suno-api?tab=readme-ov-file) local server for interacting with [Suno](https://Suno.com). Follow the instructions listed on the github page how to install and start it. 2. Get a [Groq](https://groq.com/) and [ElevenLabs](https://elevenlabs.io/) API key and add it to the `settings.config` file. 3. Install the required packages by running `pip install -r requirements.txt`. 4. Select the correct output device in the `settings.config` file. 5. Make sure the suno-api server is running. 6. Run `StartRadio.py` to start the radio. It usually takes around 15-20 seconds before the radio starts playing. As long as there is no error in the console, just be patient. 7. Liked a song you heard? They are all stored in the `Songs` folder as well as on your Suno account. 8. To add or remove genres, you can edit the list in the `settings.config` file. 9. To change the starting topic, you can edit the `starting_topic` in the `settings.config` file. It is set to "History" by default. ### What's new in version 1.0.1 - Improved prompting for a more natural conversation. - Fixed a bug where the hosts would act like the segment is about to end. - Fixed a bug where the hosts would act like the song is about to play after it has already played. - Improved stability. - Added a "starting topic" setting. - Tweaked the values of the TTS to reduce failed generations. ### How it works The project uses llama3.2-90b to generate the conversation between the hosts. The conversation will then be converted to speech via ElevenLabs. While the hosts are talking, the project uses Suno to generate a song in the background that will then be played. While the song is playing, the next part of the conversation is generated. This loop will continue until the program is terminated. ### Limitations - Eventhough the system uses a lot of randomness, the structure is very stiff. Conversation, Song, Conversation, Song, etc. - The conversation is pretty robotic. It is very obvious that it has been AI generated. - The text to speech produces robotic and emotionless speech. - The song generation is not always perfect. At times, a song is generated that is only a few seconds long. When that happens, there is a long silence, as the system is not yet finished generating the next part of the conversation. - The Suno API is not official, which can sometimes cause problems. ### Costs The project itself is fully open source and therefore free. The services it uses (Groq, Elevenlabs and Suno) offer free tiers with limited usage rates. This means you can run this project completly for free, but you will probably hit the limits of these services very quickly. ### Tips - Sometimes, there will just be silence with no indication why in the console. If that's the case, visit [the Groq logs](https://console.groq.com/settings/logs). If you see a code 429 on one of the recent generations, this means you have hit the rate limit. Just wait for a few minutes and restart the radio. Alternativly, you can change the model in `speechManager.py` to reset the rate limits. [Here](https://console.groq.com/settings/limits) is a list of all availabe models. Note that smaller models tend to produce worse results and adhere less to the internal instructions, resulting in a worse overall experience. ### A word from me This project is a quick thrown together proof of concept. Eventhough the radio station I have described here may seem very boring and annoying to listen to, in my experience it is quite the opposite. During development I have found myself listening to the radio for hours. If you want to modify the codebase, just know that it crashes from time to time and produces weird bugs, mostly due to the Suno API beeing unofficial. ### Example Version 1.0.1 sample recording: [![Listen Now](https://img.shields.io/badge/Listen-Now-orange)](https://soundcloud.com/julian-679307453/ai-radio-sample-recording-for-version-101) Version 1.0 sample recording: [![Listen Now](https://img.shields.io/badge/Listen-Now-orange)](https://soundcloud.com/julian-679307453/ai-radio-example-recording)
4,395
README
md
en
markdown
text
{"qsc_doc_frac_chars_curly_bracket": 0.0, "qsc_doc_frac_words_redpajama_stop": 0.31584258, "qsc_doc_num_sentences": 93.0, "qsc_doc_num_words": 755, "qsc_doc_num_chars": 4395.0, "qsc_doc_num_lines": 49.0, "qsc_doc_mean_word_length": 4.50596026, "qsc_doc_frac_words_full_bracket": 0.0, "qsc_doc_frac_lines_end_with_readmore": 0.0, "qsc_doc_frac_lines_start_with_bullet": 0.0, "qsc_doc_frac_words_unique": 0.42119205, "qsc_doc_entropy_unigram": 5.1944937, "qsc_doc_frac_words_all_caps": 0.01210898, "qsc_doc_frac_lines_dupe_lines": 0.0, "qsc_doc_frac_chars_dupe_lines": 0.0, "qsc_doc_frac_chars_top_2grams": 0.01028807, "qsc_doc_frac_chars_top_3grams": 0.01058201, "qsc_doc_frac_chars_top_4grams": 0.02469136, "qsc_doc_frac_chars_dupe_5grams": 0.13374486, "qsc_doc_frac_chars_dupe_6grams": 0.09758965, "qsc_doc_frac_chars_dupe_7grams": 0.08112875, "qsc_doc_frac_chars_dupe_8grams": 0.08112875, "qsc_doc_frac_chars_dupe_9grams": 0.08112875, "qsc_doc_frac_chars_dupe_10grams": 0.08112875, "qsc_doc_frac_chars_replacement_symbols": 0.0, "qsc_doc_cate_code_related_file_name": 1.0, "qsc_doc_num_chars_sentence_length_mean": 29.95774648, "qsc_doc_frac_chars_hyperlink_html_tag": 0.10216155, "qsc_doc_frac_chars_alphabet": 0.90562466, "qsc_doc_frac_chars_digital": 0.01433207, "qsc_doc_frac_chars_whitespace": 0.15858931, "qsc_doc_frac_chars_hex_words": 0.0}
1
{"qsc_doc_frac_chars_replacement_symbols": 0, "qsc_doc_entropy_unigram": 0, "qsc_doc_frac_chars_top_2grams": 0, "qsc_doc_frac_chars_top_3grams": 0, "qsc_doc_frac_chars_top_4grams": 0, "qsc_doc_frac_chars_dupe_5grams": 0, "qsc_doc_frac_chars_dupe_6grams": 0, "qsc_doc_frac_chars_dupe_7grams": 0, "qsc_doc_frac_chars_dupe_8grams": 0, "qsc_doc_frac_chars_dupe_9grams": 0, "qsc_doc_frac_chars_dupe_10grams": 0, "qsc_doc_frac_chars_dupe_lines": 0, "qsc_doc_frac_lines_dupe_lines": 0, "qsc_doc_frac_lines_end_with_readmore": 0, "qsc_doc_frac_lines_start_with_bullet": 0, "qsc_doc_frac_words_all_caps": 0, "qsc_doc_mean_word_length": 0, "qsc_doc_num_chars": 0, "qsc_doc_num_lines": 0, "qsc_doc_num_sentences": 0, "qsc_doc_num_words": 0, "qsc_doc_frac_chars_hex_words": 0, "qsc_doc_frac_chars_hyperlink_html_tag": 0, "qsc_doc_frac_chars_alphabet": 0, "qsc_doc_frac_chars_digital": 0, "qsc_doc_frac_chars_whitespace": 0}
00Julian00/AI-radio
speechManager.py
import groq import os import json from ttsManager import generate_conversation as generate_conversation_tts, play_audio_from_queue as play_audio_from_queue_tts script_dir = os.path.dirname(os.path.abspath(__file__)) config_path = os.path.join(script_dir, 'settings.config') with open(config_path, 'r') as config_file: config = json.load(config_file) api_key = config['groq_api_key'] male_host_name = config['male_host_name'] female_host_name = config['female_host_name'] station_name = config['station_name'] starting_topic = config['starting_topic'] client = groq.Groq( api_key=api_key ) conversation_male = [] conversation_female = [] behavior_male = f"""" You are a radio host of the radio show {station_name}. You are talking to your co-host {female_host_name} (the user) and the listeners. You are entertaining and your language is very casual and natural. You talk about diverse and interesting topics. Do NOT announce a song, if not explicitly told to do so. Do NOT pretend to take user calls. Your name is {male_host_name}. Keep your answers short and concise. Do NOT add roleplaying elements to your answers, i.e. do not describe something by putting asterisks around it or putting it in brackets. Do not describe your actions. Do NOT announce that the show has ended. If a topic becomes stale, switch the topic to something else. Start with the topic {starting_topic}. You can deviate from this topic during the conversation. You are in a disucssion with your co-host, meaning you do not always agree with your co-host and you have your own interests and opinions. Do not use academic language and complex sentences. Keep your language simple and natural. Use contractions. Do not dwell on a topic for too long. Your main objective is to entertain the listeners. """ behavior_female = f"""" You are a radio host of the radio show {station_name}. You are talking to your co-host {male_host_name} (the user) and the listeners. You are entertaining and your language is very casual and natural. You talk about diverse and interesting topics. Do NOT announce a song, if not explicitly told to do so. Do NOT pretend to take user calls. Your name is {female_host_name}. Keep your answers short and concise. Do NOT add roleplaying elements to your answers, i.e. do not describe something by putting asterisks around it or putting it in brackets. Do not describe your actions. Do NOT announce that the show has ended. If a topic becomes stale, switch the topic to something else. Start with the topic {starting_topic}. You can deviate from this topic during the conversation. You are in a disucssion with your co-host, meaning you do not always agree with your co-host and you have your own interests and opinions. Do not use academic language and complex sentences. Keep your language simple and natural. Use contractions. Do not dwell on a topic for too long. Your main objective is to entertain the listeners. """ conversation_male.append({"role": "system", "content": behavior_male}) conversation_female.append({"role": "system", "content": behavior_female}) def generate_conversation(length: int, next_genre: str): for _ in range(length): if _ == length - 1: prepare_for_song(next_genre) response = prompt_llm(conversation_male) conversation_male.append({"role": "assistant", "content": response}) conversation_female.append({"role": "user", "content": response}) response = prompt_llm(conversation_female) conversation_male.append({"role": "user", "content": response}) conversation_female.append({"role": "assistant", "content": response}) def prompt_llm(conversation: list[str]): chat_completion = client.chat.completions.create( model="llama-3.2-90b-text-preview", messages=conversation ) return chat_completion.choices[0].message.content def generate_speech(length: int): result = [] count = 0 # Iterate through the reversed list for item in reversed(conversation_male): # Skip system messages if item["role"] == "system": continue result.append(item) count += 1 if count >= length * 2: break # Reverse the result to maintain original order generate_conversation_tts(list(reversed(result))) def play_speech(): play_audio_from_queue_tts() def prepare_for_song(song_genre: str): conversation_male.append({"role": "system", "content": f"You and your co-host will each get to say one more thing before the next song will be played. Song genre: {song_genre}. Your conversation will be continued after the song. Your co-host will announce the song. You will be informed when the song is over by the system."}) conversation_female.append({"role": "system", "content": f"Interrupt your conversation and announce that a song will be played next. Song genre: {song_genre}. Your conversation will be continued after the song, but you need to interrupt the conversation and announce the song. Do NOT make up a name for the song. Do NOT mention the artist. You will be informed when the song is over by the system."}) def song_has_ended(): conversation_male.append({"role": "system", "content": "The song is over. Switch the topic."}) conversation_female.append({"role": "system", "content": "The song is over. Switch the topic."}) #Force the model to acknowledge the song ending conversation_male.append({"role": "assistant", "content": "Welcome back!"}) def print_conversation(): print(conversation_male)
5,608
speechManager
py
en
python
code
{"qsc_code_num_words": 844, "qsc_code_num_chars": 5608.0, "qsc_code_mean_word_length": 4.8021327, "qsc_code_frac_words_unique": 0.24170616, "qsc_code_frac_chars_top_2grams": 0.02467308, "qsc_code_frac_chars_top_3grams": 0.01973847, "qsc_code_frac_chars_top_4grams": 0.03849001, "qsc_code_frac_chars_dupe_5grams": 0.62422897, "qsc_code_frac_chars_dupe_6grams": 0.59536146, "qsc_code_frac_chars_dupe_7grams": 0.50727856, "qsc_code_frac_chars_dupe_8grams": 0.50727856, "qsc_code_frac_chars_dupe_9grams": 0.50727856, "qsc_code_frac_chars_dupe_10grams": 0.50727856, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00195525, "qsc_code_frac_chars_whitespace": 0.17920827, "qsc_code_size_file_byte": 5608.0, "qsc_code_num_lines": 109.0, "qsc_code_num_chars_line_max": 405.0, "qsc_code_num_chars_line_mean": 51.44954128, "qsc_code_frac_chars_alphabet": 0.87855746, "qsc_code_frac_chars_comments": 0.02603424, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.15789474, "qsc_code_cate_autogen": 1.0, "qsc_code_frac_lines_long_string": 0.15789474, "qsc_code_frac_chars_string_length": 0.59299982, "qsc_code_frac_chars_long_word_length": 0.00476452, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codepython_cate_ast": 1.0, "qsc_codepython_frac_lines_func_ratio": 0.09210526, "qsc_codepython_cate_var_zero": false, "qsc_codepython_frac_lines_pass": 0.0, "qsc_codepython_frac_lines_import": 0.05263158, "qsc_codepython_frac_lines_simplefunc": 0.0, "qsc_codepython_score_lines_no_logic": 0.15789474, "qsc_codepython_frac_lines_print": 0.02631579}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 1, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codepython_cate_ast": 0, "qsc_codepython_frac_lines_func_ratio": 0, "qsc_codepython_cate_var_zero": 0, "qsc_codepython_frac_lines_pass": 0, "qsc_codepython_frac_lines_import": 0, "qsc_codepython_frac_lines_simplefunc": 0, "qsc_codepython_score_lines_no_logic": 0, "qsc_codepython_frac_lines_print": 0}
00jacs/sveltekit-ultrafast
src/routes/payment/webhook/+server.ts
import Stripe from 'stripe'; import { PRIVATE_STRIPE_SECRET_KEY, PRIVATE_STRIPE_WEBHOOK_SECRET } from '$env/static/private'; import { json, type RequestHandler } from '@sveltejs/kit'; import logger from '$lib/utils/logger'; const stripe = new Stripe(PRIVATE_STRIPE_SECRET_KEY); function fulfillOrder(lineItems: Stripe.ApiList<Stripe.LineItem>) { console.log('Fullfilling order: ', lineItems); } export const POST: RequestHandler = async ({ request }) => { logger.info('[payment webhook] Received a webhook request from Stripe.'); const signature = request.headers.get('stripe-signature'); const rawBody = await request.text(); if (!request.body) { logger.error('[payment webhook] No request body has been provided'); return json({ received: false }); } if (!signature) { logger.error('[payment webhook] No Stripe signature has been provided'); return json({ received: false }); } let event: Stripe.Event; try { if (!request.body) throw new Error('No request body'); event = stripe.webhooks.constructEvent( rawBody, signature, PRIVATE_STRIPE_WEBHOOK_SECRET ); logger.success('[payment webhook] Constructed a Stripe webhook event'); } catch (err) { logger.error('[payment webhook] Could not construct a Stripe webhook event', err); return new Response( JSON.stringify({ error: 'Could not construct a Stripe webhook event' }), { status: 500 } ); } // Handle different types of events here switch (event.type) { case 'checkout.session.completed': logger.info('[payment webhook] Received a checkout session completed event'); break; case 'invoice.paid': logger.info('[payment webhook] Received an invoice paid event'); break; case 'invoice.payment_failed': logger.info('[payment webhook] Received an invoice payment failed event'); break; default: logger.warn('[payment webhook] Received an unhandled event'); break; } if (event.type === 'checkout.session.completed') { const sessionWithItems = await stripe.checkout.sessions.retrieve( event.data.object.id, { expand: ['line_items'] } ); const lineItems = sessionWithItems.line_items; if (!lineItems) return json({ received: false }); fulfillOrder(lineItems); } return json({ received: true }); };
2,275
+server
ts
en
typescript
code
{"qsc_code_num_words": 272, "qsc_code_num_chars": 2275.0, "qsc_code_mean_word_length": 5.875, "qsc_code_frac_words_unique": 0.35661765, "qsc_code_frac_chars_top_2grams": 0.07884856, "qsc_code_frac_chars_top_3grams": 0.06883605, "qsc_code_frac_chars_top_4grams": 0.06007509, "qsc_code_frac_chars_dupe_5grams": 0.21902378, "qsc_code_frac_chars_dupe_6grams": 0.18523154, "qsc_code_frac_chars_dupe_7grams": 0.14392991, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00157978, "qsc_code_frac_chars_whitespace": 0.16527473, "qsc_code_size_file_byte": 2275.0, "qsc_code_num_lines": 82.0, "qsc_code_num_chars_line_max": 85.0, "qsc_code_num_chars_line_mean": 27.74390244, "qsc_code_frac_chars_alphabet": 0.83991575, "qsc_code_frac_chars_comments": 0.01758242, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.16176471, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.32662192, "qsc_code_frac_chars_long_word_length": 0.03310962, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/routes/docs/get-started/+page.svelte
<script lang="ts"> import { DocsCode, DocsPage } from '$lib/components/page/docs'; </script> <DocsPage title="Get started" subtitle="This page will give you everything you need to get started with developing your app with this boilerplate."> <p class="mb-8"> Firstly, all the code is fully open-source and freely available on GitHub <a href="https://github.com/jacobxcoder/sveltekit-ultrafast/" class="link link-primary" target="_blank"> here. </a> In case you find any issues or have any suggestions, feel free to open an issue there. </p> <div class="mb-12"> <h2 class="mb-4 text-xl font-bold text-base-content">Step 1: clone the repository</h2> <p class="mb-4"> In order to start, you need to clone the repository to have it locally. </p> <DocsCode language="bash" code="git clone https://github.com/jacobxcoder/sveltekit-ultrafast.git" /> </div> <div class="mb-12"> <h2 class="mb-4 text-xl font-bold text-base-content"> Step 2: install all the packages </h2> <p class="mb-4"> In order to be able to run the project locally, you need to install all the packages. </p> <DocsCode language="bash" code="npm install" /> </div> <div class="mb-12"> <h2 class="mb-4 text-xl font-bold text-base-content"> Step 3: run the project locally! </h2> <p class="mb-4"> Now, after the two steps above, you should be able to run the demo project locally. </p> <DocsCode language="bash" code="npm run dev" /> </div> <div class="mb-12"> <h2 class="mb-4 text-xl font-bold text-base-content"> Step 4: Define what you want to build </h2> <p class="mb-4"> The next steps will be highly project-specific. These are the features that you may want to look into: </p> <ul> <li>- Authentication</li> <li>- Database</li> <li>- Payments</li> <li>- Analytics</li> <li>- Blog</li> </ul> <p class="mt-4"> You can find example pages for each of these features in the `/routes` directory. </p> </div> </DocsPage>
2,032
+page
svelte
en
svelte
code
{"qsc_code_num_words": 328, "qsc_code_num_chars": 2032.0, "qsc_code_mean_word_length": 4.07621951, "qsc_code_frac_words_unique": 0.41768293, "qsc_code_frac_chars_top_2grams": 0.06806283, "qsc_code_frac_chars_top_3grams": 0.04786836, "qsc_code_frac_chars_top_4grams": 0.03590127, "qsc_code_frac_chars_dupe_5grams": 0.37397158, "qsc_code_frac_chars_dupe_6grams": 0.33657442, "qsc_code_frac_chars_dupe_7grams": 0.20119671, "qsc_code_frac_chars_dupe_8grams": 0.20119671, "qsc_code_frac_chars_dupe_9grams": 0.17127898, "qsc_code_frac_chars_dupe_10grams": 0.17127898, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01843884, "qsc_code_frac_chars_whitespace": 0.19931102, "qsc_code_size_file_byte": 2032.0, "qsc_code_num_lines": 81.0, "qsc_code_num_chars_line_max": 89.0, "qsc_code_num_chars_line_mean": 25.08641975, "qsc_code_frac_chars_alphabet": 0.80331899, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.36923077, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.20374016, "qsc_code_frac_chars_long_word_length": 0.01230315, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/routes/docs/components/checkbox/+page.svelte
<script lang="ts"> import { Checkbox } from '$lib/components'; import { DocsPage, DocsCode, DocsNote, DocsPreview } from '$lib/components/page/docs'; </script> <DocsPage title="Checkbox"> <p class="mb-6">To use the Checkbox component, import it from '$lib/components'.</p> <DocsCode class="mb-8" language="typescript" code={`import { Checkbox } from '$lib/components';`} /> <p class="mb-4">Then, use it in your Svelte template:</p> <DocsCode class="mb-8" language="html" code={` <Checkbox id="checkbox1" name="example" checked={true} label="Check me" /> <Checkbox id="checkbox2" name="example2" label="Another option" /> `} /> <DocsPreview class="mb-8"> <div class="flex flex-col gap-2"> <Checkbox id="checkbox1" name="example" checked={true} label="Check me" /> <Checkbox id="checkbox2" name="example2" label="Another option" /> </div> </DocsPreview> <p class="mb-8"> The Checkbox component is a simple Svelte component that accepts several props: </p> <DocsCode class="mb-8" language="typescript" code={` id: string | undefined = undefined; name: string = ''; checked: boolean = false; label: string = ''; containerClass: string = ''; labelClass: string = ''; inputClass: string = ''; `} /> <p class="mb-8"> The Checkbox component is based on <a href="https://daisyui.com/components/checkbox/" class="link link-primary" target="_blank"> DaisyUI checkbox </a> so for more customization options, you can refer to their documentation. </p> </DocsPage>
1,524
+page
svelte
en
svelte
code
{"qsc_code_num_words": 197, "qsc_code_num_chars": 1524.0, "qsc_code_mean_word_length": 5.18274112, "qsc_code_frac_words_unique": 0.44162437, "qsc_code_frac_chars_top_2grams": 0.05484819, "qsc_code_frac_chars_top_3grams": 0.04701273, "qsc_code_frac_chars_top_4grams": 0.04701273, "qsc_code_frac_chars_dupe_5grams": 0.42213516, "qsc_code_frac_chars_dupe_6grams": 0.36141038, "qsc_code_frac_chars_dupe_7grams": 0.33692458, "qsc_code_frac_chars_dupe_8grams": 0.33692458, "qsc_code_frac_chars_dupe_9grams": 0.19980411, "qsc_code_frac_chars_dupe_10grams": 0.19980411, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01169135, "qsc_code_frac_chars_whitespace": 0.15813648, "qsc_code_size_file_byte": 1524.0, "qsc_code_num_lines": 60.0, "qsc_code_num_chars_line_max": 88.0, "qsc_code_num_chars_line_mean": 25.4, "qsc_code_frac_chars_alphabet": 0.78409977, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.4, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.2152231, "qsc_code_frac_chars_long_word_length": 0.0164042, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/routes/auth/login/+page.server.ts
import type { Actions } from './$types'; import { fail, redirect } from '@sveltejs/kit'; import { PUBLIC_DOMAIN_URL } from '$env/static/public'; import { logger } from '$lib/utils/logger'; import z from 'zod'; import { zfd } from 'zod-form-data'; import { formDataToObject } from '$lib/utils/form'; const LoginUserSchema = zfd.formData({ email: zfd.text(z.string().email('Invalid email address')), password: zfd.text(z.string().min(6, 'At least 6 characters')) }); type LoginUserSchema = z.infer<typeof LoginUserSchema>; export const actions: Actions = { login: async ({ request, locals: { supabase } }) => { const formData = await request.formData(); let user: LoginUserSchema; try { user = LoginUserSchema.parse(formData); } catch (e) { logger.info('[auth] Invalid form data: ', e); return fail(400, { message: 'Invalid form data', errors: e instanceof z.ZodError ? e.flatten() : null, formData: formDataToObject<LoginUserSchema>(formData) }); } const { error } = await supabase.auth.signInWithPassword({ ...user }); if (error) { logger.info('[auth] Coud not log in the user: ', error); return fail(400, { message: 'Could not log in. Please check your email and password.', formData: formDataToObject<LoginUserSchema>(formData) }); } else { logger.success('[auth] User logged in successfully; email: ' + user.email); return redirect(303, '/private'); } }, loginWithGoogle: async ({ locals: { supabase } }) => { const { data, error: err } = await supabase.auth.signInWithOAuth({ provider: 'google', options: { redirectTo: `${PUBLIC_DOMAIN_URL}/auth/callback` } }); if (err) { logger.warn('[auth] Could not log in the user with Google: ', err); return redirect(303, '/auth/error'); } if (data.url) { logger.success('[auth] User logged in successfully with Google: ', data.url); return redirect(302, data.url); } }, loginWithGitHub: async ({ locals: { supabase } }) => { const { data, error: err } = await supabase.auth.signInWithOAuth({ provider: 'github', options: { redirectTo: `${PUBLIC_DOMAIN_URL}/auth/callback` } }); if (err) { logger.warn('[auth] Could not log in the user with GitHub: ', err); return redirect(303, '/auth/error'); } if (data.url) { logger.success('[auth] User logged in successfully with GitHub: ', data.url); return redirect(302, data.url); } } /** * NOTE: You can easily add more login methods here * loginWithFacebook, loginWithX, etc. * Docs: https://supabase.com/docs/guides/auth#social-auth */ };
2,595
+page.server
ts
en
typescript
code
{"qsc_code_num_words": 312, "qsc_code_num_chars": 2595.0, "qsc_code_mean_word_length": 5.42307692, "qsc_code_frac_words_unique": 0.3525641, "qsc_code_frac_chars_top_2grams": 0.0248227, "qsc_code_frac_chars_top_3grams": 0.01891253, "qsc_code_frac_chars_top_4grams": 0.01950355, "qsc_code_frac_chars_dupe_5grams": 0.36052009, "qsc_code_frac_chars_dupe_6grams": 0.35165485, "qsc_code_frac_chars_dupe_7grams": 0.35165485, "qsc_code_frac_chars_dupe_8grams": 0.29078014, "qsc_code_frac_chars_dupe_9grams": 0.29078014, "qsc_code_frac_chars_dupe_10grams": 0.29078014, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01091082, "qsc_code_frac_chars_whitespace": 0.18766859, "qsc_code_size_file_byte": 2595.0, "qsc_code_num_lines": 87.0, "qsc_code_num_chars_line_max": 81.0, "qsc_code_num_chars_line_mean": 29.82758621, "qsc_code_frac_chars_alphabet": 0.79174573, "qsc_code_frac_chars_comments": 0.06204239, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.32394366, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.2189811, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/routes/auth/register/+page.server.ts
import type { Actions } from './$types'; import { fail, redirect } from '@sveltejs/kit'; import { logger } from '$lib/utils/logger'; import z from 'zod'; import { zfd } from 'zod-form-data'; import { formDataToObject } from '$lib/utils/form'; /** * VALIDATION: we will validate our form data * using zod and zod-form-data; you can skip this step * if you don't need/want validation and you want to * fasten the process even more, but usually validation * is a good practice (even in prototypes). */ const RegisterUserSchema = zfd .formData({ email: zfd.text(z.string().email('Invalid email address')), password: zfd.text(z.string().min(6, 'At least 6 characters')), confirmPassword: zfd.text(z.string()) }) .refine((data) => data.password === data.confirmPassword, { message: 'Passwords do not match', path: ['confirmPassword'] }); type RegisterUserSchema = z.infer<typeof RegisterUserSchema>; /** * ACTIONS: we will define our actions here * these are the actions that will be called * when the user submits the form. */ export const actions: Actions = { signup: async ({ request, locals: { supabase } }) => { const formData = await request.formData(); let user: RegisterUserSchema; try { user = RegisterUserSchema.parse(formData); } catch (e) { logger.info('[auth] Invalid form data: ', e); return fail(400, { message: 'Invalid form data', errors: e instanceof z.ZodError ? e.flatten() : null, formData: formDataToObject<RegisterUserSchema>(formData) }); } const { error } = await supabase.auth.signUp({ ...user }); if (error) { logger.warn('[auth] Could not register the user: ', error); return fail(400, { message: error.message }); } else { logger.success('[auth] User registered successfully; email: ' + user.email); return redirect(303, '/register/confirmation'); } } };
1,869
+page.server
ts
en
typescript
code
{"qsc_code_num_words": 235, "qsc_code_num_chars": 1869.0, "qsc_code_mean_word_length": 5.37021277, "qsc_code_frac_words_unique": 0.48510638, "qsc_code_frac_chars_top_2grams": 0.03169572, "qsc_code_frac_chars_top_3grams": 0.01901743, "qsc_code_frac_chars_top_4grams": 0.03328051, "qsc_code_frac_chars_dupe_5grams": 0.0, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00718954, "qsc_code_frac_chars_whitespace": 0.18138042, "qsc_code_size_file_byte": 1869.0, "qsc_code_num_lines": 61.0, "qsc_code_num_chars_line_max": 80.0, "qsc_code_num_chars_line_mean": 30.63934426, "qsc_code_frac_chars_alphabet": 0.81764706, "qsc_code_frac_chars_comments": 0.20973783, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.06976744, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.19837508, "qsc_code_frac_chars_long_word_length": 0.01489506, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_VNC_Client/ESP32Berry_VNC_Client.ino
///////////////////////////////////////////////////////////////// /* ESP32 VNC Viewer For More Information: https://youtu.be/WuPIX3qxg4k Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #include <Arduino.h> #include <WiFi.h> #include <VNC.h> #include "LovyanGFX_VNCDriver.h" #include "ESP32Berry_KeyPad.h" const char* vnc_ip = "192.168.1.12"; const uint16_t vnc_port = 5900; const char* vnc_pass = "12345678"; const char* ssid = "your-ssid"; const char* password = "your-password"; // ESP32Berry KeyPad KeyPad* keyPad; int touch_x = 0; int touch_y = 0; bool hadTouchEvent = false; LGFX _lgfx; // VNC Graphic Driver with LovyanGFX for ILI9488 // https://github.com/lovyan03/LovyanGFX VNCDriver* lcd = new VNCDriver(&_lgfx); // Forked Version of Arduino VNC // https://github.com/0015/arduinoVNC/tree/0015 arduinoVNC vnc = arduinoVNC(lcd); void callbackFromKeyPad(char key) { if (vnc.connected()) { int intKey = key; Serial.printf("intKey: %d\n", intKey); if (intKey == 10) { intKey = 0xff0d; // ENTER } else if (key == 9) { intKey = 0xff09; // Tab } else if (key == 8) { intKey = 0xff08; // BackSpace } else if (key == 27) { intKey = 0xff1b; // ESC } else if (key == 1) { intKey = 0xff51; // Left } else if (key == 2) { intKey = 0xff54; // Down } else if (key == 3) { intKey = 0xff52; // Up } else if (key == 4) { intKey = 0xff53; // Right } vnc.keyEvent(intKey, 0b001); vnc.keyEvent(intKey, 0b000); } } void setup(void) { Serial.begin(115200); _lgfx.init(); void (*ptr)(char) = &callbackFromKeyPad; keyPad = new KeyPad(ptr); Serial.print("Connecting to "); Serial.println(ssid); lcd->print_screen("Connecting to ", ssid, TFT_YELLOW); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); lcd->print("."); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP()); lcd->print_screen("WiFi connected!", WiFi.localIP().toString(), TFT_GREEN); Serial.println(F("[SETUP] VNC...")); vnc.begin(vnc_ip, vnc_port); vnc.setPassword(vnc_pass); // check for vnc server settings xTaskCreatePinnedToCore(vnc_task, "vnc_task", 10000, NULL, 1, NULL, 0); } void loop() {} void vnc_task(void* pvParameters) { while (1) { if (WiFi.status() != WL_CONNECTED) { lcd->print_screen("WiFi Disconnected!", "Check your WiFi", TFT_RED); vnc.reconnect(); vTaskDelay(100); } else { vnc.loop(); if (!vnc.connected()) { lcd->print_screen("Connecting VNC", getVNCAddr(), TFT_GREEN); vTaskDelay(5000); } else { keyPad->checkKeyInput(); touchEvent(); } } vTaskDelay(1); } } void touchEvent() { uint16_t x, y; if (_lgfx.getTouch(&x, &y)) { hadTouchEvent = true; touch_x = x; touch_y = y; vnc.mouseEvent(touch_x, touch_y, 0b001); } else if (hadTouchEvent) { hadTouchEvent = false; vnc.mouseEvent(touch_x, touch_y, 0b000); } } String getVNCAddr() { return String(vnc_ip) + String(":") + String(vnc_port); }
3,408
ESP32Berry_VNC_Client
ino
en
cpp
code
{"qsc_code_num_words": 388, "qsc_code_num_chars": 3408.0, "qsc_code_mean_word_length": 4.87113402, "qsc_code_frac_words_unique": 0.37371134, "qsc_code_frac_chars_top_2grams": 0.02539683, "qsc_code_frac_chars_top_3grams": 0.03333333, "qsc_code_frac_chars_top_4grams": 0.02539683, "qsc_code_frac_chars_dupe_5grams": 0.02645503, "qsc_code_frac_chars_dupe_6grams": 0.02645503, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.04760047, "qsc_code_frac_chars_whitespace": 0.24794601, "qsc_code_size_file_byte": 3408.0, "qsc_code_num_lines": 147.0, "qsc_code_num_chars_line_max": 78.0, "qsc_code_num_chars_line_mean": 23.18367347, "qsc_code_frac_chars_alphabet": 0.68981662, "qsc_code_frac_chars_comments": 0.157277, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.04040404, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.08179603, "qsc_code_frac_chars_long_word_length": 0.00730943, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.01670727, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codecpp_frac_lines_preprocessor_directives": 0.05050505, "qsc_codecpp_frac_lines_func_ratio": 0.09090909, "qsc_codecpp_cate_bitsstdc": 0.0, "qsc_codecpp_nums_lines_main": 0.0, "qsc_codecpp_frac_lines_goto": 0.0, "qsc_codecpp_cate_var_zero": 0.0, "qsc_codecpp_score_lines_no_logic": 0.14141414, "qsc_codecpp_frac_lines_print": 0.01010101}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codecpp_frac_lines_func_ratio": 0, "qsc_codecpp_nums_lines_main": 0, "qsc_codecpp_score_lines_no_logic": 0, "qsc_codecpp_frac_lines_preprocessor_directives": 0, "qsc_codecpp_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_AppTelegram.cpp
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #include "ESP32Berry_AppTelegram.h" static AppTelegram *instance = NULL; extern "C" void telegram_app_cb_thunk(FB_msg &msg) { instance->telegram_cb(msg); } AppTelegram::AppTelegram(Display *display, System *system, Network *network, const char *title) : AppBase(display, system, network, title) { _bodyScreen = display->get_body_screen(); instance = this; this->draw_ui(); _network->telegram_set_cb_func(telegram_app_cb_thunk); } AppTelegram::~AppTelegram() {} extern "C" void tg_textarea_event_cb_thunk(lv_event_t *e) { instance->_display->textarea_event_cb(e); } extern "C" void tg_event_handler_thunk(lv_event_t *e) { instance->tg_event_handler(e); } void AppTelegram::tg_event_handler(lv_event_t *e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t *obj = lv_event_get_target(e); if (code == LV_EVENT_CLICKED) { if (obj == sendBtn) { String myMsg = String(lv_textarea_get_text(textField)); myMsg.trim(); if (myMsg.length() > 0) { if (_network->telegram_send(myMsg)) { this->add_msg(true, myMsg); } else { lv_textarea_set_text(textField, ""); } } } } } void AppTelegram::draw_ui() { lv_style_init(&msgStyle); lv_style_set_bg_color(&msgStyle, lv_color_white()); lv_style_set_pad_ver(&msgStyle, 8); lv_style_set_border_color(&msgStyle, lv_palette_main(LV_PALETTE_BLUE)); lv_style_set_border_width(&msgStyle, 2); lv_style_set_border_opa(&msgStyle, LV_OPA_50); lv_style_set_border_side(&msgStyle, LV_BORDER_SIDE_BOTTOM); lv_obj_t *bottomPart = lv_obj_create(appMain); lv_obj_remove_style_all(bottomPart); lv_obj_set_size(bottomPart, DISPLAY_WIDTH, 50); lv_obj_align(bottomPart, LV_ALIGN_BOTTOM_MID, 0, 20); lv_obj_clear_flag(bottomPart, LV_OBJ_FLAG_SCROLLABLE); textField = lv_textarea_create(bottomPart); lv_obj_set_size(textField, DISPLAY_WIDTH * 2 / 3 - 10, 40); lv_obj_align(textField, LV_ALIGN_LEFT_MID, 10, 0); lv_textarea_set_placeholder_text(textField, "typing?"); lv_obj_add_event_cb(textField, tg_textarea_event_cb_thunk, LV_EVENT_FOCUSED, NULL); lv_obj_add_event_cb(textField, tg_textarea_event_cb_thunk, LV_EVENT_DEFOCUSED, NULL); sendBtn = lv_btn_create(bottomPart); lv_obj_set_size(sendBtn, DISPLAY_WIDTH * 1 / 3 - 20, 40); lv_obj_align(sendBtn, LV_ALIGN_RIGHT_MID, 0, 0); lv_obj_t *btnLabel = lv_label_create(sendBtn); lv_label_set_text(btnLabel, "Send"); lv_obj_center(btnLabel); lv_obj_add_event_cb(sendBtn, tg_event_handler_thunk, LV_EVENT_CLICKED, NULL); msgList = lv_list_create(appMain); lv_obj_set_size(msgList, DISPLAY_WIDTH, 180); lv_obj_align_to(msgList, bottomPart, LV_ALIGN_OUT_TOP_MID, 0, -2); } void AppTelegram::add_msg(bool isMine, String msg) { lv_obj_t *text = lv_list_add_text(msgList, msg.c_str()); lv_obj_add_style(text, &msgStyle, 0); lv_label_set_long_mode(text, LV_LABEL_LONG_WRAP); lv_obj_set_style_text_align(text, isMine ? LV_TEXT_ALIGN_RIGHT : LV_TEXT_ALIGN_LEFT, 0); lv_obj_scroll_to_y(msgList, lv_obj_get_scroll_y(msgList) + lv_obj_get_height(msgList), LV_ANIM_ON); if (isMine) lv_textarea_set_text(textField, ""); } void AppTelegram::close_app() { _network->telegram_reset_cb_func(); if (appMain != NULL) { lv_obj_del_async(appMain); appMain = NULL; delete this; } } void AppTelegram::telegram_cb(FB_msg &msg) { String telegramMsg = "[" + msg.username + "] - " + msg.text; this->add_msg(false, telegramMsg); }
3,745
ESP32Berry_AppTelegram
cpp
en
cpp
code
{"qsc_code_num_words": 549, "qsc_code_num_chars": 3745.0, "qsc_code_mean_word_length": 4.41347905, "qsc_code_frac_words_unique": 0.25865209, "qsc_code_frac_chars_top_2grams": 0.0536525, "qsc_code_frac_chars_top_3grams": 0.02476269, "qsc_code_frac_chars_top_4grams": 0.02641354, "qsc_code_frac_chars_dupe_5grams": 0.17086257, "qsc_code_frac_chars_dupe_6grams": 0.14238547, "qsc_code_frac_chars_dupe_7grams": 0.0895584, "qsc_code_frac_chars_dupe_8grams": 0.04374742, "qsc_code_frac_chars_dupe_9grams": 0.04374742, "qsc_code_frac_chars_dupe_10grams": 0.04374742, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01265432, "qsc_code_frac_chars_whitespace": 0.13484646, "qsc_code_size_file_byte": 3745.0, "qsc_code_num_lines": 113.0, "qsc_code_num_chars_line_max": 102.0, "qsc_code_num_chars_line_mean": 33.14159292, "qsc_code_frac_chars_alphabet": 0.73518519, "qsc_code_frac_chars_comments": 0.07209613, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.02298851, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01237054, "qsc_code_frac_chars_long_word_length": 0.00690449, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codecpp_frac_lines_preprocessor_directives": 0.01149425, "qsc_codecpp_frac_lines_func_ratio": 0.03448276, "qsc_codecpp_cate_bitsstdc": 0.0, "qsc_codecpp_nums_lines_main": 0.0, "qsc_codecpp_frac_lines_goto": 0.0, "qsc_codecpp_cate_var_zero": 0.0, "qsc_codecpp_score_lines_no_logic": 0.04597701, "qsc_codecpp_frac_lines_print": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codecpp_frac_lines_func_ratio": 0, "qsc_codecpp_nums_lines_main": 0, "qsc_codecpp_score_lines_no_logic": 0, "qsc_codecpp_frac_lines_preprocessor_directives": 0, "qsc_codecpp_frac_lines_print": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_bidi.c
/** * @file lv_bidi.c * */ /********************* * INCLUDES *********************/ #include <stddef.h> #include "lv_bidi.h" #include "lv_txt.h" #include "../lv_misc/lv_mem.h" #if LV_USE_BIDI /********************* * DEFINES *********************/ #define LV_BIDI_BRACKLET_DEPTH 4 // Highest bit of the 16-bit pos_conv value specifies whether this pos is RTL or not #define GET_POS(x) ((x) & 0x7FFF) #define IS_RTL_POS(x) (((x) & 0x8000) != 0) #define SET_RTL_POS(x, is_rtl) (GET_POS(x) | ((is_rtl)? 0x8000: 0)) /********************** * TYPEDEFS **********************/ typedef struct { uint32_t bracklet_pos; lv_bidi_dir_t dir; } bracket_stack_t; /********************** * STATIC PROTOTYPES **********************/ static uint32_t lv_bidi_get_next_paragraph(const char * txt); static lv_bidi_dir_t lv_bidi_get_letter_dir(uint32_t letter); static bool lv_bidi_letter_is_weak(uint32_t letter); static bool lv_bidi_letter_is_rtl(uint32_t letter); static bool lv_bidi_letter_is_neutral(uint32_t letter); static lv_bidi_dir_t get_next_run(const char * txt, lv_bidi_dir_t base_dir, uint32_t max_len, uint32_t * len, uint16_t * pos_conv_len); static void rtl_reverse(char * dest, const char * src, uint32_t len, uint16_t * pos_conv_out, uint16_t pos_conv_rd_base, uint16_t pos_conv_len); static uint32_t char_change_to_pair(uint32_t letter); static lv_bidi_dir_t bracket_process(const char * txt, uint32_t next_pos, uint32_t len, uint32_t letter, lv_bidi_dir_t base_dir); static void fill_pos_conv(uint16_t * out, uint16_t len, uint16_t index); static uint32_t get_txt_len(const char * txt, uint32_t max_len); /********************** * STATIC VARIABLES **********************/ static const uint8_t bracket_left[] = {"<({["}; static const uint8_t bracket_right[] = {">)}]"}; static bracket_stack_t br_stack[LV_BIDI_BRACKLET_DEPTH]; static uint8_t br_stack_p; /********************** * MACROS **********************/ /********************** * GLOBAL FUNCTIONS **********************/ /** * Convert a text to get the characters in the correct visual order according to * Unicode Bidirectional Algorithm * @param str_in the text to process * @param str_out store the result here. Has the be `strlen(str_in)` length * @param base_dir `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` */ void _lv_bidi_process(const char * str_in, char * str_out, lv_bidi_dir_t base_dir) { if(base_dir == LV_BIDI_DIR_AUTO) base_dir = _lv_bidi_detect_base_dir(str_in); uint32_t par_start = 0; uint32_t par_len; while(str_in[par_start] == '\n' || str_in[par_start] == '\r') { str_out[par_start] = str_in[par_start]; par_start ++; } while(str_in[par_start] != '\0') { par_len = lv_bidi_get_next_paragraph(&str_in[par_start]); _lv_bidi_process_paragraph(&str_in[par_start], &str_out[par_start], par_len, base_dir, NULL, 0); par_start += par_len; while(str_in[par_start] == '\n' || str_in[par_start] == '\r') { str_out[par_start] = str_in[par_start]; par_start ++; } } str_out[par_start] = '\0'; } /** * Auto-detect the direction of a text based on the first strong character * @param txt the text to process * @return `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` */ lv_bidi_dir_t _lv_bidi_detect_base_dir(const char * txt) { uint32_t i = 0; uint32_t letter; while(txt[i] != '\0') { letter = _lv_txt_encoded_next(txt, &i); lv_bidi_dir_t dir; dir = lv_bidi_get_letter_dir(letter); if(dir == LV_BIDI_DIR_RTL || dir == LV_BIDI_DIR_LTR) return dir; } /*If there were no strong char earlier return with the default base dir */ if(LV_BIDI_BASE_DIR_DEF == LV_BIDI_DIR_AUTO) return LV_BIDI_DIR_LTR; else return LV_BIDI_BASE_DIR_DEF; } /** * Get the logical position of a character in a line * @param str_in the input string. Can be only one line. * @param bidi_txt internally the text is bidi processed which buffer can be get here. * If not required anymore has to freed with `lv_mem_free()` * Can be `NULL` is unused * @param len length of the line in character count * @param base_dir base direction of the text: `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` * @param visual_pos the visual character position which logical position should be get * @param is_rtl tell the the char at `visual_pos` is RTL or LTR context * @return the logical character position */ uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_bidi_dir_t base_dir, uint32_t visual_pos, bool * is_rtl) { uint32_t pos_conv_len = get_txt_len(str_in, len); char * buf = _lv_mem_buf_get(len + 1); if(buf == NULL) return (uint16_t) -1; uint16_t * pos_conv_buf = _lv_mem_buf_get(pos_conv_len * sizeof(uint16_t)); if(pos_conv_buf == NULL) { _lv_mem_buf_release(buf); return (uint16_t) -1; } if(bidi_txt) *bidi_txt = buf; _lv_bidi_process_paragraph(str_in, bidi_txt ? *bidi_txt : NULL, len, base_dir, pos_conv_buf, pos_conv_len); if(is_rtl) *is_rtl = IS_RTL_POS(pos_conv_buf[visual_pos]); if(bidi_txt == NULL) _lv_mem_buf_release(buf); uint16_t res = GET_POS(pos_conv_buf[visual_pos]); _lv_mem_buf_release(pos_conv_buf); return res; } /** * Get the visual position of a character in a line * @param str_in the input string. Can be only one line. * @param bidi_txt internally the text is bidi processed which buffer can be get here. * If not required anymore has to freed with `lv_mem_free()` * Can be `NULL` is unused * @param len length of the line in character count * @param base_dir base direction of the text: `LV_BIDI_DIR_LTR` or `LV_BIDI_DIR_RTL` * @param logical_pos the logical character position which visual position should be get * @param is_rtl tell the the char at `logical_pos` is RTL or LTR context * @return the visual character position */ uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t len, lv_bidi_dir_t base_dir, uint32_t logical_pos, bool * is_rtl) { uint32_t pos_conv_len = get_txt_len(str_in, len); char * buf = _lv_mem_buf_get(len + 1); if(buf == NULL) return (uint16_t) -1; uint16_t * pos_conv_buf = _lv_mem_buf_get(pos_conv_len * sizeof(uint16_t)); if(pos_conv_buf == NULL) { _lv_mem_buf_release(buf); return (uint16_t) -1; } if(bidi_txt) *bidi_txt = buf; _lv_bidi_process_paragraph(str_in, bidi_txt ? *bidi_txt : NULL, len, base_dir, pos_conv_buf, pos_conv_len); for(uint16_t i = 0; i < pos_conv_len; i++) { if(GET_POS(pos_conv_buf[i]) == logical_pos) { if(is_rtl) *is_rtl = IS_RTL_POS(pos_conv_buf[i]); _lv_mem_buf_release(pos_conv_buf); if(bidi_txt == NULL) _lv_mem_buf_release(buf); return i; } } _lv_mem_buf_release(pos_conv_buf); if(bidi_txt == NULL) _lv_mem_buf_release(buf); return (uint16_t) -1; } /** * Bidi process a paragraph of text * @param str_in the string to process * @param str_out store the result here * @param len length of the text * @param base_dir base dir of the text * @param pos_conv_out an `uint16_t` array to store the related logical position of the character. * Can be `NULL` is unused * @param pos_conv_len length of `pos_conv_out` in element count */ void _lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len, lv_bidi_dir_t base_dir, uint16_t * pos_conv_out, uint16_t pos_conv_len) { uint32_t run_len = 0; lv_bidi_dir_t run_dir; uint32_t rd = 0; uint32_t wr; uint16_t pos_conv_run_len = 0; uint16_t pos_conv_rd = 0; uint16_t pos_conv_wr; if(base_dir == LV_BIDI_DIR_AUTO) base_dir = _lv_bidi_detect_base_dir(str_in); if(base_dir == LV_BIDI_DIR_RTL) { wr = len; pos_conv_wr = pos_conv_len; } else { wr = 0; pos_conv_wr = 0; } if(str_out) str_out[len] = '\0'; lv_bidi_dir_t dir = base_dir; /*Empty the bracket stack*/ br_stack_p = 0; /*Process neutral chars in the beginning*/ while(rd < len) { uint32_t letter = _lv_txt_encoded_next(str_in, &rd); pos_conv_rd++; dir = lv_bidi_get_letter_dir(letter); if(dir == LV_BIDI_DIR_NEUTRAL) dir = bracket_process(str_in, rd, len, letter, base_dir); if(dir != LV_BIDI_DIR_NEUTRAL && dir != LV_BIDI_DIR_WEAK) break; } if(rd && str_in[rd] != '\0') { _lv_txt_encoded_prev(str_in, &rd); pos_conv_rd--; } if(rd) { if(base_dir == LV_BIDI_DIR_LTR) { if(str_out) { _lv_memcpy(&str_out[wr], str_in, rd); wr += rd; } if(pos_conv_out) { fill_pos_conv(&pos_conv_out[pos_conv_wr], pos_conv_rd, 0); pos_conv_wr += pos_conv_rd; } } else { wr -= rd; pos_conv_wr -= pos_conv_rd; rtl_reverse(str_out ? &str_out[wr] : NULL, str_in, rd, pos_conv_out ? &pos_conv_out[pos_conv_wr] : NULL, 0, pos_conv_rd); } } /*Get and process the runs*/ while(rd < len && str_in[rd]) { run_dir = get_next_run(&str_in[rd], base_dir, len - rd, &run_len, &pos_conv_run_len); if(base_dir == LV_BIDI_DIR_LTR) { if(run_dir == LV_BIDI_DIR_LTR) { if(str_out) _lv_memcpy(&str_out[wr], &str_in[rd], run_len); if(pos_conv_out) fill_pos_conv(&pos_conv_out[pos_conv_wr], pos_conv_run_len, pos_conv_rd); } else rtl_reverse(str_out ? &str_out[wr] : NULL, &str_in[rd], run_len, pos_conv_out ? &pos_conv_out[pos_conv_wr] : NULL, pos_conv_rd, pos_conv_run_len); wr += run_len; pos_conv_wr += pos_conv_run_len; } else { wr -= run_len; pos_conv_wr -= pos_conv_run_len; if(run_dir == LV_BIDI_DIR_LTR) { if(str_out) _lv_memcpy(&str_out[wr], &str_in[rd], run_len); if(pos_conv_out) fill_pos_conv(&pos_conv_out[pos_conv_wr], pos_conv_run_len, pos_conv_rd); } else rtl_reverse(str_out ? &str_out[wr] : NULL, &str_in[rd], run_len, pos_conv_out ? &pos_conv_out[pos_conv_wr] : NULL, pos_conv_rd, pos_conv_run_len); } rd += run_len; pos_conv_rd += pos_conv_run_len; } } /********************** * STATIC FUNCTIONS **********************/ /** * Get the next paragraph from a text * @param txt the text to process * @return the length of the current paragraph in byte count */ static uint32_t lv_bidi_get_next_paragraph(const char * txt) { uint32_t i = 0; _lv_txt_encoded_next(txt, &i); while(txt[i] != '\0' && txt[i] != '\n' && txt[i] != '\r') { _lv_txt_encoded_next(txt, &i); } return i; } /** * Get the direction of a character * @param letter an Unicode character * @return `LV_BIDI_DIR_RTL/LTR/WEAK/NEUTRAL` */ static lv_bidi_dir_t lv_bidi_get_letter_dir(uint32_t letter) { if(lv_bidi_letter_is_rtl(letter)) return LV_BIDI_DIR_RTL; if(lv_bidi_letter_is_neutral(letter)) return LV_BIDI_DIR_NEUTRAL; if(lv_bidi_letter_is_weak(letter)) return LV_BIDI_DIR_WEAK; return LV_BIDI_DIR_LTR; } /** * Tell whether a character is weak or not * @param letter an Unicode character * @return true/false */ static bool lv_bidi_letter_is_weak(uint32_t letter) { uint32_t i = 0; static const char weaks[] = "0123456789"; do { uint32_t x = _lv_txt_encoded_next(weaks, &i); if(letter == x) { return true; } } while(weaks[i] != '\0'); return false; } /** * Tell whether a character is RTL or not * @param letter an Unicode character * @return true/false */ static bool lv_bidi_letter_is_rtl(uint32_t letter) { if(letter >= 0x5d0 && letter <= 0x5ea) return true; if(letter == 0x202E) return true; /*Unicode of LV_BIDI_RLO*/ /* Check for Persian and Arabic characters [https://en.wikipedia.org/wiki/Arabic_script_in_Unicode]*/ if(letter >= 0x600 && letter <= 0x6FF) return true; if(letter >= 0xFB50 && letter <= 0xFDFF) return true; if(letter >= 0xFE70 && letter <= 0xFEFF) return true; return false; } /** * Tell whether a character is neutral or not * @param letter an Unicode character * @return true/false */ static bool lv_bidi_letter_is_neutral(uint32_t letter) { uint16_t i; static const char neutrals[] = " \t\n\r.,:;'\"`!?%/\\-=()[]{}<>@#&$|"; for(i = 0; neutrals[i] != '\0'; i++) { if(letter == (uint32_t)neutrals[i]) return true; } return false; } static uint32_t get_txt_len(const char * txt, uint32_t max_len) { uint32_t len = 0; uint32_t i = 0; while(i < max_len && txt[i] != '\0') { _lv_txt_encoded_next(txt, &i); len++; } return len; } static void fill_pos_conv(uint16_t * out, uint16_t len, uint16_t index) { uint16_t i; for(i = 0; i < len; i++) { out[i] = SET_RTL_POS(index, false); index++; } } static lv_bidi_dir_t get_next_run(const char * txt, lv_bidi_dir_t base_dir, uint32_t max_len, uint32_t * len, uint16_t * pos_conv_len) { uint32_t i = 0; uint32_t letter; uint16_t pos_conv_i = 0; letter = _lv_txt_encoded_next(txt, NULL); lv_bidi_dir_t dir = lv_bidi_get_letter_dir(letter); if(dir == LV_BIDI_DIR_NEUTRAL) dir = bracket_process(txt, 0, max_len, letter, base_dir); /*Find the first strong char. Skip the neutrals*/ while(dir == LV_BIDI_DIR_NEUTRAL || dir == LV_BIDI_DIR_WEAK) { letter = _lv_txt_encoded_next(txt, &i); pos_conv_i++; dir = lv_bidi_get_letter_dir(letter); if(dir == LV_BIDI_DIR_NEUTRAL) dir = bracket_process(txt, i, max_len, letter, base_dir); if(i >= max_len || txt[i] == '\0' || txt[i] == '\n' || txt[i] == '\r') { *len = i; *pos_conv_len = pos_conv_i; return base_dir; } } lv_bidi_dir_t run_dir = dir; uint32_t i_prev = i; uint32_t i_last_strong = i; uint16_t pos_conv_i_prev = pos_conv_i; uint16_t pos_conv_i_last_strong = pos_conv_i; /*Find the next char which has different direction*/ lv_bidi_dir_t next_dir = base_dir; while(i_prev < max_len && txt[i] != '\0' && txt[i] != '\n' && txt[i] != '\r') { letter = _lv_txt_encoded_next(txt, &i); pos_conv_i++; next_dir = lv_bidi_get_letter_dir(letter); if(next_dir == LV_BIDI_DIR_NEUTRAL) next_dir = bracket_process(txt, i, max_len, letter, base_dir); /*New dir found?*/ if((next_dir == LV_BIDI_DIR_RTL || next_dir == LV_BIDI_DIR_LTR) && next_dir != run_dir) { /*Include neutrals if `run_dir == base_dir` */ if(run_dir == base_dir) { *len = i_prev; *pos_conv_len = pos_conv_i_prev; } /*Exclude neutrals if `run_dir != base_dir` */ else { *len = i_last_strong; *pos_conv_len = pos_conv_i_last_strong; } return run_dir; } if(next_dir != LV_BIDI_DIR_NEUTRAL) { i_last_strong = i; pos_conv_i_last_strong = pos_conv_i; } i_prev = i; pos_conv_i_prev = pos_conv_i; } /*Handle end of of string. Apply `base_dir` on trailing neutrals*/ /*Include neutrals if `run_dir == base_dir` */ if(run_dir == base_dir) { *len = i_prev; *pos_conv_len = pos_conv_i_prev; } /*Exclude neutrals if `run_dir != base_dir` */ else { *len = i_last_strong; *pos_conv_len = pos_conv_i_last_strong; } return run_dir; } static void rtl_reverse(char * dest, const char * src, uint32_t len, uint16_t * pos_conv_out, uint16_t pos_conv_rd_base, uint16_t pos_conv_len) { uint32_t i = len; uint32_t wr = 0; uint16_t pos_conv_i = pos_conv_len; uint16_t pos_conv_wr = 0; while(i) { uint32_t letter = _lv_txt_encoded_prev(src, &i); uint16_t pos_conv_letter = --pos_conv_i; /*Keep weak letters (numbers) as LTR*/ if(lv_bidi_letter_is_weak(letter)) { uint32_t last_weak = i; uint32_t first_weak = i; uint16_t pos_conv_last_weak = pos_conv_i; uint16_t pos_conv_first_weak = pos_conv_i; while(i) { letter = _lv_txt_encoded_prev(src, &i); pos_conv_letter = --pos_conv_i; /*No need to call `char_change_to_pair` because there not such chars here*/ /*Finish on non-weak char */ /*but treat number and currency related chars as weak*/ if(lv_bidi_letter_is_weak(letter) == false && letter != '.' && letter != ',' && letter != '$' && letter != '%') { _lv_txt_encoded_next(src, &i); /*Rewind one letter*/ pos_conv_i++; first_weak = i; pos_conv_first_weak = pos_conv_i; break; } } if(i == 0) { first_weak = 0; pos_conv_first_weak = 0; } if(dest) _lv_memcpy(&dest[wr], &src[first_weak], last_weak - first_weak + 1); if(pos_conv_out) fill_pos_conv(&pos_conv_out[pos_conv_wr], pos_conv_last_weak - pos_conv_first_weak + 1, pos_conv_rd_base + pos_conv_first_weak); wr += last_weak - first_weak + 1; pos_conv_wr += pos_conv_last_weak - pos_conv_first_weak + 1; } /*Simply store in reversed order*/ else { uint32_t letter_size = _lv_txt_encoded_size((const char *)&src[i]); /*Swap arithmetical symbols*/ if(letter_size == 1) { uint32_t new_letter = letter = char_change_to_pair(letter); if(dest) dest[wr] = (uint8_t)new_letter; if(pos_conv_out) pos_conv_out[pos_conv_wr] = SET_RTL_POS(pos_conv_rd_base + pos_conv_letter, true); wr++; pos_conv_wr++; } /*Just store the letter*/ else { if(dest) _lv_memcpy(&dest[wr], &src[i], letter_size); if(pos_conv_out) pos_conv_out[pos_conv_wr] = SET_RTL_POS(pos_conv_rd_base + pos_conv_i, true); wr += letter_size; pos_conv_wr++; } } } } static uint32_t char_change_to_pair(uint32_t letter) { uint8_t i; for(i = 0; bracket_left[i] != '\0'; i++) { if(letter == bracket_left[i]) return bracket_right[i]; } for(i = 0; bracket_right[i] != '\0'; i++) { if(letter == bracket_right[i]) return bracket_left[i]; } return letter; } static lv_bidi_dir_t bracket_process(const char * txt, uint32_t next_pos, uint32_t len, uint32_t letter, lv_bidi_dir_t base_dir) { lv_bidi_dir_t bracket_dir = LV_BIDI_DIR_NEUTRAL; uint8_t i; /*Is the letter an opening bracket?*/ for(i = 0; bracket_left[i] != '\0'; i++) { if(bracket_left[i] == letter) { /* If so find it's matching closing bracket. * If a char with base dir. direction is found then the brackets will have `base_dir` direction*/ uint32_t txt_i = next_pos; while(txt_i < len) { uint32_t letter_next = _lv_txt_encoded_next(txt, &txt_i); if(letter_next == bracket_right[i]) { /*Closing bracket found*/ break; } else { /*Save the dir*/ lv_bidi_dir_t letter_dir = lv_bidi_get_letter_dir(letter_next); if(letter_dir == base_dir) { bracket_dir = base_dir; } } } /*There were no matching closing bracket*/ if(txt_i > len) return LV_BIDI_DIR_NEUTRAL; /*There where a strong char with base dir in the bracket so the dir is found.*/ if(bracket_dir != LV_BIDI_DIR_NEUTRAL && bracket_dir != LV_BIDI_DIR_WEAK) break; /*If there were no matching strong chars in the brackets then check the previous chars*/ txt_i = next_pos; if(txt_i) _lv_txt_encoded_prev(txt, &txt_i); while(txt_i > 0) { uint32_t letter_next = _lv_txt_encoded_prev(txt, &txt_i); lv_bidi_dir_t letter_dir = lv_bidi_get_letter_dir(letter_next); if(letter_dir == LV_BIDI_DIR_LTR || letter_dir == LV_BIDI_DIR_RTL) { bracket_dir = letter_dir; break; } } /*There where a previous strong char which can be used*/ if(bracket_dir != LV_BIDI_DIR_NEUTRAL) break; /*There were no strong chars before the bracket, so use the base dir.*/ if(txt_i == 0) bracket_dir = base_dir; break; } } /*The letter was an opening bracket*/ if(bracket_left[i] != '\0') { if(bracket_dir == LV_BIDI_DIR_NEUTRAL || br_stack_p == LV_BIDI_BRACKLET_DEPTH) return LV_BIDI_DIR_NEUTRAL; br_stack[br_stack_p].bracklet_pos = i; br_stack[br_stack_p].dir = bracket_dir; br_stack_p++; return bracket_dir; } else if(br_stack_p > 0) { /*Is the letter a closing bracket of the last opening?*/ if(letter == bracket_right[br_stack[br_stack_p - 1].bracklet_pos]) { bracket_dir = br_stack[br_stack_p - 1].dir; br_stack_p--; return bracket_dir; } } return LV_BIDI_DIR_NEUTRAL; } #endif /*LV_USE_BIDI*/
22,236
lv_bidi
c
en
c
code
{"qsc_code_num_words": 3333, "qsc_code_num_chars": 22236.0, "qsc_code_mean_word_length": 3.62826283, "qsc_code_frac_words_unique": 0.07470747, "qsc_code_frac_chars_top_2grams": 0.08393285, "qsc_code_frac_chars_top_3grams": 0.05209625, "qsc_code_frac_chars_top_4grams": 0.0307616, "qsc_code_frac_chars_dupe_5grams": 0.67386091, "qsc_code_frac_chars_dupe_6grams": 0.60721078, "qsc_code_frac_chars_dupe_7grams": 0.5477549, "qsc_code_frac_chars_dupe_8grams": 0.46828744, "qsc_code_frac_chars_dupe_9grams": 0.44050277, "qsc_code_frac_chars_dupe_10grams": 0.41734888, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02093197, "qsc_code_frac_chars_whitespace": 0.27810757, "qsc_code_size_file_byte": 22236.0, "qsc_code_num_lines": 664.0, "qsc_code_num_chars_line_max": 132.0, "qsc_code_num_chars_line_mean": 33.48795181, "qsc_code_frac_chars_alphabet": 0.7324321, "qsc_code_frac_chars_comments": 0.22508545, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.26932084, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00702223, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00394638, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.08196721, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.12880562, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": 0.02576112}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
00jacs/sveltekit-ultrafast
src/lib/components/index.ts
import Button from './common/button/button.svelte'; import InputText from './common/input-text/input-text.svelte'; import InputNumber from './common/input-number/input-number.svelte'; import Checkbox from './common/checkbox/checkbox.svelte'; import Popover from './common/popover/popover.svelte'; import Slideover from './common/slideover/slideover.svelte'; import Loader from './common/loader/loader.svelte'; import Dialog from './common/dialog/dialog.svelte'; // A standard notifications container component, // with a store and a function to add notifications import Notifications from './page/notifications/notifications.svelte'; import { notify } from './page/notifications/notifications-store'; // @DO: This header should be modified to include a navigation menu // for your particular application import NavigationHeader from './page/navigation-header/navigation-header.svelte'; export { Button, InputText, InputNumber, Checkbox, Popover, Slideover, Loader, Dialog, NavigationHeader, Notifications, notify };
1,030
index
ts
en
typescript
code
{"qsc_code_num_words": 124, "qsc_code_num_chars": 1030.0, "qsc_code_mean_word_length": 6.47580645, "qsc_code_frac_words_unique": 0.34677419, "qsc_code_frac_chars_top_2grams": 0.0996264, "qsc_code_frac_chars_top_3grams": 0.0373599, "qsc_code_frac_chars_top_4grams": 0.08468244, "qsc_code_frac_chars_dupe_5grams": 0.0, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.0, "qsc_code_frac_chars_whitespace": 0.1038835, "qsc_code_size_file_byte": 1030.0, "qsc_code_num_lines": 31.0, "qsc_code_num_chars_line_max": 82.0, "qsc_code_num_chars_line_mean": 33.22580645, "qsc_code_frac_chars_alphabet": 0.86998917, "qsc_code_frac_chars_comments": 0.19417476, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.4746988, "qsc_code_frac_chars_long_word_length": 0.4746988, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 1, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/lib/utils/object.ts
/** * Overview: This file contains utility functions for working with objects. */ // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-nocheck // Your TypeScript code follows /** * Creates a deep copy of an object, including functions. * @param obj - The object to clone. * @returns A deep clone of the object. */ export function deepClone<T>(obj: T): T { // eslint-disable-next-line @typescript-eslint/no-explicit-any const isObject = (value: any) => value && typeof value === 'object' && !Array.isArray(value); // eslint-disable-next-line @typescript-eslint/no-explicit-any const clone = (item: any): any => { if (item === null || typeof item !== 'object') { return item; } if (item instanceof Date) { return new Date(item); } if (Array.isArray(item)) { return item.map(clone); } if (typeof item === 'function') { return item.bind(null); } if (isObject(item)) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const copy: { [key: string]: any } = {}; Object.keys(item).forEach((key) => { copy[key] = clone(item[key]); }); return copy; } throw new Error('Unsupported type detected during deep clone'); }; return clone(obj); } /** * Recursively merges properties of two objects. * @param target - The target object to merge properties into. * @param source - The source object to merge properties from. * @returns The merged object. */ export function deepMerge<T>(target: T, source: T): T { // eslint-disable-next-line @typescript-eslint/no-explicit-any const isObject = (obj: any) => obj && typeof obj === 'object'; if (!isObject(target) || !isObject(source)) { return target; } Object.keys(source).forEach((key) => { // eslint-disable-next-line @typescript-eslint/no-explicit-any const targetValue = (target as any)[key]; // eslint-disable-next-line @typescript-eslint/no-explicit-any const sourceValue = (source as any)[key]; if (Array.isArray(targetValue) && Array.isArray(sourceValue)) { // eslint-disable-next-line @typescript-eslint/no-explicit-any (target as any)[key] = targetValue.concat(sourceValue); } else if (isObject(targetValue) && isObject(sourceValue)) { // eslint-disable-next-line @typescript-eslint/no-explicit-any (target as any)[key] = deepMerge(Object.assign({}, targetValue), sourceValue); } else { // eslint-disable-next-line @typescript-eslint/no-explicit-any (target as any)[key] = sourceValue; } }); return target; }
2,508
object
ts
en
typescript
code
{"qsc_code_num_words": 321, "qsc_code_num_chars": 2508.0, "qsc_code_mean_word_length": 5.26479751, "qsc_code_frac_words_unique": 0.26479751, "qsc_code_frac_chars_top_2grams": 0.07692308, "qsc_code_frac_chars_top_3grams": 0.10059172, "qsc_code_frac_chars_top_4grams": 0.12426036, "qsc_code_frac_chars_dupe_5grams": 0.3591716, "qsc_code_frac_chars_dupe_6grams": 0.3591716, "qsc_code_frac_chars_dupe_7grams": 0.33727811, "qsc_code_frac_chars_dupe_8grams": 0.33727811, "qsc_code_frac_chars_dupe_9grams": 0.33727811, "qsc_code_frac_chars_dupe_10grams": 0.33727811, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.0, "qsc_code_frac_chars_whitespace": 0.16866029, "qsc_code_size_file_byte": 2508.0, "qsc_code_num_lines": 86.0, "qsc_code_num_chars_line_max": 82.0, "qsc_code_num_chars_line_mean": 29.1627907, "qsc_code_frac_chars_alphabet": 0.81055156, "qsc_code_frac_chars_comments": 0.43939394, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.08888889, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.04907539, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_async.c
/** * @file lv_async.c * */ /********************* * INCLUDES *********************/ #include "lv_async.h" /********************* * DEFINES *********************/ /********************** * TYPEDEFS **********************/ /********************** * STATIC PROTOTYPES **********************/ static void lv_async_task_cb(lv_task_t * task); /********************** * STATIC VARIABLES **********************/ /********************** * MACROS **********************/ /********************** * GLOBAL FUNCTIONS **********************/ lv_res_t lv_async_call(lv_async_cb_t async_xcb, void * user_data) { /*Allocate an info structure */ lv_async_info_t * info = lv_mem_alloc(sizeof(lv_async_info_t)); if(info == NULL) return LV_RES_INV; /* Create a new task */ /* Use highest priority so that it will run before a refresh */ lv_task_t * task = lv_task_create(lv_async_task_cb, 0, LV_TASK_PRIO_HIGHEST, info); if(task == NULL) { lv_mem_free(info); return LV_RES_INV; } info->cb = async_xcb; info->user_data = user_data; /* Set the task's user data */ task->user_data = info; lv_task_set_repeat_count(task, 1); return LV_RES_OK; } /********************** * STATIC FUNCTIONS **********************/ static void lv_async_task_cb(lv_task_t * task) { lv_async_info_t * info = (lv_async_info_t *)task->user_data; info->cb(info->user_data); lv_mem_free(info); }
1,502
lv_async
c
en
c
code
{"qsc_code_num_words": 173, "qsc_code_num_chars": 1502.0, "qsc_code_mean_word_length": 3.79768786, "qsc_code_frac_words_unique": 0.33526012, "qsc_code_frac_chars_top_2grams": 0.11719939, "qsc_code_frac_chars_top_3grams": 0.06697108, "qsc_code_frac_chars_top_4grams": 0.07305936, "qsc_code_frac_chars_dupe_5grams": 0.17808219, "qsc_code_frac_chars_dupe_6grams": 0.15829528, "qsc_code_frac_chars_dupe_7grams": 0.10350076, "qsc_code_frac_chars_dupe_8grams": 0.10350076, "qsc_code_frac_chars_dupe_9grams": 0.10350076, "qsc_code_frac_chars_dupe_10grams": 0.10350076, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00166113, "qsc_code_frac_chars_whitespace": 0.19840213, "qsc_code_size_file_byte": 1502.0, "qsc_code_num_lines": 75.0, "qsc_code_num_chars_line_max": 88.0, "qsc_code_num_chars_line_mean": 20.02666667, "qsc_code_frac_chars_alphabet": 0.54401993, "qsc_code_frac_chars_comments": 0.47203728, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.16666667, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01261034, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.125, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.29166667, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": 0.04166667}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
00jacs/sveltekit-ultrafast
src/lib/components/page/footer/minimal-footer.svelte
<script lang="ts"> const links = [ { name: 'Docs', href: '/docs' }, { name: 'Authentication', href: '/auth/login' }, { name: 'Database', href: '/database-example' }, { name: 'Payments', href: '/payment' }, { name: 'Blog', href: '/blog' }, { name: 'Analytics', href: '/analytics' } ]; // If you don't want to use any of the social media links, // you can remove them from this array const socialMediaLinks: Record<string, string> = { facebook: 'https://facebook.com/your-facebook-profile', instagram: 'https://instagram.com/your-instagram-profile', twitter: 'https://twitter.com/jacob_the_coder', github: 'https://github.com/jacobxcoder', youtube: 'https://youtube.com/your-youtube-profile' } as const; </script> <footer> <div class="mx-auto max-w-7xl overflow-hidden px-6 py-20 sm:py-24 lg:px-8"> <nav class="-mb-6 columns-2 sm:flex sm:justify-center sm:space-x-12"> {#each links as { name, href }} <div class="pb-6"> <a {href} class="text-sm leading-6">{name}</a> </div> {/each} </nav> <div class="mt-10 flex justify-center space-x-10"> {#each Object.keys(socialMediaLinks) as sm} <a href={socialMediaLinks[sm]} target="_blank" class="text-base-content-secondary"> {#if sm === 'facebook'} <svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24"> <path fill-rule="evenodd" d="M22 12c0-5.523-4.477-10-10-10S2 6.477 2 12c0 4.991 3.657 9.128 8.438 9.878v-6.987h-2.54V12h2.54V9.797c0-2.506 1.492-3.89 3.777-3.89 1.094 0 2.238.195 2.238.195v2.46h-1.26c-1.243 0-1.63.771-1.63 1.562V12h2.773l-.443 2.89h-2.33v6.988C18.343 21.128 22 16.991 22 12z" clip-rule="evenodd" /> </svg> {:else if sm === 'instagram'} <svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"> <path fill-rule="evenodd" d="M12.315 2c2.43 0 2.784.013 3.808.06 1.064.049 1.791.218 2.427.465a4.902 4.902 0 011.772 1.153 4.902 4.902 0 011.153 1.772c.247.636.416 1.363.465 2.427.048 1.067.06 1.407.06 4.123v.08c0 2.643-.012 2.987-.06 4.043-.049 1.064-.218 1.791-.465 2.427a4.902 4.902 0 01-1.153 1.772 4.902 4.902 0 01-1.772 1.153c-.636.247-1.363.416-2.427.465-1.067.048-1.407.06-4.123.06h-.08c-2.643 0-2.987-.012-4.043-.06-1.064-.049-1.791-.218-2.427-.465a4.902 4.902 0 01-1.772-1.153 4.902 4.902 0 01-1.153-1.772c-.247-.636-.416-1.363-.465-2.427-.047-1.024-.06-1.379-.06-3.808v-.63c0-2.43.013-2.784.06-3.808.049-1.064.218-1.791.465-2.427a4.902 4.902 0 011.153-1.772A4.902 4.902 0 015.45 2.525c.636-.247 1.363-.416 2.427-.465C8.901 2.013 9.256 2 11.685 2h.63zm-.081 1.802h-.468c-2.456 0-2.784.011-3.807.058-.975.045-1.504.207-1.857.344-.467.182-.8.398-1.15.748-.35.35-.566.683-.748 1.15-.137.353-.3.882-.344 1.857-.047 1.023-.058 1.351-.058 3.807v.468c0 2.456.011 2.784.058 3.807.045.975.207 1.504.344 1.857.182.466.399.8.748 1.15.35.35.683.566 1.15.748.353.137.882.3 1.857.344 1.054.048 1.37.058 4.041.058h.08c2.597 0 2.917-.01 3.96-.058.976-.045 1.505-.207 1.858-.344.466-.182.8-.398 1.15-.748.35-.35.566-.683.748-1.15.137-.353.3-.882.344-1.857.048-1.055.058-1.37.058-4.041v-.08c0-2.597-.01-2.917-.058-3.96-.045-.976-.207-1.505-.344-1.858a3.097 3.097 0 00-.748-1.15 3.098 3.098 0 00-1.15-.748c-.353-.137-.882-.3-1.857-.344-1.023-.047-1.351-.058-3.807-.058zM12 6.865a5.135 5.135 0 110 10.27 5.135 5.135 0 010-10.27zm0 1.802a3.333 3.333 0 100 6.666 3.333 3.333 0 000-6.666zm5.338-3.205a1.2 1.2 0 110 2.4 1.2 1.2 0 010-2.4z" clip-rule="evenodd" /> </svg> {:else if sm === 'twitter'} <svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"> <path d="M13.6823 10.6218L20.2391 3H18.6854L12.9921 9.61788L8.44486 3H3.2002L10.0765 13.0074L3.2002 21H4.75404L10.7663 14.0113L15.5685 21H20.8131L13.6819 10.6218H13.6823ZM11.5541 13.0956L10.8574 12.0991L5.31391 4.16971H7.70053L12.1742 10.5689L12.8709 11.5655L18.6861 19.8835H16.2995L11.5541 13.096V13.0956Z" /> </svg> {:else if sm === 'github'} <svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"> <path fill-rule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clip-rule="evenodd" /> </svg> {:else if sm === 'youtube'} <svg class="h-6 w-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true"> <path fill-rule="evenodd" d="M19.812 5.418c.861.23 1.538.907 1.768 1.768C21.998 8.746 22 12 22 12s0 3.255-.418 4.814a2.504 2.504 0 0 1-1.768 1.768c-1.56.419-7.814.419-7.814.419s-6.255 0-7.814-.419a2.505 2.505 0 0 1-1.768-1.768C2 15.255 2 12 2 12s0-3.255.417-4.814a2.507 2.507 0 0 1 1.768-1.768C5.744 5 11.998 5 11.998 5s6.255 0 7.814.418ZM15.194 12 10 15V9l5.194 3Z" clip-rule="evenodd" /> </svg> {/if} </a> {/each} </div> <p class="text-base-content-secondary mt-10 text-center text-xs leading-5"> &copy; 2024 sveltekit-ultrafast, Inc. All rights reserved. </p> </div> </footer>
5,832
minimal-footer
svelte
en
svelte
code
{"qsc_code_num_words": 1250, "qsc_code_num_chars": 5832.0, "qsc_code_mean_word_length": 2.9016, "qsc_code_frac_words_unique": 0.352, "qsc_code_frac_chars_top_2grams": 0.01213124, "qsc_code_frac_chars_top_3grams": 0.01543976, "qsc_code_frac_chars_top_4grams": 0.01764544, "qsc_code_frac_chars_dupe_5grams": 0.25668597, "qsc_code_frac_chars_dupe_6grams": 0.23435346, "qsc_code_frac_chars_dupe_7grams": 0.22773642, "qsc_code_frac_chars_dupe_8grams": 0.1938241, "qsc_code_frac_chars_dupe_9grams": 0.16735594, "qsc_code_frac_chars_dupe_10grams": 0.16735594, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.44703696, "qsc_code_frac_chars_whitespace": 0.16958162, "qsc_code_size_file_byte": 5832.0, "qsc_code_num_lines": 113.0, "qsc_code_num_chars_line_max": 1608.0, "qsc_code_num_chars_line_mean": 51.61061947, "qsc_code_frac_chars_alphabet": 0.301879, "qsc_code_frac_chars_comments": 0.94050069, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.30259366, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 1, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 1, "qsc_code_frac_chars_digital": 1, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 1, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/lib/components/page/features/features-left-with-image.svelte
<script lang="ts"> import { Icon, PaintBrush, LockClosed, CurrencyDollar } from 'svelte-hero-icons'; const title = 'Deploy faster'; const subtitle = 'Prototype your apps with ready-to-go components.'; const description: string | null = null; const features = [ { icon: PaintBrush, name: 'Develop UI 10x faster.', description: ` With ready to go components and Daisy UI + Tailwind already set up, you can build your application 10 times faster than before. ` }, { icon: LockClosed, name: 'Authenticate users in seconds.', description: ` With Supabase Auth, you can authenticate users in seconds and get started with building your application right away. ` }, { icon: CurrencyDollar, name: 'Accept payments with Stripe.', description: ` Everything you need to start accepting payments with Stripe is already set up. ` } ] as const; </script> <div class="overflow-hidden py-20 sm:py-28"> <div class="mx-auto max-w-7xl px-6 lg:px-8"> <div class="mx-auto grid max-w-2xl grid-cols-1 gap-x-8 gap-y-16 sm:gap-y-20 lg:mx-0 lg:max-w-none lg:grid-cols-2"> <div class="lg:pr-8 lg:pt-4"> <div class="lg:max-w-lg"> <h2 class="text-base font-semibold leading-7 text-primary"> {title} </h2> <p class="mt-2 text-4xl font-bold tracking-tight sm:text-4xl"> {subtitle} </p> {#if description} <p class="text-base-content-secondary mt-6 text-lg leading-8"> {description} </p> {/if} <dl class="text-base-content-secondary mt-10 max-w-xl space-y-8 text-base leading-7 lg:max-w-none"> {#each features as feature} <div class="relative pl-9"> <dt class="inline font-semibold text-primary"> <Icon class="absolute left-1 top-1 h-5 w-5 text-primary" src={feature.icon} /> {feature.name} </dt> <dd class="inline"> {feature.description} </dd> </div> {/each} </dl> </div> </div> <!-- @DO: Replace your image source and alt tag --> <enhanced:img src="$lib/assets/database-example.png" alt="" class="w-[48rem] max-w-none rounded-xl shadow-xl ring-1 ring-base-200 sm:w-[57rem] md:-ml-4 lg:-ml-0" /> </div> </div> </div>
2,375
features-left-with-image
svelte
en
svelte
code
{"qsc_code_num_words": 336, "qsc_code_num_chars": 2375.0, "qsc_code_mean_word_length": 4.1875, "qsc_code_frac_words_unique": 0.45535714, "qsc_code_frac_chars_top_2grams": 0.0199005, "qsc_code_frac_chars_top_3grams": 0.01279318, "qsc_code_frac_chars_top_4grams": 0.01847903, "qsc_code_frac_chars_dupe_5grams": 0.07675906, "qsc_code_frac_chars_dupe_6grams": 0.04406539, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02817711, "qsc_code_frac_chars_whitespace": 0.26778947, "qsc_code_size_file_byte": 2375.0, "qsc_code_num_lines": 81.0, "qsc_code_num_chars_line_max": 113.0, "qsc_code_num_chars_line_mean": 29.32098765, "qsc_code_frac_chars_alphabet": 0.78090857, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.14864865, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.04054054, "qsc_code_frac_chars_string_length": 0.33557895, "qsc_code_frac_chars_long_word_length": 0.03621053, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/lib/components/page/navigation-header/navigation-header.svelte
<script lang="ts"> import { fade } from 'svelte/transition'; import { page } from '$app/stores'; import { Bars3, Icon, Plus, XMark, Sun, Moon } from 'svelte-hero-icons'; import { Button } from '$lib/components'; import { theme, Theme, toggleTheme } from '$lib/stores/theme'; // @DO: Replace those links with your own const links = [ { name: 'What is it?', href: '/', external: false }, { name: 'Documentation', href: '/docs', external: false }, { name: 'Examples', href: '/#examples', external: false }, { name: 'GitHub', href: 'https://github.com/jacobxcoder/sveltekit-ultrafast/', external: true } ] as const; let mobileMenuOpen = false; let isLightTheme = $theme === Theme.LIGHT; </script> <nav> <div class="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8"> <div class="flex h-16 justify-between"> <div class="flex"> <div class="-ml-2 mr-4 flex items-center md:hidden"> <!-- Mobile menu button --> <Button type="button" class="btn-ghost bg-transparent shadow-none" on:click={() => (mobileMenuOpen = !mobileMenuOpen)} aria-controls="mobile-menu" aria-expanded="false"> <Icon src={Bars3} class="h-6 w-6 {mobileMenuOpen ? 'hidden' : 'block'}" stroke-width="1.5" stroke="currentColor" aria-hidden="true" /> <Icon src={XMark} class="h-6 w-6 {mobileMenuOpen ? 'block' : 'hidden'}" fill="currentColor" aria-hidden="true" /> </Button> </div> <div class="flex flex-shrink-0 items-center text-primary"> <a href="/"> <!-- @DO: Your logo here <enhanced:img class="h-6 w-auto" src="$lib/assets/logo.svg" alt="@DO: Fill your company name" /> --> <!-- @DO: Remove temporary logo --> <span class="block font-mono text-sm font-semibold"> ultrafast </span> </a> </div> <div class="hidden md:ml-6 md:flex md:items-center md:space-x-4"> {#each links as link} <a href={link.href} class="rounded-md px-3 py-2 text-sm font-medium hover:bg-base-300 {link.href === '/' ? $page.url.pathname === '/' : $page.url.pathname.startsWith(link.href) ? 'text-primary' : ''}" target={link?.external ? '_blank' : '_self'}> {link.name} </a> {/each} </div> </div> <div class="flex items-center gap-2"> <!-- @DO: This is a space for your CTA --> <a href="https://github.com/gillbatesdev/sveltekit-ultrafast/" class="btn btn-primary rounded-full text-xs" target="_blank"> Clone from GitHub </a> <!-- @DO: Replace those social media links with your own. You can also add more social media links here. Or completely get rid of this section. <a href="@DO:your-facebook-link" class="btn btn-outline border-base-300" target="_blank"> <enhanced:img src="$lib/assets/icons/facebook.svg" class="h-5 w-5" /> </a> <a href="@DO:your-twitter-link" class="btn btn-outline border-base-300" target="_blank"> <enhanced:img src="$lib/assets/icons/twitter.svg" class="h-5 w-5" /> </a> <a href="@DO:your-github-link" class="btn btn-outline border-base-300" target="_blank"> <enhanced:img src="$lib/assets/icons/github.svg" class="h-6 w-6" /> </a> --> <!-- Theme toggle --> <label class="swap swap-rotate ml-3"> <input type="checkbox" class="hidden" checked={isLightTheme} on:change={toggleTheme} /> <Icon src={Sun} class="swap-on h-5 w-5 fill-current" /> <Icon src={Moon} class="swap-off h-5 w-5 fill-current" /> </label> </div> </div> </div> <!-- Mobile menu, show/hide based on menu state. --> {#if mobileMenuOpen} <div class="absolute z-50 w-full md:hidden" id="mobile-menu" transition:fade> <div class="space-y-1 bg-base-100 px-2 pb-3 pt-2 shadow sm:px-3"> {#each links as link} <a href={link.href} class="block rounded-md px-3 py-2 text-base font-medium hover:bg-base-300 {$page.url.pathname === link.href ? 'pointer-events-none bg-primary text-primary-content hover:text-primary' : ''}" target={link.external ? '_blank' : '_top'}> {link.name} </a> {/each} </div> </div> {/if} </nav>
4,577
navigation-header
svelte
en
svelte
code
{"qsc_code_num_words": 590, "qsc_code_num_chars": 4577.0, "qsc_code_mean_word_length": 4.26271186, "qsc_code_frac_words_unique": 0.3220339, "qsc_code_frac_chars_top_2grams": 0.02862823, "qsc_code_frac_chars_top_3grams": 0.01908549, "qsc_code_frac_chars_top_4grams": 0.01272366, "qsc_code_frac_chars_dupe_5grams": 0.24373757, "qsc_code_frac_chars_dupe_6grams": 0.24015905, "qsc_code_frac_chars_dupe_7grams": 0.14870775, "qsc_code_frac_chars_dupe_8grams": 0.13359841, "qsc_code_frac_chars_dupe_9grams": 0.13359841, "qsc_code_frac_chars_dupe_10grams": 0.10735586, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01847925, "qsc_code_frac_chars_whitespace": 0.27878523, "qsc_code_size_file_byte": 4577.0, "qsc_code_num_lines": 158.0, "qsc_code_num_chars_line_max": 82.0, "qsc_code_num_chars_line_mean": 28.96835443, "qsc_code_frac_chars_alphabet": 0.74341109, "qsc_code_frac_chars_comments": 0.93860607, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.28113879, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 1, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_KeyPad.h
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #pragma once #include "ESP32Berry_Config.h" class KeyPad { private: static constexpr int kMinValue[] = { 3766, 3643, 3516, 3247, 2970, 1870, 1131, 828, 500, 191, 0 }; static constexpr int kMaxValue[] = { 3876, 3753, 3626, 3357, 3080, 1980, 1241, 938, 610, 301, 80 }; static constexpr char kPad[5][11] = { { 27, 49, 50, 51, 52, 53, 54, 55, 56, 57, 48 }, { 9, 113, 119, 101, 114, 116, 121, 117, 105, 111, 112 }, { 20, 97, 115, 100, 102, 103, 104, 106, 107, 108, 8 }, { 17, 122, 120, 99, 118, 98, 110, 109, 44, 46, 13 }, { 16, 18, 93, 126, 32, 32, 63, 1, 2, 3, 4 } }; static constexpr char kSymbol[11] = { 27, 33, 64, 35, 36, 37, 94, 38, 42, 40, 41 }; typedef void (*FuncPtrChar)(char); long padTimer; bool isReady; bool isShift; bool isCapsLock; void blockInput(); int getKeyRow(int adc); public: FuncPtrChar released_cb; KeyPad(FuncPtrChar callback); ~KeyPad(); void checkKeyInput(); };
1,218
ESP32Berry_KeyPad
h
en
c
code
{"qsc_code_num_words": 164, "qsc_code_num_chars": 1218.0, "qsc_code_mean_word_length": 4.06097561, "qsc_code_frac_words_unique": 0.84756098, "qsc_code_frac_chars_top_2grams": 0.09009009, "qsc_code_frac_chars_top_3grams": 0.05405405, "qsc_code_frac_chars_top_4grams": 0.0, "qsc_code_frac_chars_dupe_5grams": 0.0, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.24563207, "qsc_code_frac_chars_whitespace": 0.20114943, "qsc_code_size_file_byte": 1218.0, "qsc_code_num_lines": 40.0, "qsc_code_num_chars_line_max": 102.0, "qsc_code_num_chars_line_mean": 30.45, "qsc_code_frac_chars_alphabet": 0.43884892, "qsc_code_frac_chars_comments": 0.22167488, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.10344828, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.02002107, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.10344828, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.27586207, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 1, "qsc_code_frac_chars_digital": 1, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_Network.h
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #pragma once #include <vector> #include <WiFi.h> #include "ESP32Berry_Config.h" #include <FastBot.h> typedef enum { NETWORK_DISCONNECTED, NETWORK_SCANNING_OFF, NETWORK_SCANNING_ON, NETWORK_CONNECTING, NETWORK_CONNECT_FAILURE, NETWORK_CONNECTED, TELEGRAM_MESSAGE, } Network_Event_t; class Network { private: FastBot *telegram; typedef void (*FuncPtrVector)(Network_Event_t, std::vector<String>); friend void ntScanTask(void* pvParameters); Network_Event_t _networkEvent; void WiFiScanner(bool isOn); void WiFiScannerStop(); void WiFiConnector(char* param); public: std::vector<String> WiFiLog; TaskHandle_t ntScanTaskHandler, ntConnectTaskHandler; FuncPtrVector network_result_cb; Network(FuncPtrVector callback); ~Network(); void WiFiCommend(Network_Event_t networkEvent, char* param); void WiFiEvent(WiFiEvent_t event, WiFiEventInfo_t info); String get_mac_address(); void set_network_status(Network_Event_t event); Network_Event_t get_network_status(); void telegram_cb(FB_msg& msg); void telegram_set_cb_func(void (*handler)(FB_msg& msg)); void telegram_remove_cb_func(); void telegram_reset_cb_func(); void telegram_enable(bool isOn); bool telegram_send(String msg); void update(); };
1,525
ESP32Berry_Network
h
en
c
code
{"qsc_code_num_words": 178, "qsc_code_num_chars": 1525.0, "qsc_code_mean_word_length": 5.75280899, "qsc_code_frac_words_unique": 0.48314607, "qsc_code_frac_chars_top_2grams": 0.0703125, "qsc_code_frac_chars_top_3grams": 0.07617188, "qsc_code_frac_chars_top_4grams": 0.04882812, "qsc_code_frac_chars_dupe_5grams": 0.0390625, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00521999, "qsc_code_frac_chars_whitespace": 0.12065574, "qsc_code_size_file_byte": 1525.0, "qsc_code_num_lines": 53.0, "qsc_code_num_chars_line_max": 71.0, "qsc_code_num_chars_line_mean": 28.77358491, "qsc_code_frac_chars_alphabet": 0.75838926, "qsc_code_frac_chars_comments": 0.17704918, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01512739, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.38095238, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.5, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 1, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_Menu.h
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #pragma once #include <lvgl.h> #include <vector> #include "ESP32Berry_Config.h" #include "ESP32Berry_Display.h" #include "ESP32Berry_System.h" typedef enum { WIFI_OFF, WIFI_ON, WIFI_CHANNEL, Battery, SDCARD, Restart, } Menu_Event_t; class Menu { private: lv_obj_t *_uiRoot; lv_obj_t *_bodyScreen; lv_obj_t *logoBtn; lv_obj_t *menuList; lv_obj_t *uiMenuWiFI; lv_obj_t *uiWiFiSwitch; lv_obj_t *uiWiFiList; lv_obj_t *uiWiFiCloseBtn; lv_obj_t *mboxConnect; lv_obj_t *mboxTitle; lv_obj_t *mboxPassword; lv_obj_t *mboxConnectBtn; lv_obj_t *mboxCloseBtn; lv_obj_t *uiMenuSDCard; lv_obj_t *uiMenuCloseBtn; lv_obj_t *uiArc; lv_obj_t *uiPercentage; lv_obj_t *uiTotalBytes; lv_obj_t *uiUsedBytes; lv_style_t borderStyle; lv_style_t batteryStyle; lv_obj_t *uiMenuBattery; lv_obj_t *uiBatteryCloseBtn; lv_obj_t *batteryMeter; lv_obj_t *uiBatteryVolts; lv_obj_t *uiBatteryPercent; void ui_menu(); void ui_menu_open(bool isOn); void ui_menu_items(); void ui_menu_wifi(); void ui_wifi_conenct_box(); void ui_menu_battery(); void ui_menu_sdcard(); void get_sdcard_info(); typedef void (*FuncPtrInt)(Menu_Event_t, char *); public: FuncPtrInt menu_event_cb; Menu(Display *display, System *system, FuncPtrInt callback); ~Menu(); Display *_display; System *_system; void menu_event_handler(lv_event_t *e); void wifi_event_cb(lv_event_t *e); void update_ui_network(std::vector<String> newWifiList); void ui_network_switch(bool isOn); void update_battery(String info); void open_menu_sdcard(); };
1,857
ESP32Berry_Menu
h
en
c
code
{"qsc_code_num_words": 257, "qsc_code_num_chars": 1857.0, "qsc_code_mean_word_length": 4.60700389, "qsc_code_frac_words_unique": 0.36964981, "qsc_code_frac_chars_top_2grams": 0.10135135, "qsc_code_frac_chars_top_3grams": 0.12162162, "qsc_code_frac_chars_top_4grams": 0.04054054, "qsc_code_frac_chars_dupe_5grams": 0.07263514, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00693132, "qsc_code_frac_chars_whitespace": 0.1453958, "qsc_code_size_file_byte": 1857.0, "qsc_code_num_lines": 80.0, "qsc_code_num_chars_line_max": 66.0, "qsc_code_num_chars_line_mean": 23.2125, "qsc_code_frac_chars_alphabet": 0.73913043, "qsc_code_frac_chars_comments": 0.1453958, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.03652393, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.21875, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.3125, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 1, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_ll.c
/** * @file lv_ll.c * Handle linked lists. * The nodes are dynamically allocated by the 'lv_mem' module, */ /********************* * INCLUDES *********************/ #include <stdint.h> #include <string.h> #include "lv_ll.h" #include "lv_mem.h" /********************* * DEFINES *********************/ #define LL_NODE_META_SIZE (sizeof(lv_ll_node_t *) + sizeof(lv_ll_node_t *)) #define LL_PREV_P_OFFSET(ll_p) (ll_p->n_size) #define LL_NEXT_P_OFFSET(ll_p) (ll_p->n_size + sizeof(lv_ll_node_t *)) /********************** * TYPEDEFS **********************/ /********************** * STATIC PROTOTYPES **********************/ static void node_set_prev(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * prev); static void node_set_next(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * next); /********************** * STATIC VARIABLES **********************/ /********************** * MACROS **********************/ /********************** * GLOBAL FUNCTIONS **********************/ /** * Initialize linked list * @param ll_dsc pointer to ll_dsc variable * @param node_size the size of 1 node in bytes */ void _lv_ll_init(lv_ll_t * ll_p, uint32_t node_size) { ll_p->head = NULL; ll_p->tail = NULL; #ifdef LV_ARCH_64 /*Round the size up to 8*/ node_size = (node_size + 7) & (~0x7); #else /*Round the size up to 4*/ node_size = (node_size + 3) & (~0x3); #endif ll_p->n_size = node_size; } /** * Add a new head to a linked list * @param ll_p pointer to linked list * @return pointer to the new head */ void * _lv_ll_ins_head(lv_ll_t * ll_p) { lv_ll_node_t * n_new; n_new = lv_mem_alloc(ll_p->n_size + LL_NODE_META_SIZE); if(n_new != NULL) { node_set_prev(ll_p, n_new, NULL); /*No prev. before the new head*/ node_set_next(ll_p, n_new, ll_p->head); /*After new comes the old head*/ if(ll_p->head != NULL) { /*If there is old head then before it goes the new*/ node_set_prev(ll_p, ll_p->head, n_new); } ll_p->head = n_new; /*Set the new head in the dsc.*/ if(ll_p->tail == NULL) { /*If there is no tail (1. node) set the tail too*/ ll_p->tail = n_new; } } return n_new; } /** * Insert a new node in front of the n_act node * @param ll_p pointer to linked list * @param n_act pointer a node * @return pointer to the new head */ void * _lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act) { lv_ll_node_t * n_new; if(NULL == ll_p || NULL == n_act) return NULL; if(_lv_ll_get_head(ll_p) == n_act) { n_new = _lv_ll_ins_head(ll_p); if(n_new == NULL) return NULL; } else { n_new = lv_mem_alloc(ll_p->n_size + LL_NODE_META_SIZE); if(n_new == NULL) return NULL; lv_ll_node_t * n_prev; n_prev = _lv_ll_get_prev(ll_p, n_act); node_set_next(ll_p, n_prev, n_new); node_set_prev(ll_p, n_new, n_prev); node_set_prev(ll_p, n_act, n_new); node_set_next(ll_p, n_new, n_act); } return n_new; } /** * Add a new tail to a linked list * @param ll_p pointer to linked list * @return pointer to the new tail */ void * _lv_ll_ins_tail(lv_ll_t * ll_p) { lv_ll_node_t * n_new; n_new = lv_mem_alloc(ll_p->n_size + LL_NODE_META_SIZE); if(n_new != NULL) { node_set_next(ll_p, n_new, NULL); /*No next after the new tail*/ node_set_prev(ll_p, n_new, ll_p->tail); /*The prev. before new is the old tail*/ if(ll_p->tail != NULL) { /*If there is old tail then the new comes after it*/ node_set_next(ll_p, ll_p->tail, n_new); } ll_p->tail = n_new; /*Set the new tail in the dsc.*/ if(ll_p->head == NULL) { /*If there is no head (1. node) set the head too*/ ll_p->head = n_new; } } return n_new; } /** * Remove the node 'node_p' from 'll_p' linked list. * It does not free the the memory of node. * @param ll_p pointer to the linked list of 'node_p' * @param node_p pointer to node in 'll_p' linked list */ void _lv_ll_remove(lv_ll_t * ll_p, void * node_p) { if(_lv_ll_get_head(ll_p) == node_p) { /*The new head will be the node after 'n_act'*/ ll_p->head = _lv_ll_get_next(ll_p, node_p); if(ll_p->head == NULL) { ll_p->tail = NULL; } else { node_set_prev(ll_p, ll_p->head, NULL); } } else if(_lv_ll_get_tail(ll_p) == node_p) { /*The new tail will be the node before 'n_act'*/ ll_p->tail = _lv_ll_get_prev(ll_p, node_p); if(ll_p->tail == NULL) { ll_p->head = NULL; } else { node_set_next(ll_p, ll_p->tail, NULL); } } else { lv_ll_node_t * n_prev = _lv_ll_get_prev(ll_p, node_p); lv_ll_node_t * n_next = _lv_ll_get_next(ll_p, node_p); node_set_next(ll_p, n_prev, n_next); node_set_prev(ll_p, n_next, n_prev); } } /** * Remove and free all elements from a linked list. The list remain valid but become empty. * @param ll_p pointer to linked list */ void _lv_ll_clear(lv_ll_t * ll_p) { void * i; void * i_next; i = _lv_ll_get_head(ll_p); i_next = NULL; while(i != NULL) { i_next = _lv_ll_get_next(ll_p, i); _lv_ll_remove(ll_p, i); lv_mem_free(i); i = i_next; } } /** * Move a node to a new linked list * @param ll_ori_p pointer to the original (old) linked list * @param ll_new_p pointer to the new linked list * @param node pointer to a node * @param head true: be the head in the new list * false be the head in the new list */ void _lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool head) { _lv_ll_remove(ll_ori_p, node); if(head) { /*Set node as head*/ node_set_prev(ll_new_p, node, NULL); node_set_next(ll_new_p, node, ll_new_p->head); if(ll_new_p->head != NULL) { /*If there is old head then before it goes the new*/ node_set_prev(ll_new_p, ll_new_p->head, node); } ll_new_p->head = node; /*Set the new head in the dsc.*/ if(ll_new_p->tail == NULL) { /*If there is no tail (first node) set the tail too*/ ll_new_p->tail = node; } } else { /*Set node as tail*/ node_set_prev(ll_new_p, node, ll_new_p->tail); node_set_next(ll_new_p, node, NULL); if(ll_new_p->tail != NULL) { /*If there is old tail then after it goes the new*/ node_set_next(ll_new_p, ll_new_p->tail, node); } ll_new_p->tail = node; /*Set the new tail in the dsc.*/ if(ll_new_p->head == NULL) { /*If there is no head (first node) set the head too*/ ll_new_p->head = node; } } } /** * Return with head node of the linked list * @param ll_p pointer to linked list * @return pointer to the head of 'll_p' */ void * _lv_ll_get_head(const lv_ll_t * ll_p) { void * head = NULL; if(ll_p != NULL) { head = ll_p->head; } return head; } /** * Return with tail node of the linked list * @param ll_p pointer to linked list * @return pointer to the head of 'll_p' */ void * _lv_ll_get_tail(const lv_ll_t * ll_p) { void * tail = NULL; if(ll_p != NULL) { tail = ll_p->tail; } return tail; } /** * Return with the pointer of the next node after 'n_act' * @param ll_p pointer to linked list * @param n_act pointer a node * @return pointer to the next node */ void * _lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act) { if(ll_p == NULL) return NULL; /* Pointer to the next node is stored in the end of this node. * Go there and return the address found there */ const lv_ll_node_t * n_act_d = n_act; n_act_d += LL_NEXT_P_OFFSET(ll_p); return *((lv_ll_node_t **)n_act_d); } /** * Return with the pointer of the previous node after 'n_act' * @param ll_p pointer to linked list * @param n_act pointer a node * @return pointer to the previous node */ void * _lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act) { if(ll_p == NULL) return NULL; /* Pointer to the prev. node is stored in the end of this node. * Go there and return the address found there */ const lv_ll_node_t * n_act_d = n_act; n_act_d += LL_PREV_P_OFFSET(ll_p); return *((lv_ll_node_t **)n_act_d); } /** * Return the length of the linked list. * @param ll_p pointer to linked list * @return length of the linked list */ uint32_t _lv_ll_get_len(const lv_ll_t * ll_p) { uint32_t len = 0; void * node; for(node = _lv_ll_get_head(ll_p); node != NULL; node = _lv_ll_get_next(ll_p, node)) { len++; } return len; } /** * Move a node before an other node in the same linked list * @param ll_p pointer to a linked list * @param n_act pointer to node to move * @param n_after pointer to a node which should be after `n_act` */ void _lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after) { if(n_act == n_after) return; /*Can't move before itself*/ void * n_before; if(n_after != NULL) n_before = _lv_ll_get_prev(ll_p, n_after); else n_before = _lv_ll_get_tail(ll_p); /*if `n_after` is NULL `n_act` should be the new tail*/ if(n_act == n_before) return; /*Already before `n_after`*/ /*It's much easier to remove from the list and add again*/ _lv_ll_remove(ll_p, n_act); /*Add again by setting the prev. and next nodes*/ node_set_next(ll_p, n_before, n_act); node_set_prev(ll_p, n_act, n_before); node_set_prev(ll_p, n_after, n_act); node_set_next(ll_p, n_act, n_after); /*If `n_act` was moved before NULL then it become the new tail*/ if(n_after == NULL) ll_p->tail = n_act; /*If `n_act` was moved before `NULL` then it's the new head*/ if(n_before == NULL) ll_p->head = n_act; } /** * Check if a linked list is empty * @param ll_p pointer to a linked list * @return true: the linked list is empty; false: not empty */ bool _lv_ll_is_empty(lv_ll_t * ll_p) { if(ll_p == NULL) return true; if(ll_p->head == NULL && ll_p->tail == NULL) return true; return false; } /********************** * STATIC FUNCTIONS **********************/ /** * Set the previous node pointer of a node * @param ll_p pointer to linked list * @param act pointer to a node which prev. node pointer should be set * @param prev pointer to a node which should be the previous node before 'act' */ static void node_set_prev(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * prev) { if(act == NULL) return; /*Can't set the prev node of `NULL`*/ uint8_t * act8 = (uint8_t *) act; act8 += LL_PREV_P_OFFSET(ll_p); lv_ll_node_t ** act_node_p = (lv_ll_node_t **) act8; lv_ll_node_t ** prev_node_p = (lv_ll_node_t **) &prev; *act_node_p = *prev_node_p; } /** * Set the 'next node pointer' of a node * @param ll_p pointer to linked list * @param act pointer to a node which next node pointer should be set * @param next pointer to a node which should be the next node before 'act' */ static void node_set_next(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * next) { if(act == NULL) return; /*Can't set the next node of `NULL`*/ uint8_t * act8 = (uint8_t *) act; act8 += LL_NEXT_P_OFFSET(ll_p); lv_ll_node_t ** act_node_p = (lv_ll_node_t **) act8; lv_ll_node_t ** next_node_p = (lv_ll_node_t **) &next; *act_node_p = *next_node_p; }
11,597
lv_ll
c
en
c
code
{"qsc_code_num_words": 2041, "qsc_code_num_chars": 11597.0, "qsc_code_mean_word_length": 3.11464968, "qsc_code_frac_words_unique": 0.0744733, "qsc_code_frac_chars_top_2grams": 0.0547428, "qsc_code_frac_chars_top_3grams": 0.0364952, "qsc_code_frac_chars_top_4grams": 0.0410571, "qsc_code_frac_chars_dupe_5grams": 0.68459965, "qsc_code_frac_chars_dupe_6grams": 0.60736196, "qsc_code_frac_chars_dupe_7grams": 0.51266321, "qsc_code_frac_chars_dupe_8grams": 0.430549, "qsc_code_frac_chars_dupe_9grams": 0.33679409, "qsc_code_frac_chars_dupe_10grams": 0.28551203, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.0034634, "qsc_code_frac_chars_whitespace": 0.25308269, "qsc_code_size_file_byte": 11597.0, "qsc_code_num_lines": 423.0, "qsc_code_num_chars_line_max": 101.0, "qsc_code_num_chars_line_mean": 27.41607565, "qsc_code_frac_chars_alphabet": 0.73043177, "qsc_code_frac_chars_comments": 0.41924636, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.21818182, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00222717, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00089087, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.09545455, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.14545455, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": 0.04545455}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_async.h
/** * @file lv_async.h * */ #ifndef LV_ASYNC_H #define LV_ASYNC_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #include "lv_task.h" #include "lv_types.h" /********************* * DEFINES *********************/ /********************** * TYPEDEFS **********************/ /** * Type for async callback. */ typedef void (*lv_async_cb_t)(void *); typedef struct _lv_async_info_t { lv_async_cb_t cb; void * user_data; } lv_async_info_t; struct _lv_obj_t; /********************** * GLOBAL PROTOTYPES **********************/ /** * Call an asynchronous function the next time lv_task_handler() is run. This function is likely to return * **before** the call actually happens! * @param async_xcb a callback which is the task itself. * (the 'x' in the argument name indicates that its not a fully generic function because it not follows * the `func_name(object, callback, ...)` convention) * @param user_data custom parameter */ lv_res_t lv_async_call(lv_async_cb_t async_xcb, void * user_data); /********************** * MACROS **********************/ #ifdef __cplusplus } /* extern "C" */ #endif #endif /*LV_TEMPL_H*/
1,257
lv_async
h
en
c
code
{"qsc_code_num_words": 150, "qsc_code_num_chars": 1257.0, "qsc_code_mean_word_length": 4.26666667, "qsc_code_frac_words_unique": 0.49333333, "qsc_code_frac_chars_top_2grams": 0.0984375, "qsc_code_frac_chars_top_3grams": 0.0375, "qsc_code_frac_chars_top_4grams": 0.046875, "qsc_code_frac_chars_dupe_5grams": 0.08125, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.0, "qsc_code_frac_chars_whitespace": 0.19331742, "qsc_code_size_file_byte": 1257.0, "qsc_code_num_lines": 62.0, "qsc_code_num_chars_line_max": 120.0, "qsc_code_num_chars_line_mean": 20.27419355, "qsc_code_frac_chars_alphabet": 0.63116371, "qsc_code_frac_chars_comments": 0.68178202, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.27777778, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.05, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.05555556, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.16666667, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
008chen/InterpolatorShow
app/src/main/res/values/strings.xml
<resources> <string name="app_name">InterpolatorDebugger</string> <string name="action_settings">Settings</string> <string-array name="interpolator_titles"> <item>Linear Interpolator</item> <item>Accelerate Interpolator</item> <item>Decelerate Interpolator</item> <item>Accelerate Decelerate Interpolator</item> <item>Anticipate Interpolator</item> <item>Bounce Interpolator</item> <item>Cycle Interpolator(0.5f)</item> <item>Overshoot Interpolator</item> <item>Anticipate Overshoot Interpolator</item> </string-array> <string-array name="interpolator_contents"> <item>线性插值器</item> <item>加速插值器</item> <item>减速插值器</item> <item>加速减速插值器</item> <item>回荡秋千插值器</item> <item>弹跳插值器</item> <item>正弦周期变化插值器(0.5f)</item> <item>Overshoot Interpolator</item> <item>Anticipate Overshoot Interpolator</item> </string-array> </resources>
991
strings
xml
en
xml
data
{"qsc_code_num_words": 100, "qsc_code_num_chars": 991.0, "qsc_code_mean_word_length": 6.37, "qsc_code_frac_words_unique": 0.28, "qsc_code_frac_chars_top_2grams": 0.20094192, "qsc_code_frac_chars_top_3grams": 0.25117739, "qsc_code_frac_chars_top_4grams": 0.14128728, "qsc_code_frac_chars_dupe_5grams": 0.2700157, "qsc_code_frac_chars_dupe_6grams": 0.2700157, "qsc_code_frac_chars_dupe_7grams": 0.2700157, "qsc_code_frac_chars_dupe_8grams": 0.2700157, "qsc_code_frac_chars_dupe_9grams": 0.2700157, "qsc_code_frac_chars_dupe_10grams": 0.2700157, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00514139, "qsc_code_frac_chars_whitespace": 0.21493441, "qsc_code_size_file_byte": 991.0, "qsc_code_num_lines": 27.0, "qsc_code_num_chars_line_max": 58.0, "qsc_code_num_chars_line_mean": 36.7037037, "qsc_code_frac_chars_alphabet": 0.81362468, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.23076923, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.06357215, "qsc_code_frac_chars_long_word_length": 0.02119072, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_words_unique": 1, "qsc_code_frac_chars_top_2grams": 1, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0}
00ffcc/chunkRWKV6
tokenizer/tokenization_rwkv_world.py
# coding=utf-8 # Copyright 2018 The Open AI Team Authors and The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Tokenization classes for OpenAI GPT.""" import json import os from typing import TYPE_CHECKING, List, Optional, Tuple, Union from transformers.tokenization_utils import AddedToken, PreTrainedTokenizer from transformers.utils import logging, to_py_obj from transformers.tokenization_utils_base import BatchEncoding import bisect import itertools import re import unicodedata from collections import OrderedDict from typing import Any, Dict, List, Optional, Tuple, Union, overload from transformers.tokenization_utils_base import ( ENCODE_KWARGS_DOCSTRING, ENCODE_PLUS_ADDITIONAL_KWARGS_DOCSTRING, INIT_TOKENIZER_DOCSTRING, AddedToken, BatchEncoding, EncodedInput, EncodedInputPair, PreTokenizedInput, PreTokenizedInputPair, PreTrainedTokenizerBase, TextInput, TextInputPair, TruncationStrategy, ) from transformers.utils import PaddingStrategy, TensorType, add_end_docstrings, logging import torch if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation logger = logging.get_logger(__name__) VOCAB_FILES_NAMES = { "vocab_file": "rwkv_vocab_v20230424.txt", } class TRIE: __slots__ = tuple("ch,to,values,front".split(",")) to:list values:set def __init__(self, front=None, ch=None): self.ch = ch self.to = [None for ch in range(256)] self.values = set() self.front = front def __repr__(self): fr = self ret = [] while(fr!=None): if(fr.ch!=None): ret.append(fr.ch) fr = fr.front return "<TRIE %s %s>"%(ret[::-1], self.values) def add(self, key:bytes, idx:int=0, val=None): if(idx == len(key)): if(val is None): val = key self.values.add(val) return self ch = key[idx] if(self.to[ch] is None): self.to[ch] = TRIE(front=self, ch=ch) return self.to[ch].add(key, idx=idx+1, val=val) def find_longest(self, key:bytes, idx:int=0): u:TRIE = self ch:int = key[idx] while(u.to[ch] is not None): u = u.to[ch] idx += 1 if(u.values): ret = idx, u, u.values if(idx==len(key)): break ch = key[idx] return ret class RWKVWorldTokenizer(PreTrainedTokenizer): vocab_files_names = VOCAB_FILES_NAMES model_input_names = ["input_ids", "attention_mask"] def __init__( self, vocab_file, errors="replace", pad_token="0", **kwargs ): self.add_bos_token = False self.encoder = {} sorted = [] # must be already sorted with open(vocab_file, "r", encoding="utf-8") as f: lines = f.readlines() for l in lines: idx = int(l[:l.index(' ')]) x = eval(l[l.index(' '):l.rindex(' ')]) x = x.encode("utf-8") if isinstance(x, str) else x assert isinstance(x, bytes) assert len(x) == int(l[l.rindex(' '):]) sorted += [x] self.encoder[idx] = x self.decoder = {} for k,v in self.encoder.items(): self.decoder[v] = int(k) self.trie = TRIE() for t, i in self.decoder.items(): _ = self.trie.add(t, val=(t, i)) self.errors = errors # how to handle errors in decoding self.cache = {} self.first_max_length = 0 # pad_token = AddedToken(pad_token, lstrip=False, rstrip=False) if isinstance(pad_token, str) else pad_token super().__init__( errors=errors, # pad_token=pad_token, **kwargs, ) @property def vocab_size(self): return len(self.encoder) def get_vocab(self): return dict(self.encoder, **self.added_tokens_encoder) def add_tokens(self, new_tokens, special_tokens: bool = False): for token in new_tokens: token_id = self.convert_tokens_to_ids(token) self.added_tokens_decoder[token_id] = token def convert_ids_to_tokens(self, ids, skip_special_tokens=False): if isinstance(ids, int): ids = [ids] tokens = [] for id_ in ids: if id_ in self.added_tokens_decoder: tokens.append(self.added_tokens_decoder[id_]) else: tokens.append(self._convert_id_to_token(id_)) return tokens def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None): if self.add_bos_token: bos_token_ids = [self.bos_token_id] else: bos_token_ids = [] output = bos_token_ids + token_ids_0 if token_ids_1 is None: return output return output + bos_token_ids + token_ids_1 def get_special_tokens_mask( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False ) -> List[int]: """ Retrieves sequence ids from a token list that has no special tokens added. This method is called when adding special tokens using the tokenizer `prepare_for_model` or `encode_plus` methods. Args: token_ids_0 (`List[int]`): List of IDs. token_ids_1 (`List[int]`, *optional*): Optional second list of IDs for sequence pairs. already_has_special_tokens (`bool`, *optional*, defaults to `False`): Whether or not the token list is already formatted with special tokens for the model. Returns: `List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token. """ if already_has_special_tokens: return super().get_special_tokens_mask( token_ids_0=token_ids_0, token_ids_1=token_ids_1, already_has_special_tokens=True ) if not self.add_bos_token: return super().get_special_tokens_mask( token_ids_0=token_ids_0, token_ids_1=token_ids_1, already_has_special_tokens=False ) if token_ids_1 is None: return [1] + ([0] * len(token_ids_0)) return [1] + ([0] * len(token_ids_0)) + [1] + ([0] * len(token_ids_1)) def encodeBytes(self, src:bytes): idx:int = 0 tokens = [] while (idx < len(src)): _idx:int = idx idx, _, values = self.trie.find_longest(src, idx) assert(idx != _idx) _, token = next(iter(values)) tokens.append(token) return tokens def decodeBytes(self, tokens): return b''.join(map(lambda i: self.encoder[i], tokens)) def _tokenize(self, text, **kwargs): """Tokenize a string.""" return self.encodeBytes(text.encode("utf-8")) def _decode_tokens(self, tokens): try: return self.decodeBytes(tokens).decode('utf-8') except: return '\ufffd' # bad utf-8 def _decode(self, token_ids: Union[int, List[int], "np.ndarray", "torch.Tensor", "tf.Tensor"], skip_special_tokens: bool = False, **kwargs ) -> str: def remove_zeros_from_first_segment(token_ids, first_max_length): first_segment = token_ids[:first_max_length] first_segment_cleaned = [token for token in first_segment if token != 0] return first_segment_cleaned + token_ids[first_max_length:] # Convert inputs to python lists token_ids = to_py_obj(token_ids) token_ids = remove_zeros_from_first_segment(token_ids, self.first_max_length) if isinstance(token_ids, int): if token_ids in self.all_special_ids and skip_special_tokens: return "" return self.encoder.get(token_ids, self.unk_token) elif isinstance(token_ids, list): self.first_max_length out_str = "" out_last = 0 out_tokens = [] for i, token in enumerate(token_ids): if token == 0: break out_tokens += [token] tmp = self._decode_tokens(out_tokens[out_last:]) if '\ufffd' not in tmp: out_str += tmp out_last = i + 1 return out_str else: return token_ids def _convert_token_to_id(self, token): """Converts a token (str) in an id using the vocab.""" return self.encoder.get(token, self.encoder.get(self.unk_token)) def _convert_id_to_token(self, index): """Converts an index (integer) in a token (str) using the vocab.""" return self.decoder.get(index) def save_vocabulary(self, save_directory: str, filename_prefix: Optional[str] = None) -> Tuple[str]: if not os.path.exists(save_directory): os.mkdir(save_directory) if not os.path.isdir(save_directory): logger.error(f"Vocabulary path ({save_directory}) should be a directory") return vocab_file = os.path.join( save_directory, (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"] ) with open(vocab_file, "w", encoding="utf-8") as f: f.write(json.dumps(self.encoder, indent=2, sort_keys=True, ensure_ascii=False) + "\n") return (vocab_file,) def prepare_for_tokenization(self, text, **kwargs): return (text, kwargs) def _get_padding_truncation_strategies( self, padding=False, truncation=None, max_length=None, pad_to_multiple_of=None, verbose=True, **kwargs ): return PaddingStrategy.LONGEST, TruncationStrategy.DO_NOT_TRUNCATE, -1, kwargs def _encode_plus( self, text: Union[TextInput, EncodedInput], add_special_tokens: bool = True, padding_strategy: PaddingStrategy = PaddingStrategy.DO_NOT_PAD, truncation_strategy: TruncationStrategy = TruncationStrategy.DO_NOT_TRUNCATE, max_length: Optional[int] = None, stride: int = 0, pad_to_multiple_of: Optional[int] = None, return_tensors: Optional[Union[str, TensorType]] = None, return_token_type_ids: Optional[bool] = None, return_attention_mask: Optional[bool] = None, return_overflowing_tokens: bool = False, return_special_tokens_mask: bool = False, return_offsets_mapping: bool = False, return_length: bool = False, verbose: bool = True, **kwargs ) -> BatchEncoding: def get_input_ids(text): if isinstance(text, str): text_id = self._tokenize(text) return text_id elif isinstance(text, list) and len(text) > 0 and isinstance(text[0], str): return [self._tokenize(t) for t in text] elif isinstance(text, (list, tuple)) and len(text) > 0 and isinstance(text[0], int): return text else: raise ValueError( "Input is not valid. Should be a string, a list/tuple of strings or a list/tuple of integers." ) if return_offsets_mapping: raise NotImplementedError( "return_offset_mapping is not available when using Python tokenizers. " "To use this feature, change your tokenizer to one deriving from " "transformers.PreTrainedTokenizerFast. " "More information on available tokenizers at " "https://github.com/huggingface/transformers/pull/2674" ) first_ids = get_input_ids(text) return self.prepare_for_model( first_ids, pair_ids=None, add_special_tokens=add_special_tokens, padding=padding_strategy.value, truncation=truncation_strategy.value, max_length=max_length, stride=stride, pad_to_multiple_of=pad_to_multiple_of, return_tensors=return_tensors, prepend_batch_axis=True, return_attention_mask=return_attention_mask, return_token_type_ids=return_token_type_ids, return_overflowing_tokens=return_overflowing_tokens, return_special_tokens_mask=return_special_tokens_mask, return_length=return_length, verbose=verbose, ) def _batch_encode_plus( self, batch_text_or_text_pairs: Union[ List[TextInput], List[EncodedInput], ], add_special_tokens: bool = True, padding_strategy: PaddingStrategy = PaddingStrategy.DO_NOT_PAD, truncation_strategy: TruncationStrategy = TruncationStrategy.DO_NOT_TRUNCATE, max_length: Optional[int] = None, stride: int = 0, pad_to_multiple_of: Optional[int] = None, return_tensors: Optional[Union[str, TensorType]] = None, return_token_type_ids: Optional[bool] = None, return_attention_mask: Optional[bool] = None, return_overflowing_tokens: bool = False, return_special_tokens_mask: bool = False, return_offsets_mapping: bool = False, return_length: bool = False, verbose: bool = True, **kwargs ) -> BatchEncoding: def get_input_ids(text, max_length=None, pad_token_id=0): def pad_sequence(seq, max_len, pad_tok): return [pad_tok] * (max_len - len(seq)) + seq if isinstance(text, str): tokens = self._tokenize(text) if max_length is not None: tokens = pad_sequence(tokens, max_length, pad_token_id) return tokens elif isinstance(text, list) and len(text) > 0 and isinstance(text[0], str): tokenized_texts = [self._tokenize(t) for t in text] if max_length is None: max_length = max(len(t) for t in tokenized_texts) return [pad_sequence(t, max_length, pad_token_id) for t in tokenized_texts] elif isinstance(text, (list, tuple)) and len(text) > 0 and isinstance(text[0], int): if max_length is not None and len(text) < max_length: return pad_sequence(text, max_length, pad_token_id) return text else: raise ValueError( "Input is not valid. Should be a string, a list/tuple of strings or a list/tuple of integers." ) if return_offsets_mapping: raise NotImplementedError( "return_offset_mapping is not available when using Python tokenizers. " "To use this feature, change your tokenizer to one deriving from " "transformers.PreTrainedTokenizerFast." ) first_max_length = 0 second_max_length = 0 for ids_or_pair_ids in batch_text_or_text_pairs: if not isinstance(ids_or_pair_ids, (list, tuple)): ids, pair_ids = ids_or_pair_ids, None else: ids, pair_ids = ids_or_pair_ids first_ids = get_input_ids(ids) second_ids = get_input_ids(pair_ids) if pair_ids is not None else None first_max_length = max(first_max_length, len(first_ids)) if second_ids is not None: second_max_length = max(second_max_length, len(second_ids)) self.first_max_length = first_max_length input_ids = [] for ids_or_pair_ids in batch_text_or_text_pairs: if not isinstance(ids_or_pair_ids, (list, tuple)): ids, pair_ids = ids_or_pair_ids, None else: ids, pair_ids = ids_or_pair_ids first_ids = get_input_ids(ids, max_length=first_max_length) second_ids = get_input_ids(pair_ids, max_length=second_max_length) if pair_ids is not None else None input_ids.append((first_ids, second_ids)) batch_outputs = self._batch_prepare_for_model( input_ids, add_special_tokens=add_special_tokens, padding_strategy=padding_strategy, truncation_strategy=truncation_strategy, max_length=max_length, stride=stride, pad_to_multiple_of=pad_to_multiple_of, return_attention_mask=return_attention_mask, return_token_type_ids=return_token_type_ids, return_overflowing_tokens=return_overflowing_tokens, return_special_tokens_mask=return_special_tokens_mask, return_length=return_length, return_tensors=return_tensors, verbose=verbose, ) return BatchEncoding(batch_outputs) def decode( self, token_ids: Union[int, List[int], "np.ndarray", "torch.Tensor", "tf.Tensor"], skip_special_tokens: bool = False, clean_up_tokenization_spaces: bool = None, **kwargs, ) -> str: """ Converts a sequence of ids in a string, using the tokenizer and vocabulary with options to remove special tokens and clean up tokenization spaces. Similar to doing `self.convert_tokens_to_string(self.convert_ids_to_tokens(token_ids))`. Args: token_ids (`Union[int, List[int], np.ndarray, torch.Tensor, tf.Tensor]`): List of tokenized input ids. Can be obtained using the `__call__` method. skip_special_tokens (`bool`, *optional*, defaults to `False`): Whether or not to remove special tokens in the decoding. clean_up_tokenization_spaces (`bool`, *optional*): Whether or not to clean up the tokenization spaces. If `None`, will default to `self.clean_up_tokenization_spaces`. kwargs (additional keyword arguments, *optional*): Will be passed to the underlying model specific decode method. Returns: `str`: The decoded sentence. """ # Convert inputs to python lists return self._decode( token_ids=token_ids, skip_special_tokens=skip_special_tokens, clean_up_tokenization_spaces=clean_up_tokenization_spaces, **kwargs, ) def batch_decode( self, sequences: Union[List[int], List[List[int]], "np.ndarray", "torch.Tensor", "tf.Tensor"], skip_special_tokens: bool = False, clean_up_tokenization_spaces: bool = None, **kwargs, ) -> List[str]: """ Convert a list of lists of token ids into a list of strings by calling decode. Args: sequences (`Union[List[int], List[List[int]], np.ndarray, torch.Tensor, tf.Tensor]`): List of tokenized input ids. Can be obtained using the `__call__` method. skip_special_tokens (`bool`, *optional*, defaults to `False`): Whether or not to remove special tokens in the decoding. clean_up_tokenization_spaces (`bool`, *optional*): Whether or not to clean up the tokenization spaces. If `None`, will default to `self.clean_up_tokenization_spaces`. kwargs (additional keyword arguments, *optional*): Will be passed to the underlying model specific decode method. Returns: `List[str]`: The list of decoded sentences. """ return [ self.decode( seq, skip_special_tokens=skip_special_tokens, clean_up_tokenization_spaces=clean_up_tokenization_spaces, **kwargs, ) for seq in sequences ] def _build_conversation_input_ids(self, conversation: "Conversation") -> List[int]: input_ids = [] for is_user, text in conversation.iter_texts(): input_ids.extend(self.encode(text, add_special_tokens=False) + [self.eos_token_id]) if len(input_ids) > self.model_max_length: input_ids = input_ids[-self.model_max_length:] return input_ids def continous_encode(self, text: List[str])->Tuple[torch.Tensor, List[int]]: input_ids = [] for t in text: input_ids.append(torch.tensor(self.encode(t, add_special_tokens=False), dtype=torch.int32)) seq_idx = [] for i in range(len(input_ids)): seq_idx += [i for j in range(input_ids[i].shape[0])] input_ids = torch.cat(input_ids, dim=0).unsqueeze(0) seq_idx = torch.tensor(seq_idx, dtype=torch.int32).unsqueeze(0) return input_ids, seq_idx
21,518
tokenization_rwkv_world
py
en
python
code
{"qsc_code_num_words": 2661, "qsc_code_num_chars": 21518.0, "qsc_code_mean_word_length": 4.68094701, "qsc_code_frac_words_unique": 0.14242766, "qsc_code_frac_chars_top_2grams": 0.02890173, "qsc_code_frac_chars_top_3grams": 0.01348748, "qsc_code_frac_chars_top_4grams": 0.02207771, "qsc_code_frac_chars_dupe_5grams": 0.44364162, "qsc_code_frac_chars_dupe_6grams": 0.39972704, "qsc_code_frac_chars_dupe_7grams": 0.37339435, "qsc_code_frac_chars_dupe_8grams": 0.34866731, "qsc_code_frac_chars_dupe_9grams": 0.34449261, "qsc_code_frac_chars_dupe_10grams": 0.33807001, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00638935, "qsc_code_frac_chars_whitespace": 0.30174737, "qsc_code_size_file_byte": 21518.0, "qsc_code_num_lines": 551.0, "qsc_code_num_chars_line_max": 117.0, "qsc_code_num_chars_line_mean": 39.05263158, "qsc_code_frac_chars_alphabet": 0.82262895, "qsc_code_frac_chars_comments": 0.15391765, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.32613909, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.00479616, "qsc_code_frac_chars_string_length": 0.05250449, "qsc_code_frac_chars_long_word_length": 0.00786164, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.00719424, "qsc_codepython_cate_ast": 1.0, "qsc_codepython_frac_lines_func_ratio": 0.07434053, "qsc_codepython_cate_var_zero": false, "qsc_codepython_frac_lines_pass": 0.0, "qsc_codepython_frac_lines_import": 0.0383693, "qsc_codepython_frac_lines_simplefunc": 0.014388489208633094, "qsc_codepython_score_lines_no_logic": 0.23261391, "qsc_codepython_frac_lines_print": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codepython_cate_ast": 0, "qsc_codepython_frac_lines_func_ratio": 0, "qsc_codepython_cate_var_zero": 0, "qsc_codepython_frac_lines_pass": 0, "qsc_codepython_frac_lines_import": 0, "qsc_codepython_frac_lines_simplefunc": 0, "qsc_codepython_score_lines_no_logic": 0, "qsc_codepython_frac_lines_print": 0}
00jacs/sveltekit-ultrafast
src/routes/database-example/+page.svelte
<script lang="ts"> import { enhance } from '$app/forms'; import { InputText, Button, notify } from '$lib/components'; export let data; export let form; $: if (form?.success) { notify('success', 'Country added successfully.'); } </script> <div class="mx-auto my-8 max-w-5xl px-8 py-8"> <h1 class="mb-2 text-3xl font-bold">Example of using a database</h1> <p class="text-base-content-secondary mb-2"> Supabase has built-in methods to query your PostgreSQL database, making it really easy to fetch & modify data. </p> <p class="text-base-content-secondary mb-2"> Here's a <a href="https://supabase.com/docs/guides/getting-started/quickstarts/sveltekit" target="_blank" class="link"> full guide on getting started </a> with your SQL Supabase database. </p> <div class="divider mb-4"></div> <h2 class="mb-4 text-xl font-semibold">Add country</h2> <form action="?/createCountry" method="POST" class="mb-2" use:enhance> {#if form?.message} <p class="mb-4 text-error"> <span class="font-bold">Error: </span> {form.message} </p> {/if} <InputText id="name" name="name" type="text" placeholder="Country name" required label="Country name" containerClass="mb-4" value={form?.formData?.name} error={form?.errors?.fieldErrors?.name?.[0]} /> <InputText id="iso2" name="iso2" type="text" placeholder="CK" required label="ISO-2 Country Code" containerClass="mb-4" value={form?.formData?.iso2} error={form?.errors?.fieldErrors?.iso2?.[0]} /> <InputText id="iso3" name="iso3" type="text" placeholder="CK" required label="ISO-3 Country Code" containerClass="mb-4" value={form?.formData?.iso3} error={form?.errors?.fieldErrors?.iso3?.[0]} /> <Button type="submit" class="btn-primary">Add country</Button> </form> <div class="divider mb-4"></div> <h2 class="mb-4 text-xl font-semibold">List of fetched countries:</h2> <ul class="grid grid-cols-1 gap-3 md:grid-cols-2 lg:grid-cols-3"> {#each data.countries as country} <li class="flex flex-col justify-start rounded-md border border-base-200 px-2 py-2 shadow-sm"> {#if country.continent} <span class="text-xs font-bold uppercase tracking-wider text-primary"> {country.continent} </span> {/if} {country.name} </li> {/each} </ul> </div>
2,387
+page
svelte
en
svelte
code
{"qsc_code_num_words": 344, "qsc_code_num_chars": 2387.0, "qsc_code_mean_word_length": 4.47965116, "qsc_code_frac_words_unique": 0.42151163, "qsc_code_frac_chars_top_2grams": 0.0155743, "qsc_code_frac_chars_top_3grams": 0.0155743, "qsc_code_frac_chars_top_4grams": 0.02336145, "qsc_code_frac_chars_dupe_5grams": 0.23491239, "qsc_code_frac_chars_dupe_6grams": 0.23491239, "qsc_code_frac_chars_dupe_7grams": 0.2128488, "qsc_code_frac_chars_dupe_8grams": 0.16482803, "qsc_code_frac_chars_dupe_9grams": 0.06359507, "qsc_code_frac_chars_dupe_10grams": 0.06359507, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.0229709, "qsc_code_frac_chars_whitespace": 0.17930457, "qsc_code_size_file_byte": 2387.0, "qsc_code_num_lines": 98.0, "qsc_code_num_chars_line_max": 89.0, "qsc_code_num_chars_line_mean": 24.35714286, "qsc_code_frac_chars_alphabet": 0.76365493, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.27710843, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.01204819, "qsc_code_frac_chars_string_length": 0.25932132, "qsc_code_frac_chars_long_word_length": 0.02262254, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
0015/ESP32Berry
Arduino_IDE/0_UnitTest_LovyanGFX/mouse_cursor_icon.c
#include "lvgl.h" const uint8_t mouse_cursor_icon_map[] = { #if LV_COLOR_DEPTH == 1 || LV_COLOR_DEPTH == 8 /*Pixel format: Alpha 8 bit, Red: 3 bit, Green: 3 bit, Blue: 2 bit*/ 0x24, 0xb8, 0x24, 0xc8, 0x00, 0x13, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0xcc, 0xdb, 0xff, 0x49, 0xcc, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0xc8, 0xff, 0xff, 0xff, 0xff, 0x49, 0xe0, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0xcb, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0x6d, 0xf3, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0xcb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x92, 0xff, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0xcb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x92, 0xff, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0xb6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0xcb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb7, 0xff, 0x24, 0xab, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0xcb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdb, 0xff, 0x24, 0xbb, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0xcc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdb, 0xff, 0x49, 0xd8, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x49, 0xcc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6d, 0xef, 0x00, 0x4f, 0x00, 0x00, 0x49, 0xcc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x92, 0xff, 0x00, 0x6b, 0x49, 0xcc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdb, 0xff, 0x92, 0xf7, 0x92, 0xf8, 0x6e, 0xfb, 0x92, 0xf8, 0x6d, 0xff, 0x00, 0xb3, 0x49, 0xcc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdb, 0xff, 0x24, 0xb7, 0x00, 0x1b, 0x00, 0x14, 0x00, 0x13, 0x00, 0x0c, 0x25, 0x07, 0x49, 0xcc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6d, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6e, 0xf0, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0xcc, 0xff, 0xff, 0xff, 0xff, 0x49, 0xd8, 0x00, 0x78, 0x92, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xdb, 0xff, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6d, 0xd3, 0xff, 0xff, 0x6d, 0xef, 0x00, 0x34, 0x00, 0x00, 0x49, 0xc7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x6d, 0xdc, 0x00, 0x14, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x49, 0xe0, 0x6d, 0xff, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x92, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb7, 0xff, 0x00, 0x78, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x68, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x49, 0xd0, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0x6d, 0xd8, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f, 0xb7, 0xff, 0xff, 0xff, 0x92, 0xff, 0x49, 0xac, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x25, 0xd7, 0x49, 0xc7, 0x00, 0x47, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, #endif #if LV_COLOR_DEPTH == 16 /*Pixel format: Alpha 8 bit, Red: 5 bit, Green: 6 bit, Blue: 5 bit*/ 0xc3, 0x18, 0xb8, 0xe4, 0x20, 0xc8, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x4a, 0xcc, 0x96, 0xb5, 0xff, 0xc7, 0x39, 0xcc, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x39, 0xc8, 0xbf, 0xff, 0xff, 0xfb, 0xde, 0xff, 0x28, 0x42, 0xe0, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x39, 0xcb, 0x3d, 0xef, 0xff, 0xff, 0xff, 0xfc, 0x3d, 0xef, 0xff, 0xcb, 0x5a, 0xf3, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe7, 0x39, 0xcb, 0x5d, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbf, 0xff, 0xff, 0x8e, 0x73, 0xff, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x41, 0xcb, 0x5d, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x51, 0x8c, 0xff, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x9c, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0x41, 0xcb, 0x5d, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x14, 0xa5, 0xff, 0xa2, 0x10, 0xab, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x42, 0xcb, 0x5d, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd7, 0xbd, 0xff, 0x04, 0x21, 0xbb, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x42, 0xcc, 0x5d, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x59, 0xce, 0xff, 0xe8, 0x41, 0xd8, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x42, 0xcc, 0x5d, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xe6, 0xff, 0xab, 0x5a, 0xef, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x08, 0x42, 0xcc, 0x5d, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbe, 0xf7, 0xff, 0xaf, 0x7b, 0xff, 0x00, 0x00, 0x6b, 0x28, 0x42, 0xcc, 0x5d, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7a, 0xd6, 0xff, 0x10, 0x84, 0xf7, 0xae, 0x73, 0xf8, 0x6e, 0x73, 0xfb, 0x8e, 0x73, 0xf8, 0xcb, 0x5a, 0xff, 0x61, 0x08, 0xb3, 0x28, 0x42, 0xcc, 0x7d, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x59, 0xce, 0xff, 0xa2, 0x10, 0xb7, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x14, 0x00, 0x00, 0x13, 0x00, 0x00, 0x0c, 0x45, 0x29, 0x07, 0x29, 0x4a, 0xcc, 0x5d, 0xef, 0xff, 0xff, 0xff, 0xff, 0xdb, 0xde, 0xff, 0xec, 0x62, 0xff, 0x1c, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0c, 0x63, 0xf0, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x4a, 0xcc, 0xdf, 0xff, 0xff, 0x7d, 0xef, 0xff, 0x49, 0x4a, 0xd8, 0x00, 0x00, 0x78, 0x51, 0x8c, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x38, 0xc6, 0xff, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x5a, 0xd3, 0xdb, 0xde, 0xff, 0xec, 0x62, 0xef, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0xe7, 0x39, 0xc7, 0x5d, 0xef, 0xff, 0xff, 0xff, 0xff, 0xbe, 0xf7, 0xff, 0xaa, 0x52, 0xdc, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xe8, 0x41, 0xe0, 0xaa, 0x52, 0xff, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x72, 0x94, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x96, 0xb5, 0xff, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x61, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x69, 0x4a, 0xd0, 0x7d, 0xef, 0xff, 0xff, 0xff, 0xfc, 0xbe, 0xf7, 0xff, 0xaa, 0x52, 0xd8, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f, 0x75, 0xad, 0xff, 0xbf, 0xff, 0xff, 0x10, 0x84, 0xff, 0x86, 0x31, 0xac, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x08, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x66, 0x31, 0xd7, 0xc7, 0x39, 0xc7, 0x00, 0x00, 0x47, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, #endif #if LV_COLOR_DEPTH == 32 0x19, 0x19, 0x19, 0xb8, 0x1e, 0x1e, 0x1e, 0xc8, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x48, 0xcc, 0xb2, 0xb2, 0xb2, 0xff, 0x3a, 0x3a, 0x3a, 0xcc, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x3b, 0x3b, 0xc8, 0xf6, 0xf6, 0xf6, 0xff, 0xdc, 0xdc, 0xdc, 0xff, 0x43, 0x43, 0x43, 0xe0, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x0a, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x3b, 0x3b, 0xcb, 0xe6, 0xe6, 0xe6, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xe5, 0xe5, 0xe5, 0xff, 0x59, 0x59, 0x59, 0xf3, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0xcb, 0xe9, 0xe9, 0xe9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xf5, 0xf5, 0xff, 0x72, 0x72, 0x72, 0xff, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3d, 0x3d, 0x3d, 0xcb, 0xe9, 0xe9, 0xe9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8a, 0x8a, 0x8a, 0xff, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x99, 0x99, 0x00, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x3e, 0x3e, 0xcb, 0xe9, 0xe9, 0xe9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xa2, 0xa2, 0xa2, 0xff, 0x13, 0x13, 0x13, 0xab, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x3f, 0x3f, 0xcb, 0xe9, 0xe9, 0xe9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb7, 0xb7, 0xb7, 0xff, 0x1f, 0x1f, 0x1f, 0xbb, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x41, 0xcc, 0xea, 0xea, 0xea, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xca, 0xca, 0xca, 0xff, 0x3d, 0x3d, 0x3d, 0xd8, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x41, 0x41, 0xcc, 0xea, 0xea, 0xea, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xde, 0xde, 0xde, 0xff, 0x56, 0x56, 0x56, 0xef, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0xcc, 0xea, 0xea, 0xea, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xf3, 0xf3, 0xff, 0x76, 0x76, 0x76, 0xff, 0x00, 0x00, 0x00, 0x6b, 0x43, 0x43, 0x43, 0xcc, 0xea, 0xea, 0xea, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xce, 0xce, 0xce, 0xff, 0x80, 0x80, 0x80, 0xf7, 0x74, 0x74, 0x74, 0xf8, 0x6d, 0x6d, 0x6d, 0xfb, 0x72, 0x72, 0x72, 0xf8, 0x57, 0x57, 0x57, 0xff, 0x0c, 0x0c, 0x0c, 0xb3, 0x44, 0x44, 0x44, 0xcc, 0xeb, 0xeb, 0xeb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xfb, 0xfb, 0xfb, 0xff, 0xfe, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc9, 0xc9, 0xc9, 0xff, 0x13, 0x13, 0x13, 0xb7, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x0c, 0x29, 0x29, 0x29, 0x07, 0x45, 0x45, 0x45, 0xcc, 0xe8, 0xe8, 0xe8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd9, 0xd9, 0xd9, 0xff, 0x5e, 0x5e, 0x5e, 0xff, 0xe2, 0xe2, 0xe2, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x62, 0x62, 0x62, 0xf0, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x45, 0x45, 0xcc, 0xf9, 0xf9, 0xf9, 0xff, 0xec, 0xec, 0xec, 0xff, 0x4a, 0x4a, 0x4a, 0xd8, 0x00, 0x00, 0x00, 0x78, 0x8a, 0x8a, 0x8a, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0xc3, 0xc3, 0xff, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x58, 0x58, 0xd3, 0xd9, 0xd9, 0xd9, 0xff, 0x5e, 0x5e, 0x5e, 0xef, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x3b, 0x3b, 0xc7, 0xe9, 0xe9, 0xe9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf4, 0xf4, 0xf4, 0xff, 0x54, 0x54, 0x54, 0xdc, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x3e, 0x3e, 0xe0, 0x54, 0x54, 0x54, 0xff, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x8e, 0x8e, 0x8e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xb0, 0xb0, 0xb0, 0xff, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x0c, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x4c, 0x4c, 0x4c, 0xd0, 0xec, 0xec, 0xec, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xf4, 0xf4, 0xf4, 0xff, 0x53, 0x53, 0x53, 0xd8, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x1e, 0x1e, 0x00, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6f, 0xab, 0xab, 0xab, 0xff, 0xf6, 0xf6, 0xf6, 0xff, 0x80, 0x80, 0x80, 0xff, 0x31, 0x31, 0x31, 0xac, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x09, 0x09, 0x03, 0x02, 0x02, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x2e, 0x2e, 0x2e, 0xd7, 0x38, 0x38, 0x38, 0xc7, 0x00, 0x00, 0x00, 0x47, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, #endif }; lv_img_dsc_t mouse_cursor_icon = { .header.always_zero = 0, .header.w = 14, .header.h = 20, .data_size = 280 * LV_IMG_PX_SIZE_ALPHA_BYTE, .header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA, .data = mouse_cursor_icon_map, };
15,926
mouse_cursor_icon
c
hu
c
code
{"qsc_code_num_words": 2619, "qsc_code_num_chars": 15926.0, "qsc_code_mean_word_length": 3.98052692, "qsc_code_frac_words_unique": 0.07636502, "qsc_code_frac_chars_top_2grams": 0.65918465, "qsc_code_frac_chars_top_3grams": 0.8276259, "qsc_code_frac_chars_top_4grams": 0.93621103, "qsc_code_frac_chars_dupe_5grams": 0.76671463, "qsc_code_frac_chars_dupe_6grams": 0.73026379, "qsc_code_frac_chars_dupe_7grams": 0.70781775, "qsc_code_frac_chars_dupe_8grams": 0.65371703, "qsc_code_frac_chars_dupe_9grams": 0.62877698, "qsc_code_frac_chars_dupe_10grams": 0.58964029, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.42437941, "qsc_code_frac_chars_whitespace": 0.18045963, "qsc_code_size_file_byte": 15926.0, "qsc_code_num_lines": 81.0, "qsc_code_num_chars_line_max": 340.0, "qsc_code_num_chars_line_mean": 196.61728395, "qsc_code_frac_chars_alphabet": 0.37434876, "qsc_code_frac_chars_comments": 0.0085395, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.06493506, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00037999, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.63837872, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.0, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.01298701, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": 0.09090909}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 1, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 1, "qsc_code_frac_chars_dupe_7grams": 1, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 1, "qsc_code_frac_chars_alphabet": 1, "qsc_code_frac_chars_digital": 1, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 1, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
00ffcc/chunkRWKV6
cuda/wkv5_cuda.cu
#include <stdio.h> #include <assert.h> #include "ATen/ATen.h" typedef at::BFloat16 bf16; template <typename F> __global__ void kernel_forward(const int B, const int T, const int C, const int H, const F *__restrict__ const _r, const F *__restrict__ const _k, const F *__restrict__ const _v, const float *__restrict__ _w, const F *__restrict__ _u, F *__restrict__ const _y) { const int b = blockIdx.x / H; const int h = blockIdx.x % H; const int i = threadIdx.x; _w += h*_N_; _u += h*_N_; __shared__ float r[_N_], k[_N_], u[_N_], w[_N_]; float state[_N_] = {0}; __syncthreads(); w[i] = _w[i]; u[i] = float(_u[i]); __syncthreads(); for (int t = b*T*C + h*_N_ + i; t < (b+1)*T*C + h*_N_ + i; t += C) { __syncthreads(); r[i] = float(_r[t]); k[i] = float(_k[t]); __syncthreads(); const float v = float(_v[t]); float y = 0; #pragma unroll for (int j = 0; j < _N_; j+=4) { const float4& r_ = (float4&)(r[j]); const float4& k_ = (float4&)(k[j]); const float4& w_ = (float4&)(w[j]); const float4& u_ = (float4&)(u[j]); float4& s = (float4&)(state[j]); float4 x; x.x = k_.x * v; x.y = k_.y * v; x.z = k_.z * v; x.w = k_.w * v; y += r_.x * (u_.x * x.x + s.x); y += r_.y * (u_.y * x.y + s.y); y += r_.z * (u_.z * x.z + s.z); y += r_.w * (u_.w * x.w + s.w); s.x = s.x * w_.x + x.x; s.y = s.y * w_.y + x.y; s.z = s.z * w_.z + x.z; s.w = s.w * w_.w + x.w; } _y[t] = F(y); } } template <typename F> __global__ void kernel_backward(const int B, const int T, const int C, const int H, const F *__restrict__ const _r, const F *__restrict__ const _k, const F *__restrict__ const _v, const float *__restrict__ _w, const float *__restrict__ __w, const F *__restrict__ _u, const F *__restrict__ const _gy, F *__restrict__ const _gr, F *__restrict__ const _gk, F *__restrict__ const _gv, F *__restrict__ const _gw, F *__restrict__ const _gu) { const int b = blockIdx.x / H; const int h = blockIdx.x % H; const int i = threadIdx.x; _w += h*_N_; _u += h*_N_; __w += h*_N_; __shared__ float w_[_N_], u_[_N_]; __shared__ float r[_N_], k[_N_], v[_N_], gy[_N_]; __syncthreads(); w_[i] = _w[i]; u_[i] = float(_u[i]); __syncthreads(); const float w = w_[i]; const float ww = __w[i]; const float u = u_[i]; float state[_N_] = {0}, saaaa[_N_] = {0}, sbbbb[_N_] = {0}, scccc[_N_] = {0}, sdddd[_N_] = {0}; float gw = 0, gu = 0; const int t000 = b*T*C + h*_N_ + i; const int t111 = (b+1)*T*C + h*_N_ + i; const int t222 = t111 - 2*C; for (int t = t000; t < t111; t += C) { __syncthreads(); v[i] = float(_v[t]); gy[i] = float(_gy[t]); __syncthreads(); const float k = float(_k[t]); float gr = 0, gu_ = 0; #pragma unroll for (int j = 0; j < _N_; j++) { float& s = state[j]; float x = k * v[j]; gr += (u * x + s) * gy[j]; gu_ += x * gy[j]; s = s * w + x; } _gr[t] = F(gr); gu += float(_r[t]) * gu_; } _gu[b*C + h*_N_ + i] = F(gu); for (int t = t000; t < t222; t += C) { __syncthreads(); v[i] = float(_v[t]); gy[i] = float(_gy[t + 2*C]); __syncthreads(); const float k = float(_k[t]); float gw_ = 0; #pragma unroll for (int j = 0; j < _N_; j++) { float& s = saaaa[j]; float& s2 = sbbbb[j]; float x = k * v[j]; float tmp = w * (x + s); s = tmp; s2 = tmp + w * s2; gw_ += s2 * gy[j]; } gw += float(_r[t + 2*C]) * gw_; } _gw[b*C + h*_N_ + i] = F(ww * gw); for (int t = t111 - C; t >= t000; t -= C) { __syncthreads(); v[i] = float(_v[t]); gy[i] = float(_gy[t]); __syncthreads(); const float rr = float(_r[t]); float gk = 0; #pragma unroll for (int j = 0; j < _N_; j++) { float& s = scccc[j]; float x = rr * gy[j]; gk += (u * x + s) * v[j]; s = x + s * w; } _gk[t] = F(gk); } for (int t = t111 - C; t >= t000; t -= C) { __syncthreads(); r[i] = float(_r[t]); k[i] = float(_k[t]); __syncthreads(); const float gyy = float(_gy[t]); float gv = 0; #pragma unroll for (int j = 0; j < _N_; j++) { float& s = sdddd[j]; float x = gyy * r[j]; gv += (u_[j] * x + s) * k[j]; s = x + s * w_[j]; } _gv[t] = F(gv); } } void cuda_forward(int B, int T, int C, int H, bf16 *r, bf16 *k, bf16 *v, float *w, bf16 *u, bf16 *y) { assert(H*_N_ == C); assert(_N_%4 == 0); kernel_forward<<<dim3(B * H), dim3(_N_)>>>(B, T, C, H, r, k, v, w, u, y); } void cuda_backward(int B, int T, int C, int H, bf16 *r, bf16 *k, bf16 *v, float *w, float *ww, bf16 *u, bf16 *gy, bf16 *gr, bf16 *gk, bf16 *gv, bf16 *gw, bf16 *gu) { assert(H*_N_ == C); assert(_N_%4 == 0); kernel_backward<<<dim3(B * H), dim3(_N_)>>>(B, T, C, H, r, k, v, w, ww, u, gy, gr, gk, gv, gw, gu); }
5,658
wkv5_cuda
cu
en
cuda
code
{"qsc_code_num_words": 870, "qsc_code_num_chars": 5658.0, "qsc_code_mean_word_length": 2.55632184, "qsc_code_frac_words_unique": 0.07931034, "qsc_code_frac_chars_top_2grams": 0.06115108, "qsc_code_frac_chars_top_3grams": 0.08183453, "qsc_code_frac_chars_top_4grams": 0.05980216, "qsc_code_frac_chars_dupe_5grams": 0.58947842, "qsc_code_frac_chars_dupe_6grams": 0.57419065, "qsc_code_frac_chars_dupe_7grams": 0.52652878, "qsc_code_frac_chars_dupe_8grams": 0.49685252, "qsc_code_frac_chars_dupe_9grams": 0.45818345, "qsc_code_frac_chars_dupe_10grams": 0.43660072, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.03369503, "qsc_code_frac_chars_whitespace": 0.38105338, "qsc_code_size_file_byte": 5658.0, "qsc_code_num_lines": 202.0, "qsc_code_num_chars_line_max": 220.0, "qsc_code_num_chars_line_mean": 28.00990099, "qsc_code_frac_chars_alphabet": 0.60137065, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.31764706, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00194415, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.02941176}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00ffcc/conRWKV
conRWKV/tokenizer/tokenization_rwkv_world.py
# coding=utf-8 # Copyright 2018 The Open AI Team Authors and The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Tokenization classes for OpenAI GPT.""" import json import os from typing import TYPE_CHECKING, List, Optional, Tuple, Union from regex import F from transformers.tokenization_utils import AddedToken, PreTrainedTokenizer from transformers.utils import logging, to_py_obj from transformers.tokenization_utils_base import BatchEncoding import bisect import itertools import re import unicodedata from collections import OrderedDict from typing import Any, Dict, List, Optional, Tuple, Union, overload from transformers.tokenization_utils_base import ( ENCODE_KWARGS_DOCSTRING, ENCODE_PLUS_ADDITIONAL_KWARGS_DOCSTRING, INIT_TOKENIZER_DOCSTRING, AddedToken, BatchEncoding, EncodedInput, EncodedInputPair, PreTokenizedInput, PreTokenizedInputPair, PreTrainedTokenizerBase, TextInput, TextInputPair, TruncationStrategy, ) from transformers.utils import PaddingStrategy, TensorType, add_end_docstrings, logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation logger = logging.get_logger(__name__) VOCAB_FILES_NAMES = { "vocab_file": "rwkv_vocab_v20230424.txt", } class TRIE: __slots__ = tuple("ch,to,values,front".split(",")) to:list values:set def __init__(self, front=None, ch=None): self.ch = ch self.to = [None for ch in range(256)] self.values = set() self.front = front def __repr__(self): fr = self ret = [] while(fr!=None): if(fr.ch!=None): ret.append(fr.ch) fr = fr.front return "<TRIE %s %s>"%(ret[::-1], self.values) def add(self, key:bytes, idx:int=0, val=None): if(idx == len(key)): if(val is None): val = key self.values.add(val) return self ch = key[idx] if(self.to[ch] is None): self.to[ch] = TRIE(front=self, ch=ch) return self.to[ch].add(key, idx=idx+1, val=val) def find_longest(self, key:bytes, idx:int=0): u:TRIE = self ch:int = key[idx] while(u.to[ch] is not None): u = u.to[ch] idx += 1 if(u.values): ret = idx, u, u.values if(idx==len(key)): break ch = key[idx] return ret class RWKVWorldTokenizer(PreTrainedTokenizer): vocab_files_names = VOCAB_FILES_NAMES model_input_names = ["input_ids", "attention_mask"] def __init__( self, vocab_file, errors="replace", pad_token="0", **kwargs ): self.add_bos_token = False self.encoder = {} sorted = [] # must be already sorted with open(vocab_file, "r", encoding="utf-8") as f: lines = f.readlines() for l in lines: idx = int(l[:l.index(' ')]) x = eval(l[l.index(' '):l.rindex(' ')]) x = x.encode("utf-8") if isinstance(x, str) else x assert isinstance(x, bytes) assert len(x) == int(l[l.rindex(' '):]) sorted += [x] self.encoder[idx] = x self.decoder = {} for k,v in self.encoder.items(): self.decoder[v] = int(k) self.trie = TRIE() for t, i in self.decoder.items(): _ = self.trie.add(t, val=(t, i)) self.errors = errors # how to handle errors in decoding self.cache = {} self.first_max_length = 0 # pad_token = AddedToken(pad_token, lstrip=False, rstrip=False) if isinstance(pad_token, str) else pad_token super().__init__( errors=errors, # pad_token=pad_token, **kwargs, ) @property def vocab_size(self): return len(self.encoder) def get_vocab(self): return dict(self.encoder, **self.added_tokens_encoder) def add_tokens(self, new_tokens, special_tokens: bool = False): for token in new_tokens: token_id = self.convert_tokens_to_ids(token) self.added_tokens_decoder[token_id] = token def convert_ids_to_tokens(self, ids, skip_special_tokens=False): if isinstance(ids, int): ids = [ids] tokens = [] for id_ in ids: if id_ in self.added_tokens_decoder: tokens.append(self.added_tokens_decoder[id_]) else: tokens.append(self._convert_id_to_token(id_)) return tokens def build_inputs_with_special_tokens(self, token_ids_0, token_ids_1=None): if self.add_bos_token: bos_token_ids = [self.bos_token_id] else: bos_token_ids = [] output = bos_token_ids + token_ids_0 if token_ids_1 is None: return output return output + bos_token_ids + token_ids_1 def get_special_tokens_mask( self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None, already_has_special_tokens: bool = False ) -> List[int]: """ Retrieves sequence ids from a token list that has no special tokens added. This method is called when adding special tokens using the tokenizer `prepare_for_model` or `encode_plus` methods. Args: token_ids_0 (`List[int]`): List of IDs. token_ids_1 (`List[int]`, *optional*): Optional second list of IDs for sequence pairs. already_has_special_tokens (`bool`, *optional*, defaults to `False`): Whether or not the token list is already formatted with special tokens for the model. Returns: `List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token. """ if already_has_special_tokens: return super().get_special_tokens_mask( token_ids_0=token_ids_0, token_ids_1=token_ids_1, already_has_special_tokens=True ) if not self.add_bos_token: return super().get_special_tokens_mask( token_ids_0=token_ids_0, token_ids_1=token_ids_1, already_has_special_tokens=False ) if token_ids_1 is None: return [1] + ([0] * len(token_ids_0)) return [1] + ([0] * len(token_ids_0)) + [1] + ([0] * len(token_ids_1)) def encodeBytes(self, src:bytes): idx:int = 0 tokens = [] while (idx < len(src)): _idx:int = idx idx, _, values = self.trie.find_longest(src, idx) assert(idx != _idx) _, token = next(iter(values)) tokens.append(token) return tokens def decodeBytes(self, tokens): return b''.join(map(lambda i: self.encoder[i], tokens)) def _tokenize(self, text, **kwargs): """Tokenize a string.""" return self.encodeBytes(text.encode("utf-8")) def _decode_tokens(self, tokens): try: return self.decodeBytes(tokens).decode('utf-8') except: return '\ufffd' # bad utf-8 def _decode(self, token_ids: Union[int, List[int], "np.ndarray", "torch.Tensor", "tf.Tensor"], skip_special_tokens: bool = False, **kwargs ) -> str: def remove_zeros_from_first_segment(token_ids, first_max_length): first_segment = token_ids[:first_max_length] first_segment_cleaned = [token for token in first_segment if token != 0] return first_segment_cleaned + token_ids[first_max_length:] # Convert inputs to python lists token_ids = to_py_obj(token_ids) token_ids = remove_zeros_from_first_segment(token_ids, self.first_max_length) if isinstance(token_ids, int): if token_ids in self.all_special_ids and skip_special_tokens: return "" return self.encoder.get(token_ids, self.unk_token) elif isinstance(token_ids, list): self.first_max_length out_str = "" out_last = 0 out_tokens = [] for i, token in enumerate(token_ids): if token == 0: break out_tokens += [token] tmp = self._decode_tokens(out_tokens[out_last:]) if '\ufffd' not in tmp: out_str += tmp out_last = i + 1 return out_str else: return token_ids def _convert_token_to_id(self, token): """Converts a token (str) in an id using the vocab.""" return self.encoder.get(token, self.encoder.get(self.unk_token)) def _convert_id_to_token(self, index): """Converts an index (integer) in a token (str) using the vocab.""" return self.decoder.get(index) def save_vocabulary(self, save_directory: str, filename_prefix: Optional[str] = None) -> Tuple[str]: if not os.path.exists(save_directory): os.mkdir(save_directory) if not os.path.isdir(save_directory): logger.error(f"Vocabulary path ({save_directory}) should be a directory") return vocab_file = os.path.join( save_directory, (filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["vocab_file"] ) with open(vocab_file, "w", encoding="utf-8") as f: f.write(json.dumps(self.encoder, indent=2, sort_keys=True, ensure_ascii=False) + "\n") return (vocab_file,) def prepare_for_tokenization(self, text, **kwargs): return (text, kwargs) def _get_padding_truncation_strategies( self, padding=False, truncation=None, max_length=None, pad_to_multiple_of=None, verbose=True, **kwargs ): return PaddingStrategy.LONGEST, TruncationStrategy.DO_NOT_TRUNCATE, -1, kwargs def _encode_plus( self, text: Union[TextInput, EncodedInput], add_special_tokens: bool = True, padding_strategy: PaddingStrategy = PaddingStrategy.DO_NOT_PAD, truncation_strategy: TruncationStrategy = TruncationStrategy.DO_NOT_TRUNCATE, max_length: Optional[int] = None, stride: int = 0, pad_to_multiple_of: Optional[int] = None, return_tensors: Optional[Union[str, TensorType]] = None, return_token_type_ids: Optional[bool] = None, return_attention_mask: Optional[bool] = None, return_overflowing_tokens: bool = False, return_special_tokens_mask: bool = False, return_offsets_mapping: bool = False, return_length: bool = False, verbose: bool = True, **kwargs ) -> BatchEncoding: def get_input_ids(text): if isinstance(text, str): text_id = self._tokenize(text) return text_id elif isinstance(text, list) and len(text) > 0 and isinstance(text[0], str): return [self._tokenize(t) for t in text] elif isinstance(text, (list, tuple)) and len(text) > 0 and isinstance(text[0], int): return text else: raise ValueError( "Input is not valid. Should be a string, a list/tuple of strings or a list/tuple of integers." ) if return_offsets_mapping: raise NotImplementedError( "return_offset_mapping is not available when using Python tokenizers. " "To use this feature, change your tokenizer to one deriving from " "transformers.PreTrainedTokenizerFast. " "More information on available tokenizers at " "https://github.com/huggingface/transformers/pull/2674" ) first_ids = get_input_ids(text) return self.prepare_for_model( first_ids, pair_ids=None, add_special_tokens=add_special_tokens, padding=padding_strategy.value, truncation=truncation_strategy.value, max_length=max_length, stride=stride, pad_to_multiple_of=pad_to_multiple_of, return_tensors=return_tensors, prepend_batch_axis=True, return_attention_mask=return_attention_mask, return_token_type_ids=return_token_type_ids, return_overflowing_tokens=return_overflowing_tokens, return_special_tokens_mask=return_special_tokens_mask, return_length=return_length, verbose=verbose, ) def _batch_encode_plus( self, batch_text_or_text_pairs: Union[ List[TextInput], List[EncodedInput], ], add_special_tokens: bool = True, padding_strategy: PaddingStrategy = PaddingStrategy.DO_NOT_PAD, truncation_strategy: TruncationStrategy = TruncationStrategy.DO_NOT_TRUNCATE, max_length: Optional[int] = None, stride: int = 0, pad_to_multiple_of: Optional[int] = None, return_tensors: Optional[Union[str, TensorType]] = None, return_token_type_ids: Optional[bool] = None, return_attention_mask: Optional[bool] = None, return_overflowing_tokens: bool = False, return_special_tokens_mask: bool = False, return_offsets_mapping: bool = False, return_length: bool = False, verbose: bool = True, **kwargs ) -> BatchEncoding: def get_input_ids(text, max_length=None, pad_token_id=0): def pad_sequence(seq, max_len, pad_tok): return [pad_tok] * (max_len - len(seq)) + seq if isinstance(text, str): tokens = self._tokenize(text) if max_length is not None: tokens = pad_sequence(tokens, max_length, pad_token_id) return tokens elif isinstance(text, list) and len(text) > 0 and isinstance(text[0], str): tokenized_texts = [self._tokenize(t) for t in text] if max_length is None: max_length = max(len(t) for t in tokenized_texts) return [pad_sequence(t, max_length, pad_token_id) for t in tokenized_texts] elif isinstance(text, (list, tuple)) and len(text) > 0 and isinstance(text[0], int): if max_length is not None and len(text) < max_length: return pad_sequence(text, max_length, pad_token_id) return text else: raise ValueError( "Input is not valid. Should be a string, a list/tuple of strings or a list/tuple of integers." ) if return_offsets_mapping: raise NotImplementedError( "return_offset_mapping is not available when using Python tokenizers. " "To use this feature, change your tokenizer to one deriving from " "transformers.PreTrainedTokenizerFast." ) first_max_length = 0 second_max_length = 0 for ids_or_pair_ids in batch_text_or_text_pairs: if not isinstance(ids_or_pair_ids, (list, tuple)): ids, pair_ids = ids_or_pair_ids, None else: ids, pair_ids = ids_or_pair_ids first_ids = get_input_ids(ids) second_ids = get_input_ids(pair_ids) if pair_ids is not None else None first_max_length = max(first_max_length, len(first_ids)) if second_ids is not None: second_max_length = max(second_max_length, len(second_ids)) self.first_max_length = first_max_length input_ids = [] for ids_or_pair_ids in batch_text_or_text_pairs: if not isinstance(ids_or_pair_ids, (list, tuple)): ids, pair_ids = ids_or_pair_ids, None else: ids, pair_ids = ids_or_pair_ids first_ids = get_input_ids(ids, max_length=first_max_length) second_ids = get_input_ids(pair_ids, max_length=second_max_length) if pair_ids is not None else None input_ids.append((first_ids, second_ids)) batch_outputs = self._batch_prepare_for_model( input_ids, add_special_tokens=add_special_tokens, padding_strategy=padding_strategy, truncation_strategy=truncation_strategy, max_length=max_length, stride=stride, pad_to_multiple_of=pad_to_multiple_of, return_attention_mask=return_attention_mask, return_token_type_ids=return_token_type_ids, return_overflowing_tokens=return_overflowing_tokens, return_special_tokens_mask=return_special_tokens_mask, return_length=return_length, return_tensors=return_tensors, verbose=verbose, ) return BatchEncoding(batch_outputs) def decode( self, token_ids: Union[int, List[int], "np.ndarray", "torch.Tensor", "tf.Tensor"], skip_special_tokens: bool = False, clean_up_tokenization_spaces: bool = None, **kwargs, ) -> str: """ Converts a sequence of ids in a string, using the tokenizer and vocabulary with options to remove special tokens and clean up tokenization spaces. Similar to doing `self.convert_tokens_to_string(self.convert_ids_to_tokens(token_ids))`. Args: token_ids (`Union[int, List[int], np.ndarray, torch.Tensor, tf.Tensor]`): List of tokenized input ids. Can be obtained using the `__call__` method. skip_special_tokens (`bool`, *optional*, defaults to `False`): Whether or not to remove special tokens in the decoding. clean_up_tokenization_spaces (`bool`, *optional*): Whether or not to clean up the tokenization spaces. If `None`, will default to `self.clean_up_tokenization_spaces`. kwargs (additional keyword arguments, *optional*): Will be passed to the underlying model specific decode method. Returns: `str`: The decoded sentence. """ # Convert inputs to python lists return self._decode( token_ids=token_ids, skip_special_tokens=skip_special_tokens, clean_up_tokenization_spaces=clean_up_tokenization_spaces, **kwargs, ) def batch_decode( self, sequences: Union[List[int], List[List[int]], "np.ndarray", "torch.Tensor", "tf.Tensor"], skip_special_tokens: bool = False, clean_up_tokenization_spaces: bool = None, **kwargs, ) -> List[str]: """ Convert a list of lists of token ids into a list of strings by calling decode. Args: sequences (`Union[List[int], List[List[int]], np.ndarray, torch.Tensor, tf.Tensor]`): List of tokenized input ids. Can be obtained using the `__call__` method. skip_special_tokens (`bool`, *optional*, defaults to `False`): Whether or not to remove special tokens in the decoding. clean_up_tokenization_spaces (`bool`, *optional*): Whether or not to clean up the tokenization spaces. If `None`, will default to `self.clean_up_tokenization_spaces`. kwargs (additional keyword arguments, *optional*): Will be passed to the underlying model specific decode method. Returns: `List[str]`: The list of decoded sentences. """ return [ self.decode( seq, skip_special_tokens=skip_special_tokens, clean_up_tokenization_spaces=clean_up_tokenization_spaces, **kwargs, ) for seq in sequences ] def _build_conversation_input_ids(self, conversation: "Conversation") -> List[int]: input_ids = [] for is_user, text in conversation.iter_texts(): input_ids.extend(self.encode(text, add_special_tokens=False) + [self.eos_token_id]) if len(input_ids) > self.model_max_length: input_ids = input_ids[-self.model_max_length:] return input_ids def apply_chat_template(self, messages, tokenize=False, add_generation_prompt=True) -> str: roles = { "user": "User: ", "assistant": "Assistant: ", } # 删除role不在roles中的消息 messages = [msg for msg in messages if msg['role'] in roles] return "\n\n".join([f"{roles[msg['role']]}{msg['content']}" for msg in messages]) + ("\n\nAssistant:" if add_generation_prompt else "")
21,442
tokenization_rwkv_world
py
en
python
code
{"qsc_code_num_words": 2634, "qsc_code_num_chars": 21442.0, "qsc_code_mean_word_length": 4.70652999, "qsc_code_frac_words_unique": 0.14616553, "qsc_code_frac_chars_top_2grams": 0.02903928, "qsc_code_frac_chars_top_3grams": 0.01355167, "qsc_code_frac_chars_top_4grams": 0.02218279, "qsc_code_frac_chars_dupe_5grams": 0.44284908, "qsc_code_frac_chars_dupe_6grams": 0.40162943, "qsc_code_frac_chars_dupe_7grams": 0.37517141, "qsc_code_frac_chars_dupe_8grams": 0.35032669, "qsc_code_frac_chars_dupe_9grams": 0.34613213, "qsc_code_frac_chars_dupe_10grams": 0.33967895, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00588432, "qsc_code_frac_chars_whitespace": 0.30253708, "qsc_code_size_file_byte": 21442.0, "qsc_code_num_lines": 551.0, "qsc_code_num_chars_line_max": 144.0, "qsc_code_num_chars_line_mean": 38.91470054, "qsc_code_frac_chars_alphabet": 0.82306921, "qsc_code_frac_chars_comments": 0.15530268, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.32608696, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.00483092, "qsc_code_frac_chars_string_length": 0.05775419, "qsc_code_frac_chars_long_word_length": 0.00993621, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.00724638, "qsc_codepython_cate_ast": 1.0, "qsc_codepython_frac_lines_func_ratio": 0.07487923, "qsc_codepython_cate_var_zero": false, "qsc_codepython_frac_lines_pass": 0.0, "qsc_codepython_frac_lines_import": 0.03864734, "qsc_codepython_frac_lines_simplefunc": 0.014492753623188406, "qsc_codepython_score_lines_no_logic": 0.23429952, "qsc_codepython_frac_lines_print": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codepython_cate_ast": 0, "qsc_codepython_frac_lines_func_ratio": 0, "qsc_codepython_cate_var_zero": 0, "qsc_codepython_frac_lines_pass": 0, "qsc_codepython_frac_lines_import": 0, "qsc_codepython_frac_lines_simplefunc": 0, "qsc_codepython_score_lines_no_logic": 0, "qsc_codepython_frac_lines_print": 0}
008chen/InterpolatorShow
app/src/main/res/layout/content_main.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:showIn="@layout/activity_main"> <android.support.v7.widget.CardView android:layout_width="match_parent" android:layout_height="wrap_content" > <com.cl.interpolatordebugger.InterpolatorView android:id="@+id/interpolatorview" android:layout_width="match_parent" android:layout_height="wrap_content" /> </android.support.v7.widget.CardView> <android.support.v7.widget.RecyclerView android:id="@+id/recycler_view" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerHorizontal="true" android:layout_centerVertical="true" /> </LinearLayout>
1,230
content_main
xml
en
xml
data
{"qsc_code_num_words": 133, "qsc_code_num_chars": 1230.0, "qsc_code_mean_word_length": 6.43609023, "qsc_code_frac_words_unique": 0.36842105, "qsc_code_frac_chars_top_2grams": 0.15186916, "qsc_code_frac_chars_top_3grams": 0.12616822, "qsc_code_frac_chars_top_4grams": 0.14018692, "qsc_code_frac_chars_dupe_5grams": 0.45443925, "qsc_code_frac_chars_dupe_6grams": 0.3703271, "qsc_code_frac_chars_dupe_7grams": 0.29205607, "qsc_code_frac_chars_dupe_8grams": 0.29205607, "qsc_code_frac_chars_dupe_9grams": 0.29205607, "qsc_code_frac_chars_dupe_10grams": 0.29205607, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00578592, "qsc_code_frac_chars_whitespace": 0.15691057, "qsc_code_size_file_byte": 1230.0, "qsc_code_num_lines": 32.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 38.4375, "qsc_code_frac_chars_alphabet": 0.81967213, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 1.0, "qsc_code_frac_lines_dupe_lines": 0.22222222, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.31056911, "qsc_code_frac_chars_long_word_length": 0.13821138, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_words_unique": 1, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 1, "qsc_code_cate_autogen": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0}
008chen/InterpolatorShow
app/src/main/res/layout/activity_main.xml
<?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context="com.cl.interpolatordebugger.MainActivity"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.AppBarOverlay"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:popupTheme="@style/AppTheme.PopupOverlay" /> </android.support.design.widget.AppBarLayout> <include layout="@layout/content_main" /> </android.support.design.widget.CoordinatorLayout>
1,077
activity_main
xml
en
xml
data
{"qsc_code_num_words": 119, "qsc_code_num_chars": 1077.0, "qsc_code_mean_word_length": 6.32773109, "qsc_code_frac_words_unique": 0.42016807, "qsc_code_frac_chars_top_2grams": 0.10358566, "qsc_code_frac_chars_top_3grams": 0.1062417, "qsc_code_frac_chars_top_4grams": 0.13811421, "qsc_code_frac_chars_dupe_5grams": 0.47808765, "qsc_code_frac_chars_dupe_6grams": 0.26294821, "qsc_code_frac_chars_dupe_7grams": 0.19123506, "qsc_code_frac_chars_dupe_8grams": 0.19123506, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00436681, "qsc_code_frac_chars_whitespace": 0.14948932, "qsc_code_size_file_byte": 1077.0, "qsc_code_num_lines": 27.0, "qsc_code_num_chars_line_max": 108.0, "qsc_code_num_chars_line_mean": 39.88888889, "qsc_code_frac_chars_alphabet": 0.81768559, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 1.0, "qsc_code_frac_lines_dupe_lines": 0.14285714, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.32590529, "qsc_code_frac_chars_long_word_length": 0.090065, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_words_unique": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 1, "qsc_code_cate_autogen": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_types.h
/** * @file lv_types.h * */ #ifndef LV_TYPES_H #define LV_TYPES_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ /********************* * DEFINES *********************/ #if __STDC_VERSION__ >= 199901L // If c99 or newer, use stdint.h to determine arch size #include <stdint.h> #endif // If __UINTPTR_MAX__ or UINTPTR_MAX are available, use them to determine arch size #if defined(__UINTPTR_MAX__) && __UINTPTR_MAX__ > 0xFFFFFFFF #define LV_ARCH_64 #elif defined(UINTPTR_MAX) && UINTPTR_MAX > 0xFFFFFFFF #define LV_ARCH_64 // Otherwise use compiler-dependent means to determine arch size #elif defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) || defined (__aarch64__) #define LV_ARCH_64 #endif /********************** * TYPEDEFS **********************/ /** * LVGL error codes. */ enum { LV_RES_INV = 0, /*Typically indicates that the object is deleted (become invalid) in the action function or an operation was failed*/ LV_RES_OK, /*The object is valid (no deleted) after the action*/ }; typedef uint8_t lv_res_t; #if __STDC_VERSION__ >= 199901L // If c99 or newer, use the definition of uintptr_t directly from <stdint.h> typedef uintptr_t lv_uintptr_t; #else // Otherwise, use the arch size determination #ifdef LV_ARCH_64 typedef uint64_t lv_uintptr_t; #else typedef uint32_t lv_uintptr_t; #endif #endif /********************** * GLOBAL PROTOTYPES **********************/ /********************** * MACROS **********************/ #define LV_UNUSED(x) ((void) x) #ifdef __cplusplus } /* extern "C" */ #endif #endif /*LV_TYPES_H*/
1,691
lv_types
h
en
c
code
{"qsc_code_num_words": 211, "qsc_code_num_chars": 1691.0, "qsc_code_mean_word_length": 4.49763033, "qsc_code_frac_words_unique": 0.42180095, "qsc_code_frac_chars_top_2grams": 0.06322445, "qsc_code_frac_chars_top_3grams": 0.0337197, "qsc_code_frac_chars_top_4grams": 0.06006322, "qsc_code_frac_chars_dupe_5grams": 0.26765016, "qsc_code_frac_chars_dupe_6grams": 0.18124341, "qsc_code_frac_chars_dupe_7grams": 0.18124341, "qsc_code_frac_chars_dupe_8grams": 0.18124341, "qsc_code_frac_chars_dupe_9grams": 0.18124341, "qsc_code_frac_chars_dupe_10grams": 0.10748156, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.0301941, "qsc_code_frac_chars_whitespace": 0.17740982, "qsc_code_size_file_byte": 1691.0, "qsc_code_num_lines": 87.0, "qsc_code_num_chars_line_max": 100.0, "qsc_code_num_chars_line_mean": 19.43678161, "qsc_code_frac_chars_alphabet": 0.65204889, "qsc_code_frac_chars_comments": 0.55115316, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.42424242, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00131926, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.02638522, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.12121212, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.12121212, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
00jacs/sveltekit-ultrafast
src/lib/supabase/database.d.ts
export type Json = | string | number | boolean | null | { [key: string]: Json | undefined } | Json[] export type Database = { public: { Tables: { countries: { Row: { continent: Database["public"]["Enums"]["continents"] | null id: number iso2: string iso3: string | null local_name: string | null name: string | null } Insert: { continent?: Database["public"]["Enums"]["continents"] | null id?: number iso2: string iso3?: string | null local_name?: string | null name?: string | null } Update: { continent?: Database["public"]["Enums"]["continents"] | null id?: number iso2?: string iso3?: string | null local_name?: string | null name?: string | null } Relationships: [] } } Views: { [_ in never]: never } Functions: { [_ in never]: never } Enums: { continents: | "Africa" | "Antarctica" | "Asia" | "Europe" | "Oceania" | "North America" | "South America" } CompositeTypes: { [_ in never]: never } } } type PublicSchema = Database[Extract<keyof Database, "public">] export type Tables< PublicTableNameOrOptions extends | keyof (PublicSchema["Tables"] & PublicSchema["Views"]) | { schema: keyof Database }, TableName extends PublicTableNameOrOptions extends { schema: keyof Database } ? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] & Database[PublicTableNameOrOptions["schema"]]["Views"]) : never = never, > = PublicTableNameOrOptions extends { schema: keyof Database } ? (Database[PublicTableNameOrOptions["schema"]]["Tables"] & Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends { Row: infer R } ? R : never : PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] & PublicSchema["Views"]) ? (PublicSchema["Tables"] & PublicSchema["Views"])[PublicTableNameOrOptions] extends { Row: infer R } ? R : never : never export type TablesInsert< PublicTableNameOrOptions extends | keyof PublicSchema["Tables"] | { schema: keyof Database }, TableName extends PublicTableNameOrOptions extends { schema: keyof Database } ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"] : never = never, > = PublicTableNameOrOptions extends { schema: keyof Database } ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { Insert: infer I } ? I : never : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] ? PublicSchema["Tables"][PublicTableNameOrOptions] extends { Insert: infer I } ? I : never : never export type TablesUpdate< PublicTableNameOrOptions extends | keyof PublicSchema["Tables"] | { schema: keyof Database }, TableName extends PublicTableNameOrOptions extends { schema: keyof Database } ? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"] : never = never, > = PublicTableNameOrOptions extends { schema: keyof Database } ? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends { Update: infer U } ? U : never : PublicTableNameOrOptions extends keyof PublicSchema["Tables"] ? PublicSchema["Tables"][PublicTableNameOrOptions] extends { Update: infer U } ? U : never : never export type Enums< PublicEnumNameOrOptions extends | keyof PublicSchema["Enums"] | { schema: keyof Database }, EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database } ? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"] : never = never, > = PublicEnumNameOrOptions extends { schema: keyof Database } ? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName] : PublicEnumNameOrOptions extends keyof PublicSchema["Enums"] ? PublicSchema["Enums"][PublicEnumNameOrOptions] : never
4,179
database.d
ts
en
typescript
code
{"qsc_code_num_words": 338, "qsc_code_num_chars": 4179.0, "qsc_code_mean_word_length": 7.65384615, "qsc_code_frac_words_unique": 0.15680473, "qsc_code_frac_chars_top_2grams": 0.08542714, "qsc_code_frac_chars_top_3grams": 0.08813297, "qsc_code_frac_chars_top_4grams": 0.08040201, "qsc_code_frac_chars_dupe_5grams": 0.75299575, "qsc_code_frac_chars_dupe_6grams": 0.68187089, "qsc_code_frac_chars_dupe_7grams": 0.62775416, "qsc_code_frac_chars_dupe_8grams": 0.57093158, "qsc_code_frac_chars_dupe_9grams": 0.53768844, "qsc_code_frac_chars_dupe_10grams": 0.53768844, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00195185, "qsc_code_frac_chars_whitespace": 0.26441732, "qsc_code_size_file_byte": 4179.0, "qsc_code_num_lines": 142.0, "qsc_code_num_chars_line_max": 82.0, "qsc_code_num_chars_line_mean": 29.42957746, "qsc_code_frac_chars_alphabet": 0.83962264, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.47058824, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.07848768, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/lib/components/page/hero/hero-centered.svelte
<script lang="ts"> const hero = { title: 'sveltekit-ultrafast ⚡️', subtitle: `A blazing fast SvelteKit boilerplate with TailwindCSS, DaisyUI & TypeScript. Authentication (Supabase), payments (Stripe), blog (Contentful) are ready-to-go.`, note: { text: 'See how it helps you build start-ups', link: 'https://x.com/jacob_the_coder', linkText: 'here' }, secondaryButton: { text: 'Follow on Twitter', link: 'https://twitter.com/jacob_the_coder' }, ctaButton: { text: 'Get started', link: '/docs' } } as const; </script> <div class="mx-auto max-w-2xl px-8 py-16 sm:py-24 lg:py-32"> <div class="hidden sm:mb-8 sm:flex sm:justify-center"> <div class="text-base-content-secondary relative rounded-full px-3 py-1 text-sm leading-6 ring-1 ring-base-300"> {hero.note.text} <a href={hero.note.link} target="_blank" class="font-semibold text-primary"> {hero.note.linkText} </a> </div> </div> <div class="text-center"> <h1 class="text-4xl font-bold leading-tight tracking-tight sm:text-6xl"> {hero.title} </h1> <p class="text-base-content-secondary mt-6 leading-8"> {hero.subtitle} </p> <div class="mt-10 flex items-center justify-center gap-x-6"> <a href={hero.secondaryButton.link} target="_blank" class="link text-sm font-semibold leading-6 no-underline"> {hero.secondaryButton.text} </a> <a href={hero.ctaButton.link} class="btn btn-primary font-semibold"> {hero.ctaButton.text} </a> </div> </div> </div>
1,542
hero-centered
svelte
en
svelte
code
{"qsc_code_num_words": 224, "qsc_code_num_chars": 1542.0, "qsc_code_mean_word_length": 4.44196429, "qsc_code_frac_words_unique": 0.48214286, "qsc_code_frac_chars_top_2grams": 0.04020101, "qsc_code_frac_chars_top_3grams": 0.02713568, "qsc_code_frac_chars_top_4grams": 0.0321608, "qsc_code_frac_chars_dupe_5grams": 0.05829146, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02068417, "qsc_code_frac_chars_whitespace": 0.1848249, "qsc_code_size_file_byte": 1542.0, "qsc_code_num_lines": 53.0, "qsc_code_num_chars_line_max": 95.0, "qsc_code_num_chars_line_mean": 29.09433962, "qsc_code_frac_chars_alphabet": 0.76929196, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.15686275, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.01960784, "qsc_code_frac_chars_string_length": 0.33787289, "qsc_code_frac_chars_long_word_length": 0.01750973, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/lib/components/page/notifications/notifications.svelte
<script lang="ts"> import { fade } from 'svelte/transition'; import { notifications } from './notifications-store'; import { Icon, CheckCircle, InformationCircle, ExclamationTriangle } from 'svelte-hero-icons'; const notificationTypes = { info: { icon: InformationCircle, color: 'text-base-200' }, success: { icon: CheckCircle, color: 'text-green-400' }, warning: { icon: ExclamationTriangle, color: 'text-yellow-500' }, error: { icon: ExclamationTriangle, color: 'text-red-500' } } as const; </script> <div id="notifications-container" class="pointer-events-none fixed inset-0 z-50 flex items-end px-4 py-6 sm:items-start sm:p-6"> <div class="flex w-full flex-col items-center space-y-4 sm:items-end"> {#each $notifications as notification (notification.id)} <div class="pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-base-100 shadow-lg ring-1 ring-base-content ring-opacity-5" transition:fade> <div class="p-4"> <div class="flex items-start"> <div class="flex-shrink-0"> <Icon src={notificationTypes[notification.type].icon} class="h-6 w-6 stroke-current {notificationTypes[notification.type] .color}" /> </div> <div class="ml-3 flex-1 pt-0.5"> <p class="text-sm font-medium">{notification.title}</p> {#if notification.description} <p class="text-base-content-secondary mt-1 text-sm"> {notification.description} </p> {/if} </div> </div> </div> </div> {/each} </div> </div>
1,613
notifications
svelte
en
svelte
code
{"qsc_code_num_words": 205, "qsc_code_num_chars": 1613.0, "qsc_code_mean_word_length": 4.93170732, "qsc_code_frac_words_unique": 0.44878049, "qsc_code_frac_chars_top_2grams": 0.04747774, "qsc_code_frac_chars_top_3grams": 0.03560831, "qsc_code_frac_chars_top_4grams": 0.06330366, "qsc_code_frac_chars_dupe_5grams": 0.0, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02619048, "qsc_code_frac_chars_whitespace": 0.21884687, "qsc_code_size_file_byte": 1613.0, "qsc_code_num_lines": 62.0, "qsc_code_num_chars_line_max": 96.0, "qsc_code_num_chars_line_mean": 26.01612903, "qsc_code_frac_chars_alphabet": 0.77619048, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.18644068, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.03389831, "qsc_code_frac_chars_string_length": 0.23806572, "qsc_code_frac_chars_long_word_length": 0.04401736, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/lib/components/page/notifications/notifications-store.ts
import { writable } from 'svelte/store'; import { generateUUID } from '$lib/utils/uuid'; type NotificationType = 'info' | 'success' | 'warning' | 'error'; export interface Notification { id: string; type: NotificationType; dismissible: boolean; timeout: number; title: string; description?: string; } export const notifications = writable<Notification[]>([]); export const addNotification = (notification: Partial<Notification>) => { const id = notification?.id || generateUUID(); const notificationDefaults: Notification = { id, type: 'info', dismissible: true, timeout: 3000, title: '', description: '' }; const newNotification: Notification = { ...notificationDefaults, ...notification }; notifications.update((notifications) => { return [newNotification, ...notifications]; }); if (newNotification.timeout) { setTimeout(() => hideNotification(id), newNotification.timeout); } }; export const hideNotification = (id: string) => { notifications.update((all) => all.filter((t) => t.id != id)); }; export const notify = (type: NotificationType, title: string, description?: string) => { addNotification({ type, title, description: description || '' }); };
1,210
notifications-store
ts
en
typescript
code
{"qsc_code_num_words": 107, "qsc_code_num_chars": 1210.0, "qsc_code_mean_word_length": 7.75700935, "qsc_code_frac_words_unique": 0.40186916, "qsc_code_frac_chars_top_2grams": 0.05301205, "qsc_code_frac_chars_top_3grams": 0.05301205, "qsc_code_frac_chars_top_4grams": 0.06746988, "qsc_code_frac_chars_dupe_5grams": 0.0, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00392157, "qsc_code_frac_chars_whitespace": 0.15702479, "qsc_code_size_file_byte": 1210.0, "qsc_code_num_lines": 53.0, "qsc_code_num_chars_line_max": 89.0, "qsc_code_num_chars_line_mean": 22.83018868, "qsc_code_frac_chars_alphabet": 0.80980392, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.1627907, "qsc_code_cate_autogen": 1.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0446281, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 1, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_area.h
/** * @file lv_area.h * */ #ifndef LV_AREA_H #define LV_AREA_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #include "../lv_conf_internal.h" #include <string.h> #include <stdbool.h> #include <stdint.h> #include "lv_mem.h" /********************* * DEFINES *********************/ /*To avoid overflow don't let the max ranges (reduce with 1000) */ #define LV_COORD_MAX ((lv_coord_t)((uint32_t)((uint32_t)1 << (8 * sizeof(lv_coord_t) - 1)) - 1000)) #define LV_COORD_MIN (-LV_COORD_MAX) LV_EXPORT_CONST_INT(LV_COORD_MAX); LV_EXPORT_CONST_INT(LV_COORD_MIN); /********************** * TYPEDEFS **********************/ /** * Represents a point on the screen. */ typedef struct { lv_coord_t x; lv_coord_t y; } lv_point_t; /** Represents an area of the screen. */ typedef struct { lv_coord_t x1; lv_coord_t y1; lv_coord_t x2; lv_coord_t y2; } lv_area_t; /** Alignments */ enum { LV_ALIGN_CENTER = 0, LV_ALIGN_IN_TOP_LEFT, LV_ALIGN_IN_TOP_MID, LV_ALIGN_IN_TOP_RIGHT, LV_ALIGN_IN_BOTTOM_LEFT, LV_ALIGN_IN_BOTTOM_MID, LV_ALIGN_IN_BOTTOM_RIGHT, LV_ALIGN_IN_LEFT_MID, LV_ALIGN_IN_RIGHT_MID, LV_ALIGN_OUT_TOP_LEFT, LV_ALIGN_OUT_TOP_MID, LV_ALIGN_OUT_TOP_RIGHT, LV_ALIGN_OUT_BOTTOM_LEFT, LV_ALIGN_OUT_BOTTOM_MID, LV_ALIGN_OUT_BOTTOM_RIGHT, LV_ALIGN_OUT_LEFT_TOP, LV_ALIGN_OUT_LEFT_MID, LV_ALIGN_OUT_LEFT_BOTTOM, LV_ALIGN_OUT_RIGHT_TOP, LV_ALIGN_OUT_RIGHT_MID, LV_ALIGN_OUT_RIGHT_BOTTOM, }; typedef uint8_t lv_align_t; /********************** * GLOBAL PROTOTYPES **********************/ /** * Initialize an area * @param area_p pointer to an area * @param x1 left coordinate of the area * @param y1 top coordinate of the area * @param x2 right coordinate of the area * @param y2 bottom coordinate of the area */ void lv_area_set(lv_area_t * area_p, lv_coord_t x1, lv_coord_t y1, lv_coord_t x2, lv_coord_t y2); /** * Copy an area * @param dest pointer to the destination area * @param src pointer to the source area */ inline static void lv_area_copy(lv_area_t * dest, const lv_area_t * src) { _lv_memcpy_small(dest, src, sizeof(lv_area_t)); } /** * Get the width of an area * @param area_p pointer to an area * @return the width of the area (if x1 == x2 -> width = 1) */ static inline lv_coord_t lv_area_get_width(const lv_area_t * area_p) { return (lv_coord_t)(area_p->x2 - area_p->x1 + 1); } /** * Get the height of an area * @param area_p pointer to an area * @return the height of the area (if y1 == y2 -> height = 1) */ static inline lv_coord_t lv_area_get_height(const lv_area_t * area_p) { return (lv_coord_t)(area_p->y2 - area_p->y1 + 1); } /** * Set the width of an area * @param area_p pointer to an area * @param w the new width of the area (w == 1 makes x1 == x2) */ void lv_area_set_width(lv_area_t * area_p, lv_coord_t w); /** * Set the height of an area * @param area_p pointer to an area * @param h the new height of the area (h == 1 makes y1 == y2) */ void lv_area_set_height(lv_area_t * area_p, lv_coord_t h); /** * Set the position of an area (width and height will be kept) * @param area_p pointer to an area * @param x the new x coordinate of the area * @param y the new y coordinate of the area */ void _lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y); /** * Return with area of an area (x * y) * @param area_p pointer to an area * @return size of area */ uint32_t lv_area_get_size(const lv_area_t * area_p); /** * Get the common parts of two areas * @param res_p pointer to an area, the result will be stored her * @param a1_p pointer to the first area * @param a2_p pointer to the second area * @return false: the two area has NO common parts, res_p is invalid */ bool _lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p); /** * Join two areas into a third which involves the other two * @param res_p pointer to an area, the result will be stored here * @param a1_p pointer to the first area * @param a2_p pointer to the second area */ void _lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t * a2_p); /** * Check if a point is on an area * @param a_p pointer to an area * @param p_p pointer to a point * @param radius radius of area (e.g. for rounded rectangle) * @return false:the point is out of the area */ bool _lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, lv_coord_t radius); /** * Check if two area has common parts * @param a1_p pointer to an area. * @param a2_p pointer to an other area * @return false: a1_p and a2_p has no common parts */ bool _lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p); /** * Check if an area is fully on an other * @param ain_p pointer to an area which could be in 'aholder_p' * @param aholder_p pointer to an area which could involve 'ain_p' * @param radius radius of `aholder_p` (e.g. for rounded rectangle) * @return true: `ain_p` is fully inside `aholder_p` */ bool _lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, lv_coord_t radius); /** * Align an area to an other * @param base an are where the other will be aligned * @param to_align the area to align * @param align `LV_ALIGN_...` * @param res x/y coordinates where `to_align` align area should be placed */ void _lv_area_align(const lv_area_t * base, const lv_area_t * to_align, lv_align_t align, lv_point_t * res); /********************** * MACROS **********************/ #ifdef __cplusplus } /* extern "C" */ #endif #endif
5,662
lv_area
h
en
c
code
{"qsc_code_num_words": 1010, "qsc_code_num_chars": 5662.0, "qsc_code_mean_word_length": 3.48910891, "qsc_code_frac_words_unique": 0.14950495, "qsc_code_frac_chars_top_2grams": 0.06980704, "qsc_code_frac_chars_top_3grams": 0.0476731, "qsc_code_frac_chars_top_4grams": 0.05107832, "qsc_code_frac_chars_dupe_5grams": 0.43586833, "qsc_code_frac_chars_dupe_6grams": 0.35953462, "qsc_code_frac_chars_dupe_7grams": 0.32406356, "qsc_code_frac_chars_dupe_8grams": 0.29682179, "qsc_code_frac_chars_dupe_9grams": 0.23297389, "qsc_code_frac_chars_dupe_10grams": 0.19920545, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01378254, "qsc_code_frac_chars_whitespace": 0.1926881, "qsc_code_size_file_byte": 5662.0, "qsc_code_num_lines": 215.0, "qsc_code_num_chars_line_max": 109.0, "qsc_code_num_chars_line_mean": 26.33488372, "qsc_code_frac_chars_alphabet": 0.75716473, "qsc_code_frac_chars_comments": 0.54927587, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.09333333, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01175549, "qsc_code_frac_chars_long_word_length": 0.00822884, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.18666667, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.25333333, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_AppNote.cpp
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #include "ESP32Berry_AppNote.h" static AppNote *instance = NULL; AppNote::AppNote(Display *display, System *system, Network *network, const char *title) : AppBase(display, system, network, title) { _bodyScreen = display->get_body_screen(); instance = this; menuIdx = 0; contents = ""; this->draw_ui(); } AppNote::~AppNote() {} extern "C" void app_note_textarea_event_cb_thunk(lv_event_t *e) { instance->_display->textarea_event_cb(e); } extern "C" void event_handler_thunk(lv_event_t *e) { instance->event_handler(e); } extern "C" void file_event_cb_thunk(lv_event_t *e) { instance->file_event_cb(e); } void AppNote::event_handler(lv_event_t *e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t *obj = lv_event_get_target(e); if (code == LV_EVENT_CLICKED) { if (obj == uiFileListCloseBtn) { this->ui_close_file(); } else if (obj == saveBoxSaveBtn) { String newFilename = String(lv_textarea_get_text(saveBoxFileName)); newFilename.trim(); if (newFilename.length() == 0) { this->ui_message_box(menuItem, "The file name is empty.", false); } else { String text = String(lv_textarea_get_text(textarea)); text.trim(); String filePath = String(NOTE_PATH) + "/" + newFilename; if (_system->write_file(filePath.c_str(), text.c_str())) { this->ui_message_box(menuItem, "The file created successfully! ", false); this->menu_action(); } else { this->ui_message_box(menuItem, "Something Wrong!\nThe file creation failed.", false); } } lv_obj_del(this->saveBox); } else if (obj == saveBoxCloseBtn) { lv_obj_del(this->saveBox); } } else if (code == LV_EVENT_VALUE_CHANGED) { if (obj == dropDownMenu) { lv_dropdown_get_selected_str(obj, menuItem, sizeof(menuItem)); menuIdx = lv_dropdown_get_selected(obj); String newContents = String(lv_textarea_get_text(textarea)); newContents.trim(); if (menuIdx == 2) { this->ui_save_box(); return; } bool needTOSave = newContents != contents && newContents.length() != 0; if (needTOSave) { this->ui_message_box(menuItem, "Do you want to save it?", true); } else { this->menu_action(); } } else { lv_obj_t *cont = lv_event_get_current_target(e); if (obj == cont) return; if (lv_msgbox_get_active_btn(cont) == 1) { this->ui_save_box(); } else { this->ui_write_textarea(""); this->ui_reset(); } lv_msgbox_close(msgBox); } } } void AppNote::file_event_cb(lv_event_t *e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t *obj = lv_event_get_target(e); if (code == LV_EVENT_CLICKED) { String selectedFile = lv_list_get_btn_text(uiFileList, obj); filename = selectedFile.substring(0, selectedFile.indexOf(" (")); String filePath = String(NOTE_PATH) + "/" + filename; instance->contents = _system->read_file(filePath.c_str()); instance->ui_write_textarea(instance->contents); instance->ui_close_file(); lv_label_set_text(currentFileName, filename.c_str()); } } void AppNote::draw_ui() { dropDownMenu = lv_dropdown_create(appMain); lv_obj_align_to(dropDownMenu, appTitle, LV_ALIGN_OUT_RIGHT_MID, 10, 0); lv_dropdown_set_options(dropDownMenu, "New file\n" "Save\n" "Save as ...\n" "Open File\n" "Exit"); lv_dropdown_set_text(dropDownMenu, "Menu"); lv_obj_add_event_cb(dropDownMenu, event_handler_thunk, LV_EVENT_VALUE_CHANGED, NULL); currentFileName = lv_label_create(appMain); lv_label_set_long_mode(currentFileName, LV_LABEL_LONG_SCROLL_CIRCULAR); lv_obj_set_width(currentFileName, 150); lv_label_set_text(currentFileName, "Untitled"); lv_obj_align_to(currentFileName, dropDownMenu, LV_ALIGN_OUT_RIGHT_MID, 10, 0); textarea = lv_textarea_create(appMain); lv_obj_align(textarea, LV_ALIGN_TOP_MID, 0, 36); lv_obj_set_size(textarea, 460, 210); lv_obj_add_event_cb(textarea, app_note_textarea_event_cb_thunk, LV_EVENT_FOCUSED, NULL); lv_obj_add_event_cb(textarea, app_note_textarea_event_cb_thunk, LV_EVENT_DEFOCUSED, NULL); } void AppNote::ui_message_box(const char *title, String msg, bool isSelectable) { static const char *multipBtns[] = { "No", "Yes", "" }; static const char *singleBtns[] = { "Ok", "" }; msgBox = lv_msgbox_create(appMain, title, msg.c_str(), isSelectable ? multipBtns : singleBtns, true); lv_obj_add_event_cb(msgBox, event_handler_thunk, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_center(msgBox); } void AppNote::ui_save_box() { saveBox = lv_obj_create(appMain); lv_obj_set_size(saveBox, DISPLAY_WIDTH * 2 / 3, DISPLAY_HEIGHT / 2); lv_obj_center(saveBox); saveBoxTitle = lv_label_create(saveBox); lv_label_set_text(saveBoxTitle, menuItem); lv_obj_set_size(saveBoxTitle, DISPLAY_WIDTH * 2 / 3 - 40, 40); lv_obj_align(saveBoxTitle, LV_ALIGN_TOP_MID, 0, 0); saveBoxFileName = lv_textarea_create(saveBox); lv_obj_set_size(saveBoxFileName, DISPLAY_WIDTH * 2 / 3 - 40, 40); lv_obj_align_to(saveBoxFileName, saveBoxTitle, LV_ALIGN_TOP_MID, 0, 40); if (filename != "" || filename != "Untitled") { lv_textarea_set_text(saveBoxFileName, filename.c_str()); } else { lv_textarea_set_placeholder_text(saveBoxFileName, "filename?"); } lv_obj_add_event_cb(saveBoxFileName, app_note_textarea_event_cb_thunk, LV_EVENT_FOCUSED, NULL); lv_obj_add_event_cb(saveBoxFileName, app_note_textarea_event_cb_thunk, LV_EVENT_DEFOCUSED, NULL); saveBoxSaveBtn = lv_btn_create(saveBox); lv_obj_add_event_cb(saveBoxSaveBtn, event_handler_thunk, LV_EVENT_CLICKED, NULL); lv_obj_align(saveBoxSaveBtn, LV_ALIGN_BOTTOM_RIGHT, 0, 0); lv_obj_t *btnLabel = lv_label_create(saveBoxSaveBtn); lv_label_set_text(btnLabel, "Save"); lv_obj_center(btnLabel); saveBoxCloseBtn = lv_btn_create(saveBox); lv_obj_add_event_cb(saveBoxCloseBtn, event_handler_thunk, LV_EVENT_CLICKED, NULL); lv_obj_align(saveBoxCloseBtn, LV_ALIGN_BOTTOM_LEFT, 0, 0); lv_obj_t *btnLabel2 = lv_label_create(saveBoxCloseBtn); lv_label_set_text(btnLabel2, "Cancel"); lv_obj_center(btnLabel2); } void AppNote::ui_open_file() { uiFileList = lv_list_create(appMain); lv_obj_set_size(uiFileList, DISPLAY_WIDTH - 40, DISPLAY_HEIGHT - 80); lv_obj_center(uiFileList); lv_list_add_text(uiFileList, "/Note"); uiFileListCloseBtn = lv_btn_create(uiFileList); lv_obj_set_size(uiFileListCloseBtn, 30, 30); lv_obj_add_flag(uiFileListCloseBtn, LV_OBJ_FLAG_FLOATING); lv_obj_align(uiFileListCloseBtn, LV_ALIGN_TOP_RIGHT, 0, 0); lv_obj_add_event_cb(uiFileListCloseBtn, event_handler_thunk, LV_EVENT_CLICKED, NULL); lv_obj_t *label = lv_label_create(uiFileListCloseBtn); lv_label_set_text(label, LV_SYMBOL_CLOSE); lv_obj_center(label); lv_obj_add_flag(uiFileList, LV_OBJ_FLAG_HIDDEN); std::vector<String> noteFileList = _system->list_dir(NOTE_PATH); if (noteFileList.size() == 0) return; for (std::vector<String>::iterator item = noteFileList.begin(); item != noteFileList.end(); ++item) { lv_obj_t *btn = lv_list_add_btn(uiFileList, LV_SYMBOL_FILE, (*item).c_str()); lv_obj_add_event_cb(btn, file_event_cb_thunk, LV_EVENT_CLICKED, NULL); } lv_obj_move_foreground(uiFileListCloseBtn); lv_obj_clear_flag(uiFileList, LV_OBJ_FLAG_HIDDEN); } void AppNote::menu_action() { switch (menuIdx) { case 0: this->ui_write_textarea(""); this->ui_reset(); break; case 3: this->ui_open_file(); break; case 4: this->close_app(); break; } } void AppNote::ui_write_textarea(String contents) { lv_textarea_set_text(textarea, contents.c_str()); } void AppNote::ui_reset() { filename = ""; lv_label_set_text(currentFileName, "Untitled"); } void AppNote::ui_close_file() { lv_obj_add_flag(uiFileList, LV_OBJ_FLAG_HIDDEN); lv_obj_del(uiFileList); } void AppNote::close_app() { uint32_t child_cnt = lv_obj_get_child_cnt(appMain); if (child_cnt > 5) { return; } if (appMain != NULL) { lv_obj_del_async(appMain); appMain = NULL; delete this; } }
8,570
ESP32Berry_AppNote
cpp
en
cpp
code
{"qsc_code_num_words": 1145, "qsc_code_num_chars": 8570.0, "qsc_code_mean_word_length": 4.75720524, "qsc_code_frac_words_unique": 0.17467249, "qsc_code_frac_chars_top_2grams": 0.04865063, "qsc_code_frac_chars_top_3grams": 0.02863962, "qsc_code_frac_chars_top_4grams": 0.02386635, "qsc_code_frac_chars_dupe_5grams": 0.33100789, "qsc_code_frac_chars_dupe_6grams": 0.27299431, "qsc_code_frac_chars_dupe_7grams": 0.21718377, "qsc_code_frac_chars_dupe_8grams": 0.17275565, "qsc_code_frac_chars_dupe_9grams": 0.14466679, "qsc_code_frac_chars_dupe_10grams": 0.10134019, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01061421, "qsc_code_frac_chars_whitespace": 0.17549592, "qsc_code_size_file_byte": 8570.0, "qsc_code_num_lines": 261.0, "qsc_code_num_chars_line_max": 104.0, "qsc_code_num_chars_line_mean": 32.83524904, "qsc_code_frac_chars_alphabet": 0.7602604, "qsc_code_frac_chars_comments": 0.03150525, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.15048544, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.03011685, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codecpp_frac_lines_preprocessor_directives": 0.00485437, "qsc_codecpp_frac_lines_func_ratio": 0.01456311, "qsc_codecpp_cate_bitsstdc": 0.0, "qsc_codecpp_nums_lines_main": 0.0, "qsc_codecpp_frac_lines_goto": 0.0, "qsc_codecpp_cate_var_zero": 0.0, "qsc_codecpp_score_lines_no_logic": 0.02912621, "qsc_codecpp_frac_lines_print": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codecpp_frac_lines_func_ratio": 0, "qsc_codecpp_nums_lines_main": 0, "qsc_codecpp_score_lines_no_logic": 0, "qsc_codecpp_frac_lines_preprocessor_directives": 0, "qsc_codecpp_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_Icon_ESPNow.c
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #include "lvgl.h" #ifndef LV_ATTRIBUTE_MEM_ALIGN #define LV_ATTRIBUTE_MEM_ALIGN #endif #ifndef LV_ATTRIBUTE_IMG_ESP32BERRY_ICON_ESPNOW #define LV_ATTRIBUTE_IMG_ESP32BERRY_ICON_ESPNOW #endif const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_ESP32BERRY_ICON_ESPNOW uint8_t ESP32Berry_Icon_ESPNow_map[] = { 0x00, 0x00, 0x00, 0x00, /*Color of index 0*/ 0xff, 0xff, 0xff, 0x02, /*Color of index 1*/ 0xff, 0xff, 0xff, 0x73, /*Color of index 2*/ 0xff, 0xff, 0xff, 0xca, /*Color of index 3*/ 0xff, 0xff, 0xff, 0xaa, /*Color of index 4*/ 0xff, 0xff, 0xff, 0x3e, /*Color of index 5*/ 0xff, 0xff, 0xff, 0x92, /*Color of index 6*/ 0xff, 0xff, 0xff, 0x1c, /*Color of index 7*/ 0xff, 0xff, 0xff, 0xf3, /*Color of index 8*/ 0xff, 0xff, 0xff, 0xe5, /*Color of index 9*/ 0xff, 0xff, 0xff, 0x59, /*Color of index 10*/ 0xff, 0xff, 0xff, 0xbc, /*Color of index 11*/ 0xff, 0xff, 0xff, 0x84, /*Color of index 12*/ 0xff, 0xff, 0xff, 0x9c, /*Color of index 13*/ 0xff, 0xff, 0xff, 0x2d, /*Color of index 14*/ 0xff, 0xff, 0xff, 0x4c, /*Color of index 15*/ 0xff, 0xff, 0xff, 0xc2, /*Color of index 16*/ 0xff, 0xff, 0xff, 0x6b, /*Color of index 17*/ 0xff, 0xff, 0xff, 0xdc, /*Color of index 18*/ 0xff, 0xff, 0xff, 0x12, /*Color of index 19*/ 0xff, 0xff, 0xff, 0xed, /*Color of index 20*/ 0xff, 0xff, 0xff, 0xa4, /*Color of index 21*/ 0xff, 0xff, 0xff, 0xb3, /*Color of index 22*/ 0xff, 0xff, 0xff, 0x26, /*Color of index 23*/ 0xff, 0xff, 0xff, 0x8a, /*Color of index 24*/ 0xff, 0xff, 0xff, 0x7c, /*Color of index 25*/ 0xff, 0xff, 0xff, 0x54, /*Color of index 26*/ 0xff, 0xff, 0xff, 0x36, /*Color of index 27*/ 0xff, 0xff, 0xff, 0x60, /*Color of index 28*/ 0xff, 0xff, 0xff, 0xcf, /*Color of index 29*/ 0xff, 0xff, 0xff, 0x42, /*Color of index 30*/ 0xfe, 0xfe, 0xfe, 0xfe, /*Color of index 31*/ 0x30, 0xe7, 0xff, 0xfe, /*Color of index 32*/ 0x31, 0xe1, 0xff, 0xfe, /*Color of index 33*/ 0x33, 0xda, 0xff, 0xfe, /*Color of index 34*/ 0x35, 0xd7, 0xff, 0xfe, /*Color of index 35*/ 0x35, 0xd3, 0xff, 0xfe, /*Color of index 36*/ 0x39, 0xc8, 0xfe, 0xfe, /*Color of index 37*/ 0x3c, 0xc0, 0xfa, 0xfe, /*Color of index 38*/ 0x3d, 0xbe, 0xfa, 0xfe, /*Color of index 39*/ 0x43, 0xbd, 0xe8, 0xfe, /*Color of index 40*/ 0x41, 0xc0, 0xd9, 0xfe, /*Color of index 41*/ 0x42, 0xb9, 0xd6, 0xfe, /*Color of index 42*/ 0x41, 0xb3, 0xe3, 0xfe, /*Color of index 43*/ 0x44, 0xb1, 0xc7, 0xfe, /*Color of index 44*/ 0x47, 0xad, 0xc1, 0xfe, /*Color of index 45*/ 0x47, 0xa8, 0xcd, 0xfe, /*Color of index 46*/ 0x46, 0xa8, 0xc3, 0xfe, /*Color of index 47*/ 0x45, 0xa2, 0xc8, 0xfe, /*Color of index 48*/ 0x45, 0xa1, 0xc6, 0xfe, /*Color of index 49*/ 0x47, 0x9f, 0xc3, 0xfe, /*Color of index 50*/ 0x45, 0x99, 0xb8, 0xfe, /*Color of index 51*/ 0x45, 0x99, 0xb7, 0xfe, /*Color of index 52*/ 0x46, 0x95, 0xb1, 0xfe, /*Color of index 53*/ 0x46, 0x93, 0xae, 0xfe, /*Color of index 54*/ 0x47, 0x8d, 0x99, 0xfe, /*Color of index 55*/ 0x52, 0x89, 0x97, 0xfe, /*Color of index 56*/ 0x51, 0x87, 0x94, 0xfe, /*Color of index 57*/ 0x4f, 0x84, 0x8f, 0xfe, /*Color of index 58*/ 0x4a, 0x82, 0x91, 0xfe, /*Color of index 59*/ 0x49, 0x7e, 0x8a, 0xfe, /*Color of index 60*/ 0x4a, 0x7c, 0x89, 0xfe, /*Color of index 61*/ 0x47, 0x79, 0x81, 0xfe, /*Color of index 62*/ 0x2c, 0xf2, 0xff, 0xfe, /*Color of index 63*/ 0x49, 0x89, 0x89, 0xfe, /*Color of index 64*/ 0x4c, 0x7e, 0x82, 0xfe, /*Color of index 65*/ 0x49, 0x7b, 0x7a, 0xfe, /*Color of index 66*/ 0x47, 0x70, 0x69, 0xfe, /*Color of index 67*/ 0x4d, 0x63, 0x5b, 0xfe, /*Color of index 68*/ 0xf7, 0xf9, 0xf3, 0xfe, /*Color of index 69*/ 0xe6, 0xff, 0xad, 0xfe, /*Color of index 70*/ 0xf6, 0xf6, 0xef, 0xfe, /*Color of index 71*/ 0xf4, 0xf4, 0xf1, 0xfe, /*Color of index 72*/ 0xe1, 0xfa, 0xa6, 0xfe, /*Color of index 73*/ 0xdf, 0xf6, 0xa4, 0xfe, /*Color of index 74*/ 0xe5, 0xe1, 0xd2, 0xfe, /*Color of index 75*/ 0xd9, 0xed, 0x9c, 0xfe, /*Color of index 76*/ 0xd3, 0xe2, 0x93, 0xfe, /*Color of index 77*/ 0xcf, 0xdd, 0x8f, 0xfe, /*Color of index 78*/ 0xcd, 0xda, 0x8c, 0xfe, /*Color of index 79*/ 0xca, 0xd5, 0x8a, 0xfe, /*Color of index 80*/ 0xc9, 0xd2, 0x85, 0xfe, /*Color of index 81*/ 0xc6, 0xce, 0x83, 0xfe, /*Color of index 82*/ 0xc3, 0xcb, 0x80, 0xfe, /*Color of index 83*/ 0xc2, 0xc8, 0x7f, 0xfe, /*Color of index 84*/ 0xc1, 0xc6, 0x7c, 0xfe, /*Color of index 85*/ 0xbe, 0xc3, 0x79, 0xfe, /*Color of index 86*/ 0xbf, 0xc3, 0x77, 0xfe, /*Color of index 87*/ 0xb9, 0xb9, 0x71, 0xfe, /*Color of index 88*/ 0xb7, 0xb7, 0x6e, 0xfe, /*Color of index 89*/ 0xb4, 0xb1, 0x6d, 0xfe, /*Color of index 90*/ 0xb3, 0xaa, 0x61, 0xfe, /*Color of index 91*/ 0xa8, 0xa1, 0x5b, 0xfe, /*Color of index 92*/ 0xa8, 0x9e, 0x58, 0xfe, /*Color of index 93*/ 0xa7, 0x9c, 0x5c, 0xfe, /*Color of index 94*/ 0xa4, 0x9a, 0x55, 0xfe, /*Color of index 95*/ 0xa8, 0x98, 0x52, 0xfe, /*Color of index 96*/ 0xa4, 0x99, 0x4c, 0xfe, /*Color of index 97*/ 0xa5, 0x96, 0x51, 0xfe, /*Color of index 98*/ 0xa1, 0x93, 0x47, 0xfe, /*Color of index 99*/ 0x9d, 0x8e, 0x45, 0xfe, /*Color of index 100*/ 0x8c, 0x72, 0x32, 0xfe, /*Color of index 101*/ 0xf5, 0xf1, 0xee, 0xfe, /*Color of index 102*/ 0xf3, 0xee, 0xec, 0xfe, /*Color of index 103*/ 0xed, 0xe9, 0xe2, 0xfe, /*Color of index 104*/ 0xef, 0xe9, 0xde, 0xfe, /*Color of index 105*/ 0xeb, 0xe5, 0xe2, 0xfe, /*Color of index 106*/ 0xec, 0xe5, 0xdb, 0xfe, /*Color of index 107*/ 0xe8, 0xe3, 0xe0, 0xfe, /*Color of index 108*/ 0xe9, 0xe2, 0xd7, 0xfe, /*Color of index 109*/ 0xe7, 0xdf, 0xd9, 0xfe, /*Color of index 110*/ 0xe3, 0xda, 0xd3, 0xfe, /*Color of index 111*/ 0xdf, 0xd8, 0xd1, 0xfe, /*Color of index 112*/ 0xdf, 0xd5, 0xce, 0xfe, /*Color of index 113*/ 0xdc, 0xd1, 0xcc, 0xfe, /*Color of index 114*/ 0xdc, 0xd0, 0xc4, 0xfe, /*Color of index 115*/ 0xd9, 0xcb, 0xc2, 0xfe, /*Color of index 116*/ 0xda, 0xcb, 0xbe, 0xfe, /*Color of index 117*/ 0xd6, 0xc8, 0xbe, 0xfe, /*Color of index 118*/ 0xd4, 0xc7, 0xbf, 0xfe, /*Color of index 119*/ 0xd2, 0xc4, 0xb1, 0xfe, /*Color of index 120*/ 0xcf, 0xc0, 0xb0, 0xfe, /*Color of index 121*/ 0xce, 0xba, 0xa9, 0xfe, /*Color of index 122*/ 0xcd, 0xb7, 0xa5, 0xfe, /*Color of index 123*/ 0xcd, 0xb7, 0xa3, 0xfe, /*Color of index 124*/ 0xc4, 0xb1, 0xa0, 0xfe, /*Color of index 125*/ 0xc1, 0xac, 0x98, 0xfe, /*Color of index 126*/ 0xb9, 0x9b, 0x8e, 0xfe, /*Color of index 127*/ 0xba, 0x9d, 0x86, 0xfe, /*Color of index 128*/ 0xae, 0x92, 0x8a, 0xfe, /*Color of index 129*/ 0xb4, 0x92, 0x82, 0xfe, /*Color of index 130*/ 0xa3, 0x84, 0x73, 0xfe, /*Color of index 131*/ 0x9c, 0x79, 0x6e, 0xfe, /*Color of index 132*/ 0xab, 0x79, 0x60, 0xfe, /*Color of index 133*/ 0x9a, 0x77, 0x6b, 0xfe, /*Color of index 134*/ 0xaa, 0x7a, 0x58, 0xfe, /*Color of index 135*/ 0xa9, 0x78, 0x55, 0xfe, /*Color of index 136*/ 0xa6, 0x74, 0x59, 0xfe, /*Color of index 137*/ 0x8e, 0x6a, 0x63, 0xfe, /*Color of index 138*/ 0x93, 0x6b, 0x57, 0xfe, /*Color of index 139*/ 0x8e, 0x6f, 0x2d, 0xfe, /*Color of index 140*/ 0x89, 0x5e, 0x44, 0xfe, /*Color of index 141*/ 0x89, 0x62, 0x20, 0xfe, /*Color of index 142*/ 0x84, 0x56, 0x43, 0xfe, /*Color of index 143*/ 0x96, 0x5a, 0x2d, 0xfe, /*Color of index 144*/ 0x8c, 0x55, 0x25, 0xfe, /*Color of index 145*/ 0x8b, 0x54, 0x28, 0xfe, /*Color of index 146*/ 0x81, 0x50, 0x1b, 0xfe, /*Color of index 147*/ 0x67, 0x4b, 0x29, 0xfe, /*Color of index 148*/ 0x80, 0x43, 0x28, 0xfe, /*Color of index 149*/ 0x4e, 0x40, 0x39, 0xfe, /*Color of index 150*/ 0x73, 0x41, 0x1c, 0xfe, /*Color of index 151*/ 0x72, 0x44, 0x0f, 0xfe, /*Color of index 152*/ 0x70, 0x3c, 0x1e, 0xfe, /*Color of index 153*/ 0x6f, 0x3d, 0x16, 0xfe, /*Color of index 154*/ 0x6a, 0x3c, 0x0c, 0xfe, /*Color of index 155*/ 0x74, 0x35, 0x16, 0xfe, /*Color of index 156*/ 0x67, 0x34, 0x13, 0xfe, /*Color of index 157*/ 0x7e, 0x36, 0x04, 0xfe, /*Color of index 158*/ 0x76, 0x30, 0x18, 0xfe, /*Color of index 159*/ 0x76, 0x2f, 0x18, 0xfe, /*Color of index 160*/ 0x68, 0x33, 0x0e, 0xfe, /*Color of index 161*/ 0x81, 0x31, 0x07, 0xfe, /*Color of index 162*/ 0x6f, 0x31, 0x00, 0xfe, /*Color of index 163*/ 0x4b, 0x2b, 0x1b, 0xfe, /*Color of index 164*/ 0x61, 0x30, 0x00, 0xfe, /*Color of index 165*/ 0x64, 0x2e, 0x04, 0xfe, /*Color of index 166*/ 0x79, 0x2c, 0x02, 0xfe, /*Color of index 167*/ 0x58, 0x2a, 0x10, 0xfe, /*Color of index 168*/ 0x6f, 0x2a, 0x05, 0xfe, /*Color of index 169*/ 0x5b, 0x20, 0x10, 0xfe, /*Color of index 170*/ 0x58, 0x25, 0x00, 0xfe, /*Color of index 171*/ 0x71, 0x21, 0x00, 0xfe, /*Color of index 172*/ 0x65, 0x21, 0x00, 0xfe, /*Color of index 173*/ 0x6e, 0x1e, 0x00, 0xfe, /*Color of index 174*/ 0x55, 0x20, 0x00, 0xfe, /*Color of index 175*/ 0x48, 0x20, 0x00, 0xfe, /*Color of index 176*/ 0x47, 0x1e, 0x00, 0xfe, /*Color of index 177*/ 0x6e, 0x19, 0x00, 0xfe, /*Color of index 178*/ 0x46, 0x1d, 0x00, 0xfe, /*Color of index 179*/ 0x60, 0x19, 0x00, 0xfe, /*Color of index 180*/ 0x59, 0x19, 0x00, 0xfe, /*Color of index 181*/ 0x4d, 0x19, 0x00, 0xfe, /*Color of index 182*/ 0x60, 0x15, 0x00, 0xfe, /*Color of index 183*/ 0x68, 0x12, 0x00, 0xfe, /*Color of index 184*/ 0x4f, 0x14, 0x00, 0xfe, /*Color of index 185*/ 0x58, 0x12, 0x00, 0xfe, /*Color of index 186*/ 0x47, 0x13, 0x00, 0xfe, /*Color of index 187*/ 0x4a, 0x11, 0x00, 0xfe, /*Color of index 188*/ 0x63, 0x0c, 0x00, 0xfe, /*Color of index 189*/ 0x54, 0x0c, 0x00, 0xfe, /*Color of index 190*/ 0x4b, 0x0c, 0x00, 0xfe, /*Color of index 191*/ 0x47, 0x0a, 0x00, 0xfe, /*Color of index 192*/ 0x57, 0x04, 0x00, 0xfe, /*Color of index 193*/ 0x45, 0x04, 0x00, 0xfe, /*Color of index 194*/ 0x52, 0x00, 0x00, 0xfe, /*Color of index 195*/ 0x4b, 0x00, 0x00, 0xfe, /*Color of index 196*/ 0x3d, 0x00, 0x00, 0xfe, /*Color of index 197*/ 0x28, 0x00, 0x00, 0xfe, /*Color of index 198*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 199*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 200*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 201*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 202*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 203*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 204*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 205*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 206*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 207*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 208*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 209*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 210*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 211*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 212*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 213*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 214*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 215*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 216*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 217*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 218*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 219*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 220*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 221*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 222*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 223*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 224*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 225*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 226*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 227*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 228*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 229*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 230*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 231*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 232*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 233*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 234*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 235*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 236*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 237*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 238*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 239*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 240*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 241*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 242*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 243*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 244*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 245*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 246*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 247*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 248*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 249*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 250*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 251*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 252*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 253*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 254*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 255*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x1c, 0x06, 0x0b, 0x1d, 0x12, 0x09, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x09, 0x12, 0x1d, 0x0b, 0x06, 0x1c, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x15, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x15, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x14, 0x1f, 0x1f, 0x1f, 0x1f, 0x6b, 0x86, 0x8f, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8d, 0x8f, 0x84, 0x69, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x1f, 0x1f, 0x1f, 0x1f, 0x73, 0xbf, 0xc2, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xc2, 0xb9, 0x71, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x1f, 0x1f, 0x1f, 0x1f, 0xa1, 0xaf, 0x55, 0x4d, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x4d, 0x57, 0xb6, 0x9a, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1f, 0x1f, 0x1f, 0x72, 0xc2, 0x61, 0x4a, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x4a, 0x64, 0xc2, 0x6f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x15, 0x1f, 0x1f, 0x1f, 0x76, 0xb9, 0x5c, 0x4d, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x4d, 0x62, 0xbe, 0x72, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x1f, 0x1f, 0x1f, 0x74, 0xb9, 0x5f, 0x4d, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x54, 0x52, 0x4e, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x4d, 0x46, 0x5d, 0xc0, 0x67, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x74, 0xb9, 0x5f, 0x4d, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x55, 0x4e, 0x4d, 0x5a, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x5b, 0x8c, 0xb5, 0x80, 0x7a, 0x7a, 0x7a, 0x7a, 0x7a, 0x7a, 0x7a, 0x7a, 0x7a, 0x7a, 0x7a, 0x7a, 0x7a, 0x7a, 0x7b, 0x72, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x74, 0xb9, 0x5f, 0x4d, 0x53, 0x53, 0x53, 0x53, 0x53, 0x54, 0x4d, 0x53, 0x93, 0xbd, 0xb7, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb4, 0xb7, 0xad, 0xa3, 0xb5, 0xb7, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xba, 0xc1, 0x95, 0x4b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x74, 0xb9, 0x5f, 0x4d, 0x53, 0x53, 0x53, 0x53, 0x53, 0x4f, 0x52, 0xa9, 0xbe, 0x41, 0x2f, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x30, 0x2f, 0x40, 0xbf, 0xb7, 0x6c, 0x1f, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x74, 0xb9, 0x5f, 0x4d, 0x53, 0x53, 0x53, 0x53, 0x52, 0x4d, 0x8e, 0xc1, 0x2e, 0x20, 0x23, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x23, 0x20, 0x28, 0xc0, 0x92, 0x1f, 0x1f, 0x1f, 0x1f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x74, 0xb9, 0x5f, 0x4d, 0x53, 0x53, 0x53, 0x53, 0x50, 0x55, 0xac, 0x44, 0x20, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x27, 0x20, 0x42, 0xbd, 0x6a, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x74, 0xb9, 0x5f, 0x4d, 0x53, 0x53, 0x53, 0x53, 0x4f, 0x58, 0xb2, 0x3b, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x22, 0x33, 0xba, 0x75, 0x1f, 0x1f, 0x1f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x74, 0xb9, 0x5f, 0x4d, 0x53, 0x53, 0x53, 0x53, 0x4f, 0x58, 0xae, 0x3c, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x35, 0xb7, 0x75, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x74, 0xb9, 0x5f, 0x4d, 0x53, 0x53, 0x53, 0x53, 0x4f, 0x58, 0xae, 0x3d, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x36, 0xb4, 0x74, 0x1f, 0x1f, 0x1f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x74, 0xb9, 0x5f, 0x4d, 0x53, 0x53, 0x53, 0x53, 0x4f, 0x58, 0xac, 0x3d, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x36, 0xb7, 0x74, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x74, 0xb9, 0x5f, 0x4d, 0x53, 0x53, 0x53, 0x53, 0x4f, 0x58, 0xae, 0x3d, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x36, 0xb4, 0x74, 0x1f, 0x1f, 0x1f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x77, 0xb9, 0x5c, 0x4d, 0x53, 0x53, 0x53, 0x53, 0x4f, 0x58, 0xac, 0x3d, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x36, 0xb7, 0x74, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x71, 0xc2, 0x63, 0x49, 0x51, 0x51, 0x53, 0x53, 0x4f, 0x58, 0xae, 0x3d, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x36, 0xb4, 0x74, 0x1f, 0x1f, 0x1f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x97, 0xbc, 0x59, 0x50, 0x52, 0x50, 0x54, 0x4f, 0x56, 0xac, 0x3d, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x36, 0xb7, 0x74, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x6e, 0xaa, 0xc5, 0xab, 0x9d, 0x5e, 0x4e, 0x4c, 0x58, 0xb8, 0x3c, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x36, 0xb4, 0x74, 0x1f, 0x1f, 0x1f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x47, 0x81, 0x8b, 0xc0, 0x65, 0x46, 0x52, 0x9b, 0xbd, 0x39, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x36, 0xb7, 0x74, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0xaf, 0x64, 0x4c, 0xab, 0xc0, 0xa7, 0x3a, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x36, 0xb4, 0x74, 0x1f, 0x1f, 0x1f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x66, 0xa6, 0x65, 0x9b, 0xb5, 0x7a, 0x9e, 0x3e, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x36, 0xb7, 0x74, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x67, 0x98, 0xc2, 0xbc, 0x6d, 0x1f, 0xae, 0x3e, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x36, 0xb4, 0x74, 0x1f, 0x1f, 0x1f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x67, 0xbf, 0xc0, 0x73, 0x1f, 0x6a, 0xae, 0x3e, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x36, 0xb7, 0x74, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x83, 0x78, 0x1f, 0x1f, 0x6a, 0xae, 0x3e, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x36, 0xb4, 0x74, 0x1f, 0x1f, 0x1f, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x68, 0xae, 0x3e, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x36, 0xb7, 0x74, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x6a, 0xae, 0x3e, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x36, 0xb4, 0x74, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x68, 0xae, 0x3e, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x36, 0xb7, 0x74, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x6c, 0xb2, 0x3c, 0x22, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x23, 0x34, 0xb7, 0x76, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x66, 0xb2, 0x43, 0x21, 0x27, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x27, 0x21, 0x37, 0xbd, 0x70, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x91, 0xbb, 0x25, 0x21, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x25, 0x25, 0x25, 0x22, 0x22, 0xa4, 0x9e, 0x1f, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x70, 0xc3, 0xa4, 0x2c, 0x25, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x27, 0x25, 0x24, 0x26, 0x26, 0x26, 0x26, 0x25, 0x25, 0x27, 0x25, 0x2a, 0x96, 0xc4, 0x79, 0x1f, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x78, 0xb2, 0xc4, 0xb3, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb0, 0xb1, 0xb6, 0xa8, 0x2f, 0x21, 0x26, 0x26, 0x25, 0x2b, 0x94, 0xab, 0xb1, 0xc4, 0xbd, 0x7e, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x48, 0x7f, 0x89, 0x88, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0xa2, 0xc1, 0x2d, 0x21, 0x26, 0x23, 0x32, 0xb8, 0x90, 0x85, 0x82, 0x68, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x48, 0x9f, 0xc3, 0x2d, 0x21, 0x24, 0x30, 0xbe, 0x75, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x47, 0xa0, 0xc3, 0x2d, 0x3f, 0x30, 0xba, 0x7b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x45, 0xa0, 0xc3, 0x29, 0x26, 0xba, 0x7c, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x47, 0xa0, 0xbc, 0x38, 0xaf, 0x7b, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x45, 0x9c, 0xc4, 0xaf, 0x7a, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x47, 0x99, 0xc6, 0x7d, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x66, 0x8a, 0x6f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1d, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x08, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x16, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x0b, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x0d, 0x09, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x09, 0x15, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x0e, 0x0f, 0x11, 0x19, 0x0c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0c, 0x0c, 0x02, 0x1a, 0x1b, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const lv_img_dsc_t ESP32Berry_Icon_ESPNow = { .header.cf = LV_IMG_CF_INDEXED_8BIT, .header.always_zero = 0, .header.reserved = 0, .header.w = 64, .header.h = 64, .data_size = 5120, .data = ESP32Berry_Icon_ESPNow_map, };
38,296
ESP32Berry_Icon_ESPNow
c
en
c
code
{"qsc_code_num_words": 6250, "qsc_code_num_chars": 38296.0, "qsc_code_mean_word_length": 3.95472, "qsc_code_frac_words_unique": 0.08896, "qsc_code_frac_chars_top_2grams": 0.45280576, "qsc_code_frac_chars_top_3grams": 0.63114456, "qsc_code_frac_chars_top_4grams": 0.77808796, "qsc_code_frac_chars_dupe_5grams": 0.74855363, "qsc_code_frac_chars_dupe_6grams": 0.69984221, "qsc_code_frac_chars_dupe_7grams": 0.67046972, "qsc_code_frac_chars_dupe_8grams": 0.60169114, "qsc_code_frac_chars_dupe_9grams": 0.59667435, "qsc_code_frac_chars_dupe_10grams": 0.59020108, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.42344051, "qsc_code_frac_chars_whitespace": 0.18790474, "qsc_code_size_file_byte": 38296.0, "qsc_code_num_lines": 350.0, "qsc_code_num_chars_line_max": 387.0, "qsc_code_num_chars_line_mean": 109.41714286, "qsc_code_frac_chars_alphabet": 0.37131833, "qsc_code_frac_chars_comments": 0.15124295, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.21301775, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00018459, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.6300763, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.0, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.00295858, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": 0.02071006}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 1, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 1, "qsc_code_frac_chars_alphabet": 1, "qsc_code_frac_chars_digital": 1, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 1, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
00jacs/sveltekit-ultrafast
src/routes/docs/components/popover/+page.svelte
<script lang="ts"> import { Button, Popover } from '$lib/components'; import { DocsPage, DocsCode, DocsPreview } from '$lib/components/page/docs'; let popoverOpen = false; </script> <DocsPage title="Popover"> <p class="mb-6">To use the Popover component, import it from '$lib/components'.</p> <DocsCode class="mb-8" language="typescript" code={`import { Popover } from '$lib/components';`} /> <p class="mb-4">Then, use it in your Svelte template:</p> <DocsCode class="mb-8" language="html" code={` <Button on:click={() => popoverOpen = true}>Open Popover</Button> <Popover open={popoverOpen} on:close={() => popoverOpen = false} withCloseIcon={true}> <p>This is a popover content.</p> </Popover> `} /> <DocsPreview class="mb-8"> <Button class="btn-primary" on:click={() => (popoverOpen = true)}> Open Popover </Button> <Popover open={popoverOpen} on:close={() => (popoverOpen = false)} withCloseIcon={true} class="custom-popover-class"> <p>This is the popover!</p> </Popover> </DocsPreview> <p class="mb-8"> The Popover component is a flexible Svelte component that accepts several props: </p> <DocsCode class="mb-8" language="typescript" code={` open: boolean; // you can use bind:open id: string | undefined = undefined; // you can also disable this by setting it to false // and display the icon in the popover container yourself withCloseIcon = true; // whether to show the "close icon" class: string = ''; // class to apply on popover `} /> <p class="mb-8"> The Popover component is based on <a href="https://daisyui.com/components/modal/" class="link link-primary" target="_blank"> DaisyUI modal </a> so for more customization options, you can refer to their documentation. </p> </DocsPage>
1,793
+page
svelte
en
svelte
code
{"qsc_code_num_words": 240, "qsc_code_num_chars": 1793.0, "qsc_code_mean_word_length": 5.0, "qsc_code_frac_words_unique": 0.38333333, "qsc_code_frac_chars_top_2grams": 0.04666667, "qsc_code_frac_chars_top_3grams": 0.04, "qsc_code_frac_chars_top_4grams": 0.04, "qsc_code_frac_chars_dupe_5grams": 0.30416667, "qsc_code_frac_chars_dupe_6grams": 0.30416667, "qsc_code_frac_chars_dupe_7grams": 0.28333333, "qsc_code_frac_chars_dupe_8grams": 0.28333333, "qsc_code_frac_chars_dupe_9grams": 0.16833333, "qsc_code_frac_chars_dupe_10grams": 0.16833333, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00537996, "qsc_code_frac_chars_whitespace": 0.17066369, "qsc_code_size_file_byte": 1793.0, "qsc_code_num_lines": 73.0, "qsc_code_num_chars_line_max": 87.0, "qsc_code_num_chars_line_mean": 24.56164384, "qsc_code_frac_chars_alphabet": 0.80161399, "qsc_code_frac_chars_comments": 0.27830452, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.28571429, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.1251932, "qsc_code_frac_chars_long_word_length": 0.01931994, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_area.c
/** * @file lv_area.c * */ /********************* * INCLUDES *********************/ #include "../lv_conf_internal.h" #include "lv_area.h" #include "lv_math.h" /********************* * DEFINES *********************/ /********************** * TYPEDEFS **********************/ /********************** * STATIC PROTOTYPES **********************/ static bool lv_point_within_circle(const lv_area_t * area, const lv_point_t * p); /********************** * STATIC VARIABLES **********************/ /********************** * MACROS **********************/ /********************** * GLOBAL FUNCTIONS **********************/ /** * Initialize an area * @param area_p pointer to an area * @param x1 left coordinate of the area * @param y1 top coordinate of the area * @param x2 right coordinate of the area * @param y2 bottom coordinate of the area */ void lv_area_set(lv_area_t * area_p, lv_coord_t x1, lv_coord_t y1, lv_coord_t x2, lv_coord_t y2) { area_p->x1 = x1; area_p->y1 = y1; area_p->x2 = x2; area_p->y2 = y2; } /** * Set the width of an area * @param area_p pointer to an area * @param w the new width of the area (w == 1 makes x1 == x2) */ void lv_area_set_width(lv_area_t * area_p, lv_coord_t w) { area_p->x2 = area_p->x1 + w - 1; } /** * Set the height of an area * @param area_p pointer to an area * @param h the new height of the area (h == 1 makes y1 == y2) */ void lv_area_set_height(lv_area_t * area_p, lv_coord_t h) { area_p->y2 = area_p->y1 + h - 1; } /** * Set the position of an area (width and height will be kept) * @param area_p pointer to an area * @param x the new x coordinate of the area * @param y the new y coordinate of the area */ void _lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y) { lv_coord_t w = lv_area_get_width(area_p); lv_coord_t h = lv_area_get_height(area_p); area_p->x1 = x; area_p->y1 = y; lv_area_set_width(area_p, w); lv_area_set_height(area_p, h); } /** * Return with area of an area (x * y) * @param area_p pointer to an area * @return size of area */ uint32_t lv_area_get_size(const lv_area_t * area_p) { uint32_t size; size = (uint32_t)(area_p->x2 - area_p->x1 + 1) * (area_p->y2 - area_p->y1 + 1); return size; } /** * Get the common parts of two areas * @param res_p pointer to an area, the result will be stored here * @param a1_p pointer to the first area * @param a2_p pointer to the second area * @return false: the two area has NO common parts, res_p is invalid */ bool _lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p) { /* Get the smaller area from 'a1_p' and 'a2_p' */ res_p->x1 = LV_MATH_MAX(a1_p->x1, a2_p->x1); res_p->y1 = LV_MATH_MAX(a1_p->y1, a2_p->y1); res_p->x2 = LV_MATH_MIN(a1_p->x2, a2_p->x2); res_p->y2 = LV_MATH_MIN(a1_p->y2, a2_p->y2); /*If x1 or y1 greater then x2 or y2 then the areas union is empty*/ bool union_ok = true; if((res_p->x1 > res_p->x2) || (res_p->y1 > res_p->y2)) { union_ok = false; } return union_ok; } /** * Join two areas into a third which involves the other two * @param res_p pointer to an area, the result will be stored here * @param a1_p pointer to the first area * @param a2_p pointer to the second area */ void _lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t * a2_p) { a_res_p->x1 = LV_MATH_MIN(a1_p->x1, a2_p->x1); a_res_p->y1 = LV_MATH_MIN(a1_p->y1, a2_p->y1); a_res_p->x2 = LV_MATH_MAX(a1_p->x2, a2_p->x2); a_res_p->y2 = LV_MATH_MAX(a1_p->y2, a2_p->y2); } /** * Check if a point is on an area * @param a_p pointer to an area * @param p_p pointer to a point * @param radius radius of area (e.g. for rounded rectangle) * @return false:the point is out of the area */ bool _lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, lv_coord_t radius) { /*First check the basic area*/ bool is_on_rect = false; if((p_p->x >= a_p->x1 && p_p->x <= a_p->x2) && ((p_p->y >= a_p->y1 && p_p->y <= a_p->y2))) { is_on_rect = true; } if(!is_on_rect) return false; /*Now handle potential rounded rectangles*/ if(radius <= 0) { /*No radius, it is within the rectangle*/ return true; } lv_coord_t w = lv_area_get_width(a_p) / 2; lv_coord_t h = lv_area_get_height(a_p) / 2; lv_coord_t max_radius = LV_MATH_MIN(w, h); if(radius > max_radius) radius = max_radius; /*Check if it's in one of the corners*/ lv_area_t corner_area; /*Top left*/ corner_area.x1 = a_p->x1; corner_area.x2 = a_p->x1 + radius; corner_area.y1 = a_p->y1; corner_area.y2 = a_p->y1 + radius; if(_lv_area_is_point_on(&corner_area, p_p, 0)) { corner_area.x2 += radius; corner_area.y2 += radius; return lv_point_within_circle(&corner_area, p_p); } /*Bottom left*/ corner_area.y1 = a_p->y2 - radius; corner_area.y2 = a_p->y2; if(_lv_area_is_point_on(&corner_area, p_p, 0)) { corner_area.x2 += radius; corner_area.y1 -= radius; return lv_point_within_circle(&corner_area, p_p); } /*Bottom right*/ corner_area.x1 = a_p->x2 - radius; corner_area.x2 = a_p->x2; if(_lv_area_is_point_on(&corner_area, p_p, 0)) { corner_area.x1 -= radius; corner_area.y1 -= radius; return lv_point_within_circle(&corner_area, p_p); } /*Top right*/ corner_area.y1 = a_p->y1; corner_area.y2 = a_p->y1 + radius; if(_lv_area_is_point_on(&corner_area, p_p, 0)) { corner_area.x1 -= radius; corner_area.y2 += radius; return lv_point_within_circle(&corner_area, p_p); } /*Not within corners*/ return true; } /** * Check if two area has common parts * @param a1_p pointer to an area. * @param a2_p pointer to an other area * @return false: a1_p and a2_p has no common parts */ bool _lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p) { if((a1_p->x1 <= a2_p->x2) && (a1_p->x2 >= a2_p->x1) && (a1_p->y1 <= a2_p->y2) && (a1_p->y2 >= a2_p->y1)) { return true; } else { return false; } } /** * Check if an area is fully on an other * @param ain_p pointer to an area which could be in 'aholder_p' * @param aholder_p pointer to an area which could involve 'ain_p' * @param radius radius of `aholder_p` (e.g. for rounded rectangle) * @return true: `ain_p` is fully inside `aholder_p` */ bool _lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, lv_coord_t radius) { bool is_in = false; if(ain_p->x1 >= aholder_p->x1 && ain_p->y1 >= aholder_p->y1 && ain_p->x2 <= aholder_p->x2 && ain_p->y2 <= aholder_p->y2) { is_in = true; } if(radius == 0) return is_in; /*Check if the corner points are inside the radius or not*/ lv_point_t p; p.x = ain_p->x1; p.y = ain_p->y1; if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false; p.x = ain_p->x2; p.y = ain_p->y1; if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false; p.x = ain_p->x1; p.y = ain_p->y2; if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false; p.x = ain_p->x2; p.y = ain_p->y2; if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false; return true; } /** * Align an area to an other * @param base an are where the other will be aligned * @param to_align the area to align * @param align `LV_ALIGN_...` * @param res x/y coordinates where `to_align` align area should be placed */ void _lv_area_align(const lv_area_t * base, const lv_area_t * to_align, lv_align_t align, lv_point_t * res) { switch(align) { case LV_ALIGN_CENTER: res->x = lv_area_get_width(base) / 2 - lv_area_get_width(to_align) / 2; res->y = lv_area_get_height(base) / 2 - lv_area_get_height(to_align) / 2; break; case LV_ALIGN_IN_TOP_LEFT: res->x = 0; res->y = 0; break; case LV_ALIGN_IN_TOP_MID: res->x = lv_area_get_width(base) / 2 - lv_area_get_width(to_align) / 2; res->y = 0; break; case LV_ALIGN_IN_TOP_RIGHT: res->x = lv_area_get_width(base) - lv_area_get_width(to_align); res->y = 0; break; case LV_ALIGN_IN_BOTTOM_LEFT: res->x = 0; res->y = lv_area_get_height(base) - lv_area_get_height(to_align); break; case LV_ALIGN_IN_BOTTOM_MID: res->x = lv_area_get_width(base) / 2 - lv_area_get_width(to_align) / 2; res->y = lv_area_get_height(base) - lv_area_get_height(to_align); break; case LV_ALIGN_IN_BOTTOM_RIGHT: res->x = lv_area_get_width(base) - lv_area_get_width(to_align); res->y = lv_area_get_height(base) - lv_area_get_height(to_align); break; case LV_ALIGN_IN_LEFT_MID: res->x = 0; res->y = lv_area_get_height(base) / 2 - lv_area_get_height(to_align) / 2; break; case LV_ALIGN_IN_RIGHT_MID: res->x = lv_area_get_width(base) - lv_area_get_width(to_align); res->y = lv_area_get_height(base) / 2 - lv_area_get_height(to_align) / 2; break; case LV_ALIGN_OUT_TOP_LEFT: res->x = 0; res->y = -lv_area_get_height(to_align); break; case LV_ALIGN_OUT_TOP_MID: res->x = lv_area_get_width(base) / 2 - lv_area_get_width(to_align) / 2; res->y = -lv_area_get_height(to_align); break; case LV_ALIGN_OUT_TOP_RIGHT: res->x = lv_area_get_width(base) - lv_area_get_width(to_align); res->y = -lv_area_get_height(to_align); break; case LV_ALIGN_OUT_BOTTOM_LEFT: res->x = 0; res->y = lv_area_get_height(base); break; case LV_ALIGN_OUT_BOTTOM_MID: res->x = lv_area_get_width(base) / 2 - lv_area_get_width(to_align) / 2; res->y = lv_area_get_height(base); break; case LV_ALIGN_OUT_BOTTOM_RIGHT: res->x = lv_area_get_width(base) - lv_area_get_width(to_align); res->y = lv_area_get_height(base); break; case LV_ALIGN_OUT_LEFT_TOP: res->x = -lv_area_get_width(to_align); res->y = 0; break; case LV_ALIGN_OUT_LEFT_MID: res->x = -lv_area_get_width(to_align); res->y = lv_area_get_height(base) / 2 - lv_area_get_height(to_align) / 2; break; case LV_ALIGN_OUT_LEFT_BOTTOM: res->x = -lv_area_get_width(to_align); res->y = lv_area_get_height(base) - lv_area_get_height(to_align); break; case LV_ALIGN_OUT_RIGHT_TOP: res->x = lv_area_get_width(base); res->y = 0; break; case LV_ALIGN_OUT_RIGHT_MID: res->x = lv_area_get_width(base); res->y = lv_area_get_height(base) / 2 - lv_area_get_height(to_align) / 2; break; case LV_ALIGN_OUT_RIGHT_BOTTOM: res->x = lv_area_get_width(base); res->y = lv_area_get_height(base) - lv_area_get_height(to_align); break; } res->x += base->x1; res->y += base->y1; } /********************** * STATIC FUNCTIONS **********************/ static bool lv_point_within_circle(const lv_area_t * area, const lv_point_t * p) { lv_coord_t r = (area->x2 - area->x1) / 2; /* Circle center */ lv_coord_t cx = area->x1 + r; lv_coord_t cy = area->y1 + r; /*Simplify the code by moving everything to (0, 0) */ lv_coord_t px = p->x - cx; lv_coord_t py = p->y - cy; int32_t r_sqrd = r * r; int32_t dist = (px * px) + (py * py); if(dist <= r_sqrd) return true; else return false; }
12,066
lv_area
c
en
c
code
{"qsc_code_num_words": 2024, "qsc_code_num_chars": 12066.0, "qsc_code_mean_word_length": 3.19713439, "qsc_code_frac_words_unique": 0.07806324, "qsc_code_frac_chars_top_2grams": 0.09272137, "qsc_code_frac_chars_top_3grams": 0.07927677, "qsc_code_frac_chars_top_4grams": 0.06057796, "qsc_code_frac_chars_dupe_5grams": 0.65430382, "qsc_code_frac_chars_dupe_6grams": 0.56992737, "qsc_code_frac_chars_dupe_7grams": 0.52573018, "qsc_code_frac_chars_dupe_8grams": 0.50826766, "qsc_code_frac_chars_dupe_9grams": 0.46252511, "qsc_code_frac_chars_dupe_10grams": 0.44799876, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02475913, "qsc_code_frac_chars_whitespace": 0.26023537, "qsc_code_size_file_byte": 12066.0, "qsc_code_num_lines": 408.0, "qsc_code_num_chars_line_max": 111.0, "qsc_code_num_chars_line_mean": 29.57352941, "qsc_code_frac_chars_alphabet": 0.70020166, "qsc_code_frac_chars_comments": 0.26852312, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.43096234, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00441876, "qsc_code_frac_chars_long_word_length": 0.00237933, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.07112971, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.12552301, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": 0.0125523}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_printf.c
/////////////////////////////////////////////////////////////////////////////// // \author (c) Marco Paland (info@paland.com) // 2014-2019, PALANDesign Hannover, Germany // // \license The MIT License (MIT) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // \brief Tiny printf, sprintf and (v)snprintf implementation, optimized for speed on // embedded systems with a very limited resources. These routines are thread // safe and reentrant! // Use this instead of the bloated standard/newlib printf cause these use // malloc for printf (and may not be thread safe). // /////////////////////////////////////////////////////////////////////////////// #include "lv_printf.h" #if LV_SPRINTF_CUSTOM == 0 #include <stdbool.h> #include <stdint.h> #define PRINTF_DISABLE_SUPPORT_FLOAT LV_SPRINTF_DISABLE_FLOAT // 'ntoa' conversion buffer size, this must be big enough to hold one converted // numeric number including padded zeros (dynamically created on stack) // default: 32 byte #ifndef PRINTF_NTOA_BUFFER_SIZE #define PRINTF_NTOA_BUFFER_SIZE 32U #endif // 'ftoa' conversion buffer size, this must be big enough to hold one converted // float number including padded zeros (dynamically created on stack) // default: 32 byte #ifndef PRINTF_FTOA_BUFFER_SIZE #define PRINTF_FTOA_BUFFER_SIZE 32U #endif // support for the floating point type (%f) // default: activated #if !PRINTF_DISABLE_SUPPORT_FLOAT #define PRINTF_SUPPORT_FLOAT #endif // support for exponential floating point notation (%e/%g) // default: activated #ifndef PRINTF_DISABLE_SUPPORT_EXPONENTIAL #define PRINTF_SUPPORT_EXPONENTIAL #endif // define the default floating point precision // default: 6 digits #ifndef PRINTF_DEFAULT_FLOAT_PRECISION #define PRINTF_DEFAULT_FLOAT_PRECISION 6U #endif // define the largest float suitable to print with %f // default: 1e9 #ifndef PRINTF_MAX_FLOAT #define PRINTF_MAX_FLOAT 1e9 #endif // support for the long long types (%llu or %p) // default: activated #ifndef PRINTF_DISABLE_SUPPORT_LONG_LONG #define PRINTF_SUPPORT_LONG_LONG #endif // support for the ptrdiff_t type (%t) // ptrdiff_t is normally defined in <stddef.h> as long or long long type // default: activated #ifndef PRINTF_DISABLE_SUPPORT_PTRDIFF_T #define PRINTF_SUPPORT_PTRDIFF_T #endif /////////////////////////////////////////////////////////////////////////////// // internal flag definitions #define FLAGS_ZEROPAD (1U << 0U) #define FLAGS_LEFT (1U << 1U) #define FLAGS_PLUS (1U << 2U) #define FLAGS_SPACE (1U << 3U) #define FLAGS_HASH (1U << 4U) #define FLAGS_UPPERCASE (1U << 5U) #define FLAGS_CHAR (1U << 6U) #define FLAGS_SHORT (1U << 7U) #define FLAGS_LONG (1U << 8U) #define FLAGS_LONG_LONG (1U << 9U) #define FLAGS_PRECISION (1U << 10U) #define FLAGS_ADAPT_EXP (1U << 11U) // import float.h for DBL_MAX #if defined(PRINTF_SUPPORT_FLOAT) #include <float.h> #endif // output function type typedef void (*out_fct_type)(char character, void * buffer, size_t idx, size_t maxlen); // wrapper (used as buffer) for output function type typedef struct { void (*fct)(char character, void * arg); void * arg; } out_fct_wrap_type; // internal buffer output static inline void _out_buffer(char character, void * buffer, size_t idx, size_t maxlen) { if(idx < maxlen) { ((char *)buffer)[idx] = character; } } // internal null output static inline void _out_null(char character, void * buffer, size_t idx, size_t maxlen) { (void)character; (void)buffer; (void)idx; (void)maxlen; } // internal secure strlen // \return The length of the string (excluding the terminating 0) limited by 'maxsize' static inline unsigned int _strnlen_s(const char * str, size_t maxsize) { const char * s; for(s = str; *s && maxsize--; ++s); return (unsigned int)(s - str); } // internal test if char is a digit (0-9) // \return true if char is a digit static inline bool _is_digit(char ch) { return (ch >= '0') && (ch <= '9'); } // internal ASCII string to unsigned int conversion static unsigned int _atoi(const char ** str) { unsigned int i = 0U; while(_is_digit(**str)) { i = i * 10U + (unsigned int)(*((*str)++) - '0'); } return i; } // output the specified string in reverse, taking care of any zero-padding static size_t _out_rev(out_fct_type out, char * buffer, size_t idx, size_t maxlen, const char * buf, size_t len, unsigned int width, unsigned int flags) { const size_t start_idx = idx; // pad spaces up to given width if(!(flags & FLAGS_LEFT) && !(flags & FLAGS_ZEROPAD)) { size_t i; for(i = len; i < width; i++) { out(' ', buffer, idx++, maxlen); } } // reverse string while(len) { out(buf[--len], buffer, idx++, maxlen); } // append pad spaces up to given width if(flags & FLAGS_LEFT) { while(idx - start_idx < width) { out(' ', buffer, idx++, maxlen); } } return idx; } // internal itoa format static size_t _ntoa_format(out_fct_type out, char * buffer, size_t idx, size_t maxlen, char * buf, size_t len, bool negative, unsigned int base, unsigned int prec, unsigned int width, unsigned int flags) { // pad leading zeros if(!(flags & FLAGS_LEFT)) { if(width && (flags & FLAGS_ZEROPAD) && (negative || (flags & (FLAGS_PLUS | FLAGS_SPACE)))) { width--; } while((len < prec) && (len < PRINTF_NTOA_BUFFER_SIZE)) { buf[len++] = '0'; } while((flags & FLAGS_ZEROPAD) && (len < width) && (len < PRINTF_NTOA_BUFFER_SIZE)) { buf[len++] = '0'; } } // handle hash if(flags & FLAGS_HASH) { if(!(flags & FLAGS_PRECISION) && len && ((len == prec) || (len == width))) { len--; if(len && (base == 16U)) { len--; } } if((base == 16U) && !(flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) { buf[len++] = 'x'; } else if((base == 16U) && (flags & FLAGS_UPPERCASE) && (len < PRINTF_NTOA_BUFFER_SIZE)) { buf[len++] = 'X'; } else if((base == 2U) && (len < PRINTF_NTOA_BUFFER_SIZE)) { buf[len++] = 'b'; } if(len < PRINTF_NTOA_BUFFER_SIZE) { buf[len++] = '0'; } } if(len < PRINTF_NTOA_BUFFER_SIZE) { if(negative) { buf[len++] = '-'; } else if(flags & FLAGS_PLUS) { buf[len++] = '+'; // ignore the space if the '+' exists } else if(flags & FLAGS_SPACE) { buf[len++] = ' '; } } return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags); } // internal itoa for 'long' type static size_t _ntoa_long(out_fct_type out, char * buffer, size_t idx, size_t maxlen, unsigned long value, bool negative, unsigned long base, unsigned int prec, unsigned int width, unsigned int flags) { char buf[PRINTF_NTOA_BUFFER_SIZE]; size_t len = 0U; // no hash for 0 values if(!value) { flags &= ~FLAGS_HASH; } // write if precision != 0 and value is != 0 if(!(flags & FLAGS_PRECISION) || value) { do { const char digit = (char)(value % base); buf[len++] = digit < 10 ? '0' + digit : (flags & FLAGS_UPPERCASE ? 'A' : 'a') + digit - 10; value /= base; } while(value && (len < PRINTF_NTOA_BUFFER_SIZE)); } return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, (unsigned int)base, prec, width, flags); } // internal itoa for 'long long' type #if defined(PRINTF_SUPPORT_LONG_LONG) static size_t _ntoa_long_long(out_fct_type out, char * buffer, size_t idx, size_t maxlen, unsigned long long value, bool negative, unsigned long long base, unsigned int prec, unsigned int width, unsigned int flags) { char buf[PRINTF_NTOA_BUFFER_SIZE]; size_t len = 0U; // no hash for 0 values if(!value) { flags &= ~FLAGS_HASH; } // write if precision != 0 and value is != 0 if(!(flags & FLAGS_PRECISION) || value) { do { const char digit = (char)(value % base); buf[len++] = digit < 10 ? '0' + digit : (flags & FLAGS_UPPERCASE ? 'A' : 'a') + digit - 10; value /= base; } while(value && (len < PRINTF_NTOA_BUFFER_SIZE)); } return _ntoa_format(out, buffer, idx, maxlen, buf, len, negative, (unsigned int)base, prec, width, flags); } #endif // PRINTF_SUPPORT_LONG_LONG #if defined(PRINTF_SUPPORT_FLOAT) #if defined(PRINTF_SUPPORT_EXPONENTIAL) // forward declaration so that _ftoa can switch to exp notation for values > PRINTF_MAX_FLOAT static size_t _etoa(out_fct_type out, char * buffer, size_t idx, size_t maxlen, double value, unsigned int prec, unsigned int width, unsigned int flags); #endif // internal ftoa for fixed decimal floating point static size_t _ftoa(out_fct_type out, char * buffer, size_t idx, size_t maxlen, double value, unsigned int prec, unsigned int width, unsigned int flags) { char buf[PRINTF_FTOA_BUFFER_SIZE]; size_t len = 0U; double diff = 0.0; // powers of 10 static const double pow10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 }; // test for special values if(value != value) return _out_rev(out, buffer, idx, maxlen, "nan", 3, width, flags); if(value < -DBL_MAX) return _out_rev(out, buffer, idx, maxlen, "fni-", 4, width, flags); if(value > DBL_MAX) return _out_rev(out, buffer, idx, maxlen, (flags & FLAGS_PLUS) ? "fni+" : "fni", (flags & FLAGS_PLUS) ? 4U : 3U, width, flags); // test for very large values // standard printf behavior is to print EVERY whole number digit -- which could be 100s of characters overflowing your buffers == bad if((value > PRINTF_MAX_FLOAT) || (value < -PRINTF_MAX_FLOAT)) { #if defined(PRINTF_SUPPORT_EXPONENTIAL) return _etoa(out, buffer, idx, maxlen, value, prec, width, flags); #else return 0U; #endif } // test for negative bool negative = false; if(value < 0) { negative = true; value = 0 - value; } // set default precision, if not set explicitly if(!(flags & FLAGS_PRECISION)) { prec = PRINTF_DEFAULT_FLOAT_PRECISION; } // limit precision to 9, cause a prec >= 10 can lead to overflow errors while((len < PRINTF_FTOA_BUFFER_SIZE) && (prec > 9U)) { buf[len++] = '0'; prec--; } int whole = (int)value; double tmp = (value - whole) * pow10[prec]; unsigned long frac = (unsigned long)tmp; diff = tmp - frac; if(diff > 0.5) { ++frac; // handle rollover, e.g. case 0.99 with prec 1 is 1.0 if(frac >= pow10[prec]) { frac = 0; ++whole; } } else if(diff < 0.5) { } else if((frac == 0U) || (frac & 1U)) { // if halfway, round up if odd OR if last digit is 0 ++frac; } if(prec == 0U) { diff = value - (double)whole; if((!(diff < 0.5) || (diff > 0.5)) && (whole & 1)) { // exactly 0.5 and ODD, then round up // 1.5 -> 2, but 2.5 -> 2 ++whole; } } else { unsigned int count = prec; // now do fractional part, as an unsigned number while(len < PRINTF_FTOA_BUFFER_SIZE) { --count; buf[len++] = (char)(48U + (frac % 10U)); if(!(frac /= 10U)) { break; } } // add extra 0s while((len < PRINTF_FTOA_BUFFER_SIZE) && (count-- > 0U)) { buf[len++] = '0'; } if(len < PRINTF_FTOA_BUFFER_SIZE) { // add decimal buf[len++] = '.'; } } // do whole part, number is reversed while(len < PRINTF_FTOA_BUFFER_SIZE) { buf[len++] = (char)(48 + (whole % 10)); if(!(whole /= 10)) { break; } } // pad leading zeros if(!(flags & FLAGS_LEFT) && (flags & FLAGS_ZEROPAD)) { if(width && (negative || (flags & (FLAGS_PLUS | FLAGS_SPACE)))) { width--; } while((len < width) && (len < PRINTF_FTOA_BUFFER_SIZE)) { buf[len++] = '0'; } } if(len < PRINTF_FTOA_BUFFER_SIZE) { if(negative) { buf[len++] = '-'; } else if(flags & FLAGS_PLUS) { buf[len++] = '+'; // ignore the space if the '+' exists } else if(flags & FLAGS_SPACE) { buf[len++] = ' '; } } return _out_rev(out, buffer, idx, maxlen, buf, len, width, flags); } #if defined(PRINTF_SUPPORT_EXPONENTIAL) // internal ftoa variant for exponential floating-point type, contributed by Martijn Jasperse <m.jasperse@gmail.com> static size_t _etoa(out_fct_type out, char * buffer, size_t idx, size_t maxlen, double value, unsigned int prec, unsigned int width, unsigned int flags) { // check for NaN and special values if((value != value) || (value > DBL_MAX) || (value < -DBL_MAX)) { return _ftoa(out, buffer, idx, maxlen, value, prec, width, flags); } // determine the sign const bool negative = value < 0; if(negative) { value = -value; } // default precision if(!(flags & FLAGS_PRECISION)) { prec = PRINTF_DEFAULT_FLOAT_PRECISION; } // determine the decimal exponent // based on the algorithm by David Gay (https://www.ampl.com/netlib/fp/dtoa.c) union { uint64_t U; double F; } conv; conv.F = value; int exp2 = (int)((conv.U >> 52U) & 0x07FFU) - 1023; // effectively log2 conv.U = (conv.U & ((1ULL << 52U) - 1U)) | (1023ULL << 52U); // drop the exponent so conv.F is now in [1,2) // now approximate log10 from the log2 integer part and an expansion of ln around 1.5 int expval = (int)(0.1760912590558 + exp2 * 0.301029995663981 + (conv.F - 1.5) * 0.289529654602168); // now we want to compute 10^expval but we want to be sure it won't overflow exp2 = (int)(expval * 3.321928094887362 + 0.5); const double z = expval * 2.302585092994046 - exp2 * 0.6931471805599453; const double z2 = z * z; conv.U = (uint64_t)(exp2 + 1023) << 52U; // compute exp(z) using continued fractions, see https://en.wikipedia.org/wiki/Exponential_function#Continued_fractions_for_ex conv.F *= 1 + 2 * z / (2 - z + (z2 / (6 + (z2 / (10 + z2 / 14))))); // correct for rounding errors if(value < conv.F) { expval--; conv.F /= 10; } // the exponent format is "%+03d" and largest value is "307", so set aside 4-5 characters unsigned int minwidth = ((expval < 100) && (expval > -100)) ? 4U : 5U; // in "%g" mode, "prec" is the number of *significant figures* not decimals if(flags & FLAGS_ADAPT_EXP) { // do we want to fall-back to "%f" mode? if((value >= 1e-4) && (value < 1e6)) { if((int)prec > expval) { prec = (unsigned)((int)prec - expval - 1); } else { prec = 0; } flags |= FLAGS_PRECISION; // make sure _ftoa respects precision // no characters in exponent minwidth = 0U; expval = 0; } else { // we use one sigfig for the whole part if((prec > 0) && (flags & FLAGS_PRECISION)) { --prec; } } } // will everything fit? unsigned int fwidth = width; if(width > minwidth) { // we didn't fall-back so subtract the characters required for the exponent fwidth -= minwidth; } else { // not enough characters, so go back to default sizing fwidth = 0U; } if((flags & FLAGS_LEFT) && minwidth) { // if we're padding on the right, DON'T pad the floating part fwidth = 0U; } // rescale the float value if(expval) { value /= conv.F; } // output the floating part const size_t start_idx = idx; idx = _ftoa(out, buffer, idx, maxlen, negative ? -value : value, prec, fwidth, flags & ~FLAGS_ADAPT_EXP); // output the exponent part if(minwidth) { // output the exponential symbol out((flags & FLAGS_UPPERCASE) ? 'E' : 'e', buffer, idx++, maxlen); // output the exponent value idx = _ntoa_long(out, buffer, idx, maxlen, (expval < 0) ? -expval : expval, expval < 0, 10, 0, minwidth - 1, FLAGS_ZEROPAD | FLAGS_PLUS); // might need to right-pad spaces if(flags & FLAGS_LEFT) { while(idx - start_idx < width) out(' ', buffer, idx++, maxlen); } } return idx; } #endif // PRINTF_SUPPORT_EXPONENTIAL #endif // PRINTF_SUPPORT_FLOAT // internal vsnprintf static int _vsnprintf(out_fct_type out, char * buffer, const size_t maxlen, const char * format, va_list va) { unsigned int flags, width, precision, n; size_t idx = 0U; if(!buffer) { // use null output function out = _out_null; } while(*format) { // format specifier? %[flags][width][.precision][length] if(*format != '%') { // no out(*format, buffer, idx++, maxlen); format++; continue; } else { // yes, evaluate it format++; } // evaluate flags flags = 0U; do { switch(*format) { case '0': flags |= FLAGS_ZEROPAD; format++; n = 1U; break; case '-': flags |= FLAGS_LEFT; format++; n = 1U; break; case '+': flags |= FLAGS_PLUS; format++; n = 1U; break; case ' ': flags |= FLAGS_SPACE; format++; n = 1U; break; case '#': flags |= FLAGS_HASH; format++; n = 1U; break; default : n = 0U; break; } } while(n); // evaluate width field width = 0U; if(_is_digit(*format)) { width = _atoi(&format); } else if(*format == '*') { const int w = va_arg(va, int); if(w < 0) { flags |= FLAGS_LEFT; // reverse padding width = (unsigned int) - w; } else { width = (unsigned int)w; } format++; } // evaluate precision field precision = 0U; if(*format == '.') { flags |= FLAGS_PRECISION; format++; if(_is_digit(*format)) { precision = _atoi(&format); } else if(*format == '*') { const int prec = (int)va_arg(va, int); precision = prec > 0 ? (unsigned int)prec : 0U; format++; } } // evaluate length field switch(*format) { case 'l' : flags |= FLAGS_LONG; format++; if(*format == 'l') { flags |= FLAGS_LONG_LONG; format++; } break; case 'h' : flags |= FLAGS_SHORT; format++; if(*format == 'h') { flags |= FLAGS_CHAR; format++; } break; #if defined(PRINTF_SUPPORT_PTRDIFF_T) case 't' : flags |= (sizeof(ptrdiff_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG); format++; break; #endif case 'j' : flags |= (sizeof(intmax_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG); format++; break; case 'z' : flags |= (sizeof(size_t) == sizeof(long) ? FLAGS_LONG : FLAGS_LONG_LONG); format++; break; default : break; } // evaluate specifier switch(*format) { case 'd' : case 'i' : case 'u' : case 'x' : case 'X' : case 'o' : case 'b' : { // set the base unsigned int base; if(*format == 'x' || *format == 'X') { base = 16U; } else if(*format == 'o') { base = 8U; } else if(*format == 'b') { base = 2U; } else { base = 10U; flags &= ~FLAGS_HASH; // no hash for dec format } // uppercase if(*format == 'X') { flags |= FLAGS_UPPERCASE; } // no plus or space flag for u, x, X, o, b if((*format != 'i') && (*format != 'd')) { flags &= ~(FLAGS_PLUS | FLAGS_SPACE); } // ignore '0' flag when precision is given if(flags & FLAGS_PRECISION) { flags &= ~FLAGS_ZEROPAD; } // convert the integer if((*format == 'i') || (*format == 'd')) { // signed if(flags & FLAGS_LONG_LONG) { #if defined(PRINTF_SUPPORT_LONG_LONG) const long long value = va_arg(va, long long); idx = _ntoa_long_long(out, buffer, idx, maxlen, (unsigned long long)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags); #endif } else if(flags & FLAGS_LONG) { const long value = va_arg(va, long); idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags); } else { const int value = (flags & FLAGS_CHAR) ? (char)va_arg(va, int) : (flags & FLAGS_SHORT) ? (short int)va_arg(va, int) : va_arg(va, int); idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned int)(value > 0 ? value : 0 - value), value < 0, base, precision, width, flags); } } else { // unsigned if(flags & FLAGS_LONG_LONG) { #if defined(PRINTF_SUPPORT_LONG_LONG) idx = _ntoa_long_long(out, buffer, idx, maxlen, va_arg(va, unsigned long long), false, base, precision, width, flags); #endif } else if(flags & FLAGS_LONG) { idx = _ntoa_long(out, buffer, idx, maxlen, va_arg(va, unsigned long), false, base, precision, width, flags); } else { const unsigned int value = (flags & FLAGS_CHAR) ? (unsigned char)va_arg(va, unsigned int) : (flags & FLAGS_SHORT) ? (unsigned short int)va_arg(va, unsigned int) : va_arg(va, unsigned int); idx = _ntoa_long(out, buffer, idx, maxlen, value, false, base, precision, width, flags); } } format++; break; } #if defined(PRINTF_SUPPORT_FLOAT) case 'f' : case 'F' : if(*format == 'F') flags |= FLAGS_UPPERCASE; idx = _ftoa(out, buffer, idx, maxlen, va_arg(va, double), precision, width, flags); format++; break; #if defined(PRINTF_SUPPORT_EXPONENTIAL) case 'e': case 'E': case 'g': case 'G': if((*format == 'g') || (*format == 'G')) flags |= FLAGS_ADAPT_EXP; if((*format == 'E') || (*format == 'G')) flags |= FLAGS_UPPERCASE; idx = _etoa(out, buffer, idx, maxlen, va_arg(va, double), precision, width, flags); format++; break; #endif // PRINTF_SUPPORT_EXPONENTIAL #endif // PRINTF_SUPPORT_FLOAT case 'c' : { unsigned int l = 1U; // pre padding if(!(flags & FLAGS_LEFT)) { while(l++ < width) { out(' ', buffer, idx++, maxlen); } } // char output out((char)va_arg(va, int), buffer, idx++, maxlen); // post padding if(flags & FLAGS_LEFT) { while(l++ < width) { out(' ', buffer, idx++, maxlen); } } format++; break; } case 's' : { const char * p = va_arg(va, char *); unsigned int l = _strnlen_s(p, precision ? precision : (size_t) -1); // pre padding if(flags & FLAGS_PRECISION) { l = (l < precision ? l : precision); } if(!(flags & FLAGS_LEFT)) { while(l++ < width) { out(' ', buffer, idx++, maxlen); } } // string output while((*p != 0) && (!(flags & FLAGS_PRECISION) || precision--)) { out(*(p++), buffer, idx++, maxlen); } // post padding if(flags & FLAGS_LEFT) { while(l++ < width) { out(' ', buffer, idx++, maxlen); } } format++; break; } case 'p' : { width = sizeof(void *) * 2U; flags |= FLAGS_ZEROPAD | FLAGS_UPPERCASE; #if defined(PRINTF_SUPPORT_LONG_LONG) const bool is_ll = sizeof(uintptr_t) == sizeof(long long); if(is_ll) { idx = _ntoa_long_long(out, buffer, idx, maxlen, (uintptr_t)va_arg(va, void *), false, 16U, precision, width, flags); } else { #endif idx = _ntoa_long(out, buffer, idx, maxlen, (unsigned long)((uintptr_t)va_arg(va, void *)), false, 16U, precision, width, flags); #if defined(PRINTF_SUPPORT_LONG_LONG) } #endif format++; break; } case '%' : out('%', buffer, idx++, maxlen); format++; break; default : out(*format, buffer, idx++, maxlen); format++; break; } } // termination out((char)0, buffer, idx < maxlen ? idx : maxlen - 1U, maxlen); // return written chars without terminating \0 return (int)idx; } /////////////////////////////////////////////////////////////////////////////// int lv_snprintf(char * buffer, size_t count, const char * format, ...) { va_list va; va_start(va, format); const int ret = _vsnprintf(_out_buffer, buffer, count, format, va); va_end(va); return ret; } int lv_vsnprintf(char * buffer, size_t count, const char * format, va_list va) { return _vsnprintf(_out_buffer, buffer, count, format, va); } #endif /*LV_SPRINTF_CUSTOM*/
30,074
lv_printf
c
en
c
code
{"qsc_code_num_words": 3334, "qsc_code_num_chars": 30074.0, "qsc_code_mean_word_length": 4.40311938, "qsc_code_frac_words_unique": 0.14697061, "qsc_code_frac_chars_top_2grams": 0.04768392, "qsc_code_frac_chars_top_3grams": 0.03678474, "qsc_code_frac_chars_top_4grams": 0.03555858, "qsc_code_frac_chars_dupe_5grams": 0.44311989, "qsc_code_frac_chars_dupe_6grams": 0.40320163, "qsc_code_frac_chars_dupe_7grams": 0.34230245, "qsc_code_frac_chars_dupe_8grams": 0.30211172, "qsc_code_frac_chars_dupe_9grams": 0.27452316, "qsc_code_frac_chars_dupe_10grams": 0.2472752, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02338006, "qsc_code_frac_chars_whitespace": 0.37138392, "qsc_code_size_file_byte": 30074.0, "qsc_code_num_lines": 894.0, "qsc_code_num_chars_line_max": 213.0, "qsc_code_num_chars_line_mean": 33.63982103, "qsc_code_frac_chars_alphabet": 0.75313409, "qsc_code_frac_chars_comments": 0.2202567, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.32492114, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00456309, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.08201893, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.09936909, "qsc_codec_frac_lines_print": 0.00946372, "qsc_codec_frac_lines_preprocessor_directives": 0.10883281}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_txt_ap.c
/** * @file lv_txt_ap.c * */ /********************* * INCLUDES *********************/ #include <stddef.h> #include "lv_bidi.h" #include "lv_txt.h" #include "lv_txt_ap.h" #include "../lv_draw/lv_draw.h" /********************* * DEFINES *********************/ /********************** * TYPEDEFS **********************/ /********************** * STATIC PROTOTYPES **********************/ #if LV_USE_ARABIC_PERSIAN_CHARS == 1 static uint32_t lv_ap_get_char_index(uint16_t c); /********************** * STATIC VARIABLES **********************/ const ap_chars_map_t ap_chars_map[] = { /* {Key Offset, End, Beginning, Middle, Isolated, {conjunction}} */ {1, 0xFE84, -1, 0, -1, {1, 0}}, // أ {2, 0xFE86, -1, 0, -1, {1, 0}}, // ؤ {3, 0xFE88, -1, 0, -1, {1, 0}}, // ﺇ {4, 0xFE8A, 1, 2, -1, {1, 0}}, // ئ {5, 0xFE8E, -1, 0, -1, {1, 0}}, // آ {6, 0xFE90, 1, 2, -1, {1, 1}}, // ب {92, 0xFB57, 1, 2, -1, {1, 1}}, // پ {8, 0xFE96, 1, 2, -1, {1, 1}}, // ت {9, 0xFE9A, 1, 2, -1, {1, 1}}, // ث {10, 0xFE9E, 1, 2, -1, {1, 1}}, // ج {100, 0xFB7B, 1, 2, -1, {1, 1}}, // چ {11, 0xFEA2, 1, 2, -1, {1, 1}}, // ح {12, 0xFEA6, 1, 2, -1, {1, 1}}, // خ {13, 0xFEAA, -1, 0, -1, {1, 0}}, // د {14, 0xFEAC, -1, 0, -1, {1, 0}}, // ذ {15, 0xFEAE, -1, 0, -1, {1, 0}}, // ر {16, 0xFEB0, -1, 0, -1, {1, 0}}, // ز {118, 0xFB8B, -1, 0, -1, {1, 0}}, // ژ {17, 0xFEB2, 1, 2, -1, {1, 1}}, // س {18, 0xFEB6, 1, 2, -1, {1, 1}}, // ش {19, 0xFEBA, 1, 2, -1, {1, 1}}, // ص {20, 0xFEBE, 1, 2, -1, {1, 1}}, // ض {21, 0xFEC2, 1, 2, -1, {1, 1}}, // ط {22, 0xFEC6, 1, 2, -1, {1, 1}}, // ظ {23, 0xFECA, 1, 2, -1, {1, 1}}, // ع {24, 0xFECE, 1, 2, -1, {1, 1}}, // غ {31, 0xFED2, 1, 2, -1, {1, 1}}, // ف {32, 0xFED6, 1, 2, -1, {1, 1}}, // ق {135, 0xFB8F, 1, 2, -1, {1, 1}}, // ک {33, 0xFEDA, 1, 2, -1, {1, 1}}, // ﻙ {141, 0xFB93, 1, 2, -1, {1, 1}}, // گ {34, 0xFEDE, 1, 2, -1, {1, 1}}, // ل {35, 0xFEE2, 1, 2, -1, {1, 1}}, // م {36, 0xFEE6, 1, 2, -1, {1, 1}}, // ن {38, 0xFEEE, -1, 0, -1, {1, 0}}, // و {37, 0xFEEA, 1, 2, -1, {1, 1}}, // ه {39, 0xFBFD, 1, 2, -1, {1, 1}}, // ي {40, 0xFEF2, 1, 2, -1, {1, 1}}, // ي {170, 0xFBFD, 1, 2, -1, {1, 1}}, // ی {7, 0xFE94, 1, 2, -1, {1, 0}}, // ة {206, 0x06F0, 1, 2, -1, {0, 0}}, // ۰ {207, 0x06F1, 0, 0, 0, {0, 0}}, // ۱ {208, 0x06F2, 0, 0, 0, {0, 0}}, // ۲ {209, 0x06F3, 0, 0, 0, {0, 0}}, // ۳ {210, 0x06F4, 0, 0, 0, {0, 0}}, // ۴ {211, 0x06F5, 0, 0, 0, {0, 0}}, // ۵ {212, 0x06F6, 0, 0, 0, {0, 0}}, // ۶ {213, 0x06F7, 0, 0, 0, {0, 0}}, // ۷ {214, 0x06F8, 0, 0, 0, {0, 0}}, // ۸ {215, 0x06F9, 0, 0, 0, {0, 0}}, // ۹ LV_AP_END_CHARS_LIST }; /********************** * MACROS **********************/ /********************** * GLOBAL FUNCTIONS **********************/ uint32_t _lv_txt_ap_calc_bytes_cnt(const char * txt) { uint32_t txt_length = 0; uint32_t chars_cnt = 0; uint32_t current_ap_idx = 0; uint32_t i, j; uint32_t ch_enc; txt_length = _lv_txt_get_encoded_length(txt); i = 0; j = 0; while(i < txt_length) { ch_enc = _lv_txt_encoded_next(txt, &j); current_ap_idx = lv_ap_get_char_index(ch_enc); if(current_ap_idx != LV_UNDEF_ARABIC_PERSIAN_CHARS) ch_enc = ap_chars_map[current_ap_idx].char_end_form; if(ch_enc < 0x80) chars_cnt++; else if(ch_enc < 0x0800) chars_cnt += 2; else if(ch_enc < 0x010000) chars_cnt += 3; else chars_cnt += 4; i++; } return chars_cnt + 1; } void _lv_txt_ap_proc(const char * txt, char * txt_out) { uint32_t txt_length = 0; uint32_t index_current, idx_next, idx_previous, i, j; uint32_t * ch_enc; char * txt_out_temp; txt_length = _lv_txt_get_encoded_length(txt); ch_enc = (uint32_t *)lv_mem_alloc(sizeof(uint32_t) * (txt_length + 1)); i = 0; j = 0; while(j < txt_length) ch_enc[j++] = _lv_txt_encoded_next(txt, &i); ch_enc[j] = 0; i = 0; idx_previous = LV_UNDEF_ARABIC_PERSIAN_CHARS; while(i < txt_length) { index_current = lv_ap_get_char_index(ch_enc[i]); idx_next = lv_ap_get_char_index(ch_enc[i + 1]); if(index_current == LV_UNDEF_ARABIC_PERSIAN_CHARS) { i++; idx_previous = LV_UNDEF_ARABIC_PERSIAN_CHARS; continue; } uint8_t conjunction_to_previuse = (i == 0 || idx_previous == LV_UNDEF_ARABIC_PERSIAN_CHARS) ? 0 : ap_chars_map[idx_previous].ap_chars_conjunction.conj_to_next; uint8_t conjunction_to_next = ((i == txt_length - 1) || idx_next == LV_UNDEF_ARABIC_PERSIAN_CHARS) ? 0 : ap_chars_map[idx_next].ap_chars_conjunction.conj_to_previous; if(conjunction_to_previuse && conjunction_to_next) ch_enc[i] = ap_chars_map[index_current].char_end_form + ap_chars_map[index_current].char_middle_form_offset; else if(!conjunction_to_previuse && conjunction_to_next) ch_enc[i] = ap_chars_map[index_current].char_end_form + ap_chars_map[index_current].char_begining_form_offset; else if(conjunction_to_previuse && !conjunction_to_next) ch_enc[i] = ap_chars_map[index_current].char_end_form; else ch_enc[i] = ap_chars_map[index_current].char_end_form + ap_chars_map[index_current].char_isolated_form_offset; idx_previous = index_current; i++; } txt_out_temp = txt_out; i = 0; while(i < txt_length) { if(ch_enc[i] < 0x80) { *(txt_out_temp++) = ch_enc[i] & 0xFF; } else if(ch_enc[i] < 0x0800) { *(txt_out_temp++) = ((ch_enc[i] >> 6) & 0x1F) | 0xC0; *(txt_out_temp++) = ((ch_enc[i] >> 0) & 0x3F) | 0x80; } else if(ch_enc[i] < 0x010000) { *(txt_out_temp++) = ((ch_enc[i] >> 12) & 0x0F) | 0xE0; *(txt_out_temp++) = ((ch_enc[i] >> 6) & 0x3F) | 0x80; *(txt_out_temp++) = ((ch_enc[i] >> 0) & 0x3F) | 0x80; } else if(ch_enc[i] < 0x110000) { *(txt_out_temp++) = ((ch_enc[i] >> 18) & 0x07) | 0xF0; *(txt_out_temp++) = ((ch_enc[i] >> 12) & 0x3F) | 0x80; *(txt_out_temp++) = ((ch_enc[i] >> 6) & 0x3F) | 0x80; *(txt_out_temp++) = ((ch_enc[i] >> 0) & 0x3F) | 0x80; } i++; } *(txt_out_temp) = '\0'; lv_mem_free(ch_enc); } /********************** * STATIC FUNCTIONS **********************/ static uint32_t lv_ap_get_char_index(uint16_t c) { for(uint8_t i = 0; ap_chars_map[i].char_end_form; i++) { if(c == (ap_chars_map[i].char_offset + LV_AP_ALPHABET_BASE_CODE)) return i; } return LV_UNDEF_ARABIC_PERSIAN_CHARS; } #endif
7,083
lv_txt_ap
c
en
c
code
{"qsc_code_num_words": 1056, "qsc_code_num_chars": 7083.0, "qsc_code_mean_word_length": 2.92992424, "qsc_code_frac_words_unique": 0.22537879, "qsc_code_frac_chars_top_2grams": 0.04395604, "qsc_code_frac_chars_top_3grams": 0.03005818, "qsc_code_frac_chars_top_4grams": 0.03878474, "qsc_code_frac_chars_dupe_5grams": 0.5106658, "qsc_code_frac_chars_dupe_6grams": 0.35649644, "qsc_code_frac_chars_dupe_7grams": 0.33290239, "qsc_code_frac_chars_dupe_8grams": 0.27537169, "qsc_code_frac_chars_dupe_9grams": 0.23723335, "qsc_code_frac_chars_dupe_10grams": 0.22074984, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.12564715, "qsc_code_frac_chars_whitespace": 0.2909784, "qsc_code_size_file_byte": 7083.0, "qsc_code_num_lines": 218.0, "qsc_code_num_chars_line_max": 158.0, "qsc_code_num_chars_line_mean": 32.49082569, "qsc_code_frac_chars_alphabet": 0.49044205, "qsc_code_frac_chars_comments": 0.12339404, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.23636364, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00805283, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.06764374, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.1, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.16363636, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": 0.06363636}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 1, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
00Julian00/AI-radio
musicManager.py
import time import requests import queue from pathlib import Path from audioManager import play_audio base_url = 'http://localhost:3000' def get_audio_information(audio_ids): url = f"{base_url}/api/get?ids={audio_ids}" response = requests.get(url) return response.json() queue = queue.Queue() def generate_audio_by_prompt(payload): url = f"{base_url}/api/generate" response = requests.post(url, json=payload, headers={'Content-Type': 'application/json'}) return response.json() def download_audio(url, save_path): response = requests.get(url) save_path = Path(save_path) save_path.parent.mkdir(parents=True, exist_ok=True) save_path.write_bytes(response.content) return str(save_path) def generate_song(genre: str, has_vocals: bool): dataRaw = generate_audio_by_prompt({ "prompt": f"A {genre} song", "make_instrumental": not has_vocals, "wait_audio": False }) data = get_audio_information(dataRaw[0]['id']) while True: data = get_audio_information(dataRaw[0]['id']) if data[0]["status"] == 'complete': break time.sleep(1) timestamp = int(time.time()) songs_dir = Path(__file__).parent / 'Songs' songs_dir.mkdir(exist_ok=True) file_path = songs_dir / f'{genre}_{timestamp}.mp3' download_audio(data[0]['audio_url'], file_path) queue.put(file_path) def play_song(): if not queue.empty(): file_path = queue.get() play_audio(file_path) else: print("No song to play")
1,551
musicManager
py
en
python
code
{"qsc_code_num_words": 213, "qsc_code_num_chars": 1551.0, "qsc_code_mean_word_length": 4.65258216, "qsc_code_frac_words_unique": 0.36619718, "qsc_code_frac_chars_top_2grams": 0.04843592, "qsc_code_frac_chars_top_3grams": 0.05751766, "qsc_code_frac_chars_top_4grams": 0.0221998, "qsc_code_frac_chars_dupe_5grams": 0.09485368, "qsc_code_frac_chars_dupe_6grams": 0.06659939, "qsc_code_frac_chars_dupe_7grams": 0.06659939, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00805153, "qsc_code_frac_chars_whitespace": 0.19922631, "qsc_code_size_file_byte": 1551.0, "qsc_code_num_lines": 59.0, "qsc_code_num_chars_line_max": 94.0, "qsc_code_num_chars_line_mean": 26.28813559, "qsc_code_frac_chars_alphabet": 0.78985507, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.13333333, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.14368557, "qsc_code_frac_chars_long_word_length": 0.05154639, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codepython_cate_ast": 1.0, "qsc_codepython_frac_lines_func_ratio": 0.11111111, "qsc_codepython_cate_var_zero": false, "qsc_codepython_frac_lines_pass": 0.0, "qsc_codepython_frac_lines_import": 0.11111111, "qsc_codepython_frac_lines_simplefunc": 0.0, "qsc_codepython_score_lines_no_logic": 0.28888889, "qsc_codepython_frac_lines_print": 0.02222222}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codepython_cate_ast": 0, "qsc_codepython_frac_lines_func_ratio": 0, "qsc_codepython_cate_var_zero": 0, "qsc_codepython_frac_lines_pass": 0, "qsc_codepython_frac_lines_import": 0, "qsc_codepython_frac_lines_simplefunc": 0, "qsc_codepython_score_lines_no_logic": 0, "qsc_codepython_frac_lines_print": 0}
00jacs/sveltekit-ultrafast
src/routes/docs/components/slideover/+page.svelte
<script lang="ts"> import { Button, Slideover } from '$lib/components'; import { DocsPage, DocsCode, DocsPreview } from '$lib/components/page/docs'; let slideoverOpen = false; function handleSave() { console.log('Save action'); slideoverOpen = false; } function handleCancel() { console.log('Cancel action'); slideoverOpen = false; } </script> <DocsPage title="Slideover"> <p class="mb-6">To use the Slideover component, import it from '$lib/components'.</p> <DocsCode class="mb-8" language="typescript" code={`import { Slideover } from '$lib/components';`} /> <p class="mb-4">Then, use it in your Svelte component:</p> <DocsCode class="mb-8" language="typescript" code={` let slideoverOpen = false; function handleSave() { console.log('Save action'); slideoverOpen = false; } function handleCancel() { console.log('Cancel action'); slideoverOpen = false; } `} /> <p class="mb-4">And render in your template:</p> <DocsCode class="mb-8" language="html" code={` <Button on:click={() => slideoverOpen = true}>Open Slideover</Button> <Slideover bind:open={slideoverOpen} title="Slideover Title" subtitle="This is a subtitle." on:save={handleSave} on:cancel={handleCancel} cancelText="Close" submitText="Submit"> <p>This is the content of the slideover.</p> </Slideover> `} /> <DocsPreview class="mb-8"> <Button class="btn-primary" on:click={() => (slideoverOpen = true)}> Open Slideover </Button> <Slideover bind:open={slideoverOpen} title="Slideover Title" subtitle="This is a subtitle." on:save={handleSave} on:cancel={handleCancel} cancelText="Close" submitText="Submit"> <p>This is the content of the slideover.</p> </Slideover> </DocsPreview> <p class="mb-8"> The Slideover component uses a sliding panel to display content. It supports several props for customization: </p> <DocsCode class="mb-8" language="typescript" code={` open: boolean; title: string; subtitle: string = ''; cancelText: string = 'Cancel'; submitText: string = 'Save'; showButtons: boolean = true; `} /> <p class="mb-8">The Slideover component emits the following events:</p> <ul class="mb-8"> <li><code>save</code>: Emitted when the submit button is clicked.</li> <li> <code>cancel</code>: Emitted when the cancel button is clicked or the close icon is clicked. </li> </ul> <p class="mb-8"> The Slideover component is styled using classes and can be customized by passing class names to the <code>class</code> prop. It also uses Svelte transitions to animate the sliding effect. </p> </DocsPage>
2,649
+page
svelte
en
svelte
code
{"qsc_code_num_words": 338, "qsc_code_num_chars": 2649.0, "qsc_code_mean_word_length": 5.29585799, "qsc_code_frac_words_unique": 0.29881657, "qsc_code_frac_chars_top_2grams": 0.04692737, "qsc_code_frac_chars_top_3grams": 0.04022346, "qsc_code_frac_chars_top_4grams": 0.03575419, "qsc_code_frac_chars_dupe_5grams": 0.54413408, "qsc_code_frac_chars_dupe_6grams": 0.54413408, "qsc_code_frac_chars_dupe_7grams": 0.5301676, "qsc_code_frac_chars_dupe_8grams": 0.47988827, "qsc_code_frac_chars_dupe_9grams": 0.41452514, "qsc_code_frac_chars_dupe_10grams": 0.41452514, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00548697, "qsc_code_frac_chars_whitespace": 0.17440544, "qsc_code_size_file_byte": 2649.0, "qsc_code_num_lines": 117.0, "qsc_code_num_chars_line_max": 95.0, "qsc_code_num_chars_line_mean": 22.64102564, "qsc_code_frac_chars_alphabet": 0.81298583, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.57894737, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.1215553, "qsc_code_frac_chars_long_word_length": 0.00943752, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/routes/docs/components/button/+page.svelte
<script lang="ts"> import { Button } from '$lib/components'; import { DocsPage, DocsCode, DocsNote, DocsPreview } from '$lib/components/page/docs'; </script> <DocsPage title="Button"> <p class="mb-6"> In order to use button (or any other of the 'common' components), you can import it from '$lib/components'. </p> <DocsCode class="mb-8" language="typescript" code={`import { Button } from '$lib/components';`} /> <p class="mb-4">And then use in in your Svelte template:</p> <DocsCode class="mb-8" language="html" code={` <Button class="btn-primary">Click me</Button> <Button class="btn-outline border-base-200">Outline button</Button> <Button class="btn-outline border-base-200" loading={true}>Loading button</Button> `} /> <DocsPreview class="mb-8"> <div class="flex flex-wrap gap-2"> <Button class="btn-primary">Click me</Button> <Button class="btn-outline border-base-200">Outline button</Button> <Button class="btn-outline border-base-200" loading={true}>Loading button</Button> </div> </DocsPreview> <p class="mb-8"> The button component is a simple Svelte component that accepts 4 props: </p> <DocsCode class="mb-8" language="typescript" code={` id: string | undefined = undefined; type: 'button' | 'submit' | 'reset' = 'button'; loading = false; class: string; `} /> <p class="mb-8"> The button component is based on <a href="https://daisyui.com/components/button/" class="link link-primary" target="_blank"> DaisyUI button </a> so in case you need more customization, you can check out their documentation. </p> </DocsPage>
1,613
+page
svelte
en
svelte
code
{"qsc_code_num_words": 227, "qsc_code_num_chars": 1613.0, "qsc_code_mean_word_length": 4.82378855, "qsc_code_frac_words_unique": 0.39647577, "qsc_code_frac_chars_top_2grams": 0.05114155, "qsc_code_frac_chars_top_3grams": 0.04383562, "qsc_code_frac_chars_top_4grams": 0.07305936, "qsc_code_frac_chars_dupe_5grams": 0.47579909, "qsc_code_frac_chars_dupe_6grams": 0.42283105, "qsc_code_frac_chars_dupe_7grams": 0.4, "qsc_code_frac_chars_dupe_8grams": 0.4, "qsc_code_frac_chars_dupe_9grams": 0.27579909, "qsc_code_frac_chars_dupe_10grams": 0.27579909, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01614087, "qsc_code_frac_chars_whitespace": 0.1549907, "qsc_code_size_file_byte": 1613.0, "qsc_code_num_lines": 62.0, "qsc_code_num_chars_line_max": 88.0, "qsc_code_num_chars_line_mean": 26.01612903, "qsc_code_frac_chars_alphabet": 0.78723404, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.44230769, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.23186609, "qsc_code_frac_chars_long_word_length": 0.01549907, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/routes/docs/components/loader/+page.svelte
<script lang="ts"> import { Loader } from '$lib/components'; import { DocsPage, DocsCode, DocsNote, DocsPreview } from '$lib/components/page/docs'; </script> <DocsPage title="Loader"> <p class="mb-6">To use the Loader component, import it from '$lib/components'.</p> <DocsCode class="mb-8" language="typescript" code={`import { Loader } from '$lib/components';`} /> <p class="mb-4">Then, use it in your Svelte template:</p> <DocsCode class="mb-8" language="html" code={` <Loader /> `} /> <DocsPreview class="mb-8"> <div class="relative h-24 w-24 border"> <Loader class="custom-class" spinnerClass="custom-spinner-class" /> </div> </DocsPreview> <p class="mb-8"> The Loader component is a simple Svelte component that accepts two props: </p> <DocsCode class="mb-8" language="typescript" code={` class: string = ''; // class for the container spinnerClass: string = ''; // class for the spinner itself `} /> <p class="mb-8"> The Loader component is styled using classes and can be customized by passing class names to the <code>class</code> and <code>spinnerClass</code> props. </p> </DocsPage>
1,147
+page
svelte
en
svelte
code
{"qsc_code_num_words": 159, "qsc_code_num_chars": 1147.0, "qsc_code_mean_word_length": 4.83018868, "qsc_code_frac_words_unique": 0.40880503, "qsc_code_frac_chars_top_2grams": 0.07291667, "qsc_code_frac_chars_top_3grams": 0.0625, "qsc_code_frac_chars_top_4grams": 0.0625, "qsc_code_frac_chars_dupe_5grams": 0.28515625, "qsc_code_frac_chars_dupe_6grams": 0.20963542, "qsc_code_frac_chars_dupe_7grams": 0.17708333, "qsc_code_frac_chars_dupe_8grams": 0.17708333, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01251303, "qsc_code_frac_chars_whitespace": 0.16390584, "qsc_code_size_file_byte": 1147.0, "qsc_code_num_lines": 47.0, "qsc_code_num_chars_line_max": 88.0, "qsc_code_num_chars_line_mean": 24.40425532, "qsc_code_frac_chars_alphabet": 0.78832117, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.43243243, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.16652136, "qsc_code_frac_chars_long_word_length": 0.02179599, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/lib/components/page/docs/code.svelte
<script lang="ts"> import { onMount } from 'svelte'; import { scale } from 'svelte/transition'; import { getHighlighter } from 'shiki'; import { Icon, Clipboard } from 'svelte-hero-icons'; import { Button } from '$lib/components'; type Lang = 'html' | 'bash' | 'typescript' | 'javascript' | 'sql' | 'svelte'; export let code = ''; // The code to highlight export let language: Lang = 'typescript'; // Default to JavaScript let className: string = ''; export { className as class }; let highlightedHtml = ''; // This will hold the HTML output from Shiki let showCopiedAlert = false; onMount(async () => { const highlighter = await getHighlighter({ langs: ['html', 'svelte', 'ts', 'bash', 'sql'], themes: ['nord'] }); highlightedHtml = highlighter.codeToHtml(code, { lang: language, theme: 'nord' }); }); function handleCopyCodeClick() { navigator && navigator?.clipboard?.writeText(code); showCopiedAlert = true; setTimeout(() => { showCopiedAlert = false; }, 1200); } </script> <div class="rounded {className}"> <!-- Code Toolbar --> <div class="text-base-content-secondary flex items-center justify-between rounded-t border border-b-0 border-base-200 px-3 py-1 text-sm"> <p>{language === 'bash' ? 'terminal' : language}</p> <div class="relative"> <slot name="toolbar-header" /> <Button class="btn btn-ghost -mr-0.5 !px-0.5 !py-1" on:click={handleCopyCodeClick}> <span class="sr-only">Copy code</span> <Icon src={Clipboard} class="h-5 w-5" /> </Button> {#if showCopiedAlert} <div class="text-base-content-secondary absolute -right-6 -top-6 -mr-2 -mt-2 rounded-full bg-base-200 px-3 py-0.5" transition:scale={{ duration: 350 }}> Copied! </div> {/if} </div> </div> <div class="overflow-hidden rounded-b text-sm"> {@html highlightedHtml} </div> </div> <style lang="postcss"> /* Additional styling for ALL the code blocks */ :global(.shiki) { font-family: 'Fira Code', monospace; overflow-x: auto; @apply px-4 py-2; } </style>
2,091
code
svelte
en
svelte
code
{"qsc_code_num_words": 258, "qsc_code_num_chars": 2091.0, "qsc_code_mean_word_length": 5.12015504, "qsc_code_frac_words_unique": 0.50387597, "qsc_code_frac_chars_top_2grams": 0.03028009, "qsc_code_frac_chars_top_3grams": 0.01816805, "qsc_code_frac_chars_top_4grams": 0.02422407, "qsc_code_frac_chars_dupe_5grams": 0.0666162, "qsc_code_frac_chars_dupe_6grams": 0.04844815, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01904762, "qsc_code_frac_chars_whitespace": 0.19655667, "qsc_code_size_file_byte": 2091.0, "qsc_code_num_lines": 80.0, "qsc_code_num_chars_line_max": 87.0, "qsc_code_num_chars_line_mean": 26.1375, "qsc_code_frac_chars_alphabet": 0.7672619, "qsc_code_frac_chars_comments": 0.07699665, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.17241379, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.01724138, "qsc_code_frac_chars_string_length": 0.14404145, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/lib/components/page/auth/auth-page.svelte
<!-- This is a ready-to-go component that you can use in your login and register pages. It handles the form and the authentication flow for you. You can customize it to fit your needs. --> <script lang="ts"> import { enhance } from '$app/forms'; import { Button, InputText, Checkbox } from '$lib/components'; import { Icon, ExclamationCircle } from 'svelte-hero-icons'; import z from 'zod'; enum AuthMode { LOGIN = 'login', REGISTER = 'register' } export let mode: AuthMode = AuthMode.LOGIN; export let form: { message: string; errors: | z.typeToFlattenedError<{ email: string; password: string; confirmPassword: string; }> | undefined; } = { message: '', errors: undefined }; </script> <div class="flex min-h-full flex-col justify-center px-8 py-10 sm:px-6"> <!-- Header with title and your logo --> <header class="sm:mx-auto sm:w-full sm:max-w-md"> <!-- @DO: Your logo here <enhanced:img class="h-6 w-auto" src="$lib/assets/logo.svg" alt="@DO: Fill your company name" /> --> <h2 class="mt-6 text-center text-3xl font-semibold leading-9"> {mode === AuthMode.LOGIN ? 'Sign in to your account' : 'Create your account'} </h2> </header> <!-- Main content and the form--> <main class="mt-10 sm:mx-auto sm:w-full sm:max-w-[480px]"> <div class="rounded-lg border border-base-200 bg-white bg-opacity-[2%] px-6 py-10 shadow sm:px-12"> {#if form?.message} <div class="mb-6 flex gap-2 rounded text-error"> <Icon src={ExclamationCircle} class="h-5 w-5" /> <p class="text-sm font-bold"> {form?.message} </p> </div> {/if} <form class="flex flex-col gap-y-6" action={mode === AuthMode.LOGIN ? '?/login' : '?/signup'} method="POST" use:enhance> <InputText id="email" name="email" type="email" placeholder="Your email address" autocomplete="email" required label="Email" error={form?.errors?.fieldErrors?.email?.[0]} /> <InputText id="password" name="password" type="password" autocomplete="current-password" placeholder="Choose your password" required label="Password" error={form?.errors?.fieldErrors?.password?.[0]} /> {#if mode === AuthMode.REGISTER} <InputText id="confirmPassword" name="confirmPassword" type="password" placeholder="Confirm your password" required label="Confirm password" error={form?.errors?.fieldErrors?.confirmPassword?.[0]} /> {:else} <div class="flex items-center justify-between"> <Checkbox id="remember-me" name="remember-me" label="Remember me" inputClass="text-sm" labelClass="text-sm" /> <div class="leading-6"> <a href="#" class="link link-primary text-sm font-semibold no-underline"> Forgot password? </a> </div> </div> {/if} <Button type="submit" class="btn-primary w-full"> {mode === AuthMode.LOGIN ? 'Sign in' : 'Sign up'} </Button> </form> <div> <div class="relative mt-10"> <div class="absolute inset-0 flex items-center"> <div class="w-full border-t border-base-300"></div> </div> <div class="relative flex justify-center text-sm font-medium leading-6"> <span class="bg-base-100 px-6">Or continue with</span> </div> </div> <div class="mt-6 grid grid-cols-2 gap-4"> <form action="?/loginWithGoogle" method="POST"> <Button type="submit" class="w-full border-base-300"> <enhanced:img src="$lib/assets/icons/google.svg" class="h-5 w-5" /> <span class="text-sm font-semibold leading-6">Google</span> </Button> </form> <form action="?/loginWithGithub" method="POST"> <Button type="submit" class="w-full border-base-300"> <enhanced:img src="$lib/assets/icons/github.svg" class="h-6 w-6" /> <span class="text-sm font-semibold leading-6">Github</span> </Button> </form> </div> </div> </div> {#if mode === AuthMode.LOGIN} <p class="mt-10 text-center text-sm"> Not a member? <a href="/auth/register" class="link link-primary font-semibold leading-6 no-underline"> Register. </a> </p> {:else} <p class="mt-10 text-center text-sm"> Already a member? <a href="/auth/login" class="link link-primary leading-6 no-underline"> Sign in. </a> </p> {/if} </main> </div>
4,518
auth-page
svelte
en
svelte
code
{"qsc_code_num_words": 601, "qsc_code_num_chars": 4518.0, "qsc_code_mean_word_length": 4.50748752, "qsc_code_frac_words_unique": 0.30116473, "qsc_code_frac_chars_top_2grams": 0.02953119, "qsc_code_frac_chars_top_3grams": 0.018457, "qsc_code_frac_chars_top_4grams": 0.0166113, "qsc_code_frac_chars_dupe_5grams": 0.17792543, "qsc_code_frac_chars_dupe_6grams": 0.11738649, "qsc_code_frac_chars_dupe_7grams": 0.11738649, "qsc_code_frac_chars_dupe_8grams": 0.11738649, "qsc_code_frac_chars_dupe_9grams": 0.07235142, "qsc_code_frac_chars_dupe_10grams": 0.05684755, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01877527, "qsc_code_frac_chars_whitespace": 0.23373174, "qsc_code_size_file_byte": 4518.0, "qsc_code_num_lines": 165.0, "qsc_code_num_chars_line_max": 98.0, "qsc_code_num_chars_line_mean": 27.38181818, "qsc_code_frac_chars_alphabet": 0.76372039, "qsc_code_frac_chars_comments": 0.95551129, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 1, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/lib/components/page/pricing/multiple-plans.svelte
<script lang="ts"> import { Icon, Check } from 'svelte-hero-icons'; // @DO: Each of those should have a valid Stripe product ID // and the form should be handled in a way that it's done for `simple-one-time.svelte` // in the `src/routes/payment/+page.svelte` file. const plans = [ { name: 'Freelancer', description: 'The essentials to provide your best work for clients.', price: 15, annualPrice: 100, features: [ '5 products', 'Up to 1,000 subscribers', 'Basic analytics', '48-hour support response time' ] }, { name: 'Startup', description: 'A plan that scales with your rapidly growing business.', price: 30, annualPrice: 200, features: [ '25 products', 'Up to 10,000 subscribers', 'Advanced analytics', '24-hour support response time', 'Marketing automations' ], cta: true // whether to mark this plan as the "most popular" }, { name: 'Enterprise', description: 'Dedicated support and infrastructure for your company.', price: 60, annualPrice: 250, features: [ 'Unlimited products', 'Unlimited subscribers', 'Advanced analytics', '1-hour, dedicated support response time', 'Marketing automations', 'Custom reporting tools' ] } ]; let isAnnual = false; // whether we show "monthly" or "annual" prices </script> <div class="py-24 sm:py-32"> <div class="mx-auto max-w-7xl px-6 lg:px-8"> <div class="mx-auto max-w-4xl text-center"> <h2 class="text-base font-semibold leading-7 text-primary">Pricing</h2> <p class="mt-2 text-4xl font-bold tracking-tight sm:text-5xl"> Pricing plans for teams of&nbsp;all&nbsp;sizes </p> </div> <p class="text-base-content-secondary mx-auto mt-6 max-w-2xl text-center text-lg leading-8"> Choose an affordable plan that’s packed with the best features for engaging your audience, creating customer loyalty, and driving sales. </p> <div class="mt-16 flex justify-center"> <fieldset aria-label="Payment frequency"> <div class="grid grid-cols-2 gap-x-1 rounded-full p-1 text-center text-xs font-semibold leading-5 ring-1 ring-inset ring-base-200"> <!-- Checked: "bg-indigo-600 text-white", Not Checked: "text-gray-500" --> <label class="cursor-pointer rounded-full px-2.5 py-1 {!isAnnual ? 'bg-primary text-white' : 'text-base-content-secondary'}"> <input type="radio" name="frequency" value="monthly" class="sr-only" on:click={() => (isAnnual = false)} /> <span>Monthly</span> </label> <!-- Checked: "bg-indigo-600 text-white", Not Checked: "text-gray-500" --> <label class="cursor-pointer rounded-full px-2.5 py-1 {isAnnual ? 'bg-primary text-white' : 'text-base-content-secondary'}"> <input type="radio" name="frequency" value="annually" class="sr-only" on:click={() => (isAnnual = true)} /> <span>Annually</span> </label> </div> </fieldset> </div> <div class="isolate mx-auto mt-10 grid max-w-md grid-cols-1 gap-8 lg:mx-0 lg:max-w-none lg:grid-cols-3"> {#each plans as plan} <div class="rounded-3xl p-8 ring-1 {plan.cta ? 'ring-primary' : 'ring-base-200'} xl:p-10"> <div class="flex items-center justify-between gap-x-4"> <h3 id="tier-{plan.name.toLowerCase()}" class="text-lg font-semibold leading-8 {plan.cta ? 'text-primary' : ''}"> {plan.name} </h3> {#if plan.cta} <p class="rounded-full bg-primary/10 px-2.5 py-1 text-xs font-semibold leading-5 text-primary"> Most popular </p> {/if} </div> <p class="text-base-content-secondary mt-4 text-sm leading-6"> {plan.description} </p> <p class="mt-6 flex items-baseline gap-x-1"> <span class="text-4xl font-bold tracking-tight"> ${isAnnual ? plan.annualPrice : plan.price} </span> <span class="text-base-content-secondary text-sm font-semibold leading-6"> {#if isAnnual} /year {:else} /month {/if} </span> </p> <a href="#" class="btn mt-6 w-full {plan.cta ? 'btn-primary' : 'btn-outline border-base-200 text-primary'}"> Buy plan </a> <ul role="list" class="text-base-content-secondary mt-8 space-y-3 text-sm leading-6 xl:mt-10"> {#each plan.features as feature} <li class="flex gap-x-3"> <Icon src={Check} class="h-6 w-5 flex-none text-primary" /> {feature} </li> {/each} </ul> </div> {/each} </div> </div> </div>
4,714
multiple-plans
svelte
en
svelte
code
{"qsc_code_num_words": 653, "qsc_code_num_chars": 4714.0, "qsc_code_mean_word_length": 4.30474732, "qsc_code_frac_words_unique": 0.35068913, "qsc_code_frac_chars_top_2grams": 0.0227677, "qsc_code_frac_chars_top_3grams": 0.03201708, "qsc_code_frac_chars_top_4grams": 0.05122732, "qsc_code_frac_chars_dupe_5grams": 0.26716471, "qsc_code_frac_chars_dupe_6grams": 0.22660975, "qsc_code_frac_chars_dupe_7grams": 0.14514408, "qsc_code_frac_chars_dupe_8grams": 0.12166489, "qsc_code_frac_chars_dupe_9grams": 0.12166489, "qsc_code_frac_chars_dupe_10grams": 0.12166489, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.03367289, "qsc_code_frac_chars_whitespace": 0.2503182, "qsc_code_size_file_byte": 4714.0, "qsc_code_num_lines": 164.0, "qsc_code_num_chars_line_max": 132.0, "qsc_code_num_chars_line_mean": 28.74390244, "qsc_code_frac_chars_alphabet": 0.76174307, "qsc_code_frac_chars_comments": 0.98515062, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.27142857, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 1, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_Menu.cpp
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #include "ESP32Berry_Menu.h" static Menu *instance = NULL; Menu::Menu(Display *display, System *system, FuncPtrInt callback) { instance = this; _system = system; _display = display; _uiRoot = display->get_ui_root(); _bodyScreen = display->get_body_screen(); menu_event_cb = callback; xSemaphoreTake(_display->get_mutex(), portMAX_DELAY); this->ui_menu_items(); this->ui_menu(); xSemaphoreGive(_display->get_mutex()); } Menu::~Menu() {} extern "C" void menu_event_handler_thunk(lv_event_t *e) { instance->menu_event_handler(e); } extern "C" void wifi_event_cb_thunk(lv_event_t *e) { instance->wifi_event_cb(e); } extern "C" void menu_textarea_event_cb_thunk(lv_event_t *e) { instance->_display->textarea_event_cb(e); } void Menu::menu_event_handler(lv_event_t *e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t *obj = lv_event_get_target(e); if (code == LV_EVENT_CLICKED) { if (obj == uiMenuCloseBtn) { lv_obj_add_flag(uiMenuSDCard, LV_OBJ_FLAG_HIDDEN); } else if (obj == logoBtn) { if (lv_obj_has_flag(menuList, LV_OBJ_FLAG_HIDDEN)) { this->ui_menu_open(true); } else { this->ui_menu_open(false); } } else if (obj == mboxConnectBtn) { lv_obj_move_background(mboxConnect); lv_obj_add_flag(mboxConnect, LV_OBJ_FLAG_HIDDEN); lv_obj_add_flag(menuList, LV_OBJ_FLAG_HIDDEN); lv_obj_add_flag(uiMenuWiFI, LV_OBJ_FLAG_HIDDEN); char *key = new char[strlen(lv_label_get_text(mboxTitle)) + strlen(lv_textarea_get_text(mboxPassword)) + 3]; strcpy(key, lv_label_get_text(mboxTitle)); strcat(key, WIFI_SSID_PW_DELIMITER); strcat(key, lv_textarea_get_text(mboxPassword)); menu_event_cb(WIFI_ON, key); delete[] key; _display->show_loading_popup(true); lv_textarea_set_text(mboxPassword, ""); } else if (obj == mboxCloseBtn) { lv_obj_move_background(mboxConnect); lv_obj_add_flag(mboxConnect, LV_OBJ_FLAG_HIDDEN); } else if (obj == uiWiFiCloseBtn) { lv_obj_add_flag(uiMenuWiFI, LV_OBJ_FLAG_HIDDEN); } else if (obj == uiMenuCloseBtn) { lv_obj_add_flag(uiMenuSDCard, LV_OBJ_FLAG_HIDDEN); } else if (obj == uiBatteryCloseBtn) { lv_obj_add_flag(uiMenuBattery, LV_OBJ_FLAG_HIDDEN); } else { lv_obj_add_flag(menuList, LV_OBJ_FLAG_HIDDEN); switch (lv_obj_get_child_id(obj)) { case 0: _display->ui_popup_open("ESP32Berry v0.3", "ESP v2.0.4\nLVGL v8.3.1\nLovyanGFX v0.4.18\nFastBot v2.22\n\nby ThatProject"); break; case 2: lv_obj_clear_flag(uiMenuWiFI, LV_OBJ_FLAG_HIDDEN); break; case 3: lv_obj_clear_flag(uiMenuBattery, LV_OBJ_FLAG_HIDDEN); break; case 5: this->open_menu_sdcard(); break; case 7: _system->restart(); break; } } } else if (code == LV_EVENT_VALUE_CHANGED) { if (obj == uiWiFiSwitch) { if (lv_obj_has_state(obj, LV_STATE_CHECKED)) { menu_event_cb(WIFI_ON, NULL); } else { menu_event_cb(WIFI_OFF, NULL); lv_obj_clean(uiWiFiList); } } } } void Menu::wifi_event_cb(lv_event_t *e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t *obj = lv_event_get_target(e); if (code == LV_EVENT_CLICKED) { String selectedItem = lv_list_get_btn_text(uiWiFiList, obj); String selectedSSID = selectedItem.substring(0, selectedItem.indexOf(" (-")); lv_label_set_text(mboxTitle, selectedSSID.c_str()); lv_obj_move_foreground(mboxConnect); lv_obj_clear_flag(mboxConnect, LV_OBJ_FLAG_HIDDEN); } } void Menu::ui_menu() { LV_IMG_DECLARE(ESP32Berry_Icon); logoBtn = lv_imgbtn_create(_uiRoot); lv_obj_set_size(logoBtn, 40, 40); lv_imgbtn_set_src(logoBtn, LV_IMGBTN_STATE_RELEASED, &ESP32Berry_Icon, NULL, NULL); lv_obj_align(logoBtn, LV_ALIGN_TOP_LEFT, 4, 0); lv_obj_add_event_cb(logoBtn, menu_event_handler_thunk, LV_EVENT_CLICKED, NULL); menuList = lv_list_create(_uiRoot); lv_obj_set_size(menuList, 200, 240); lv_obj_align(menuList, LV_ALIGN_TOP_LEFT, 0, 40); lv_obj_t *menuListBtn = lv_list_add_btn(menuList, LV_SYMBOL_HOME, "About This"); lv_obj_add_event_cb(menuListBtn, menu_event_handler_thunk, LV_EVENT_CLICKED, NULL); lv_list_add_text(menuList, ""); menuListBtn = lv_list_add_btn(menuList, LV_SYMBOL_WIFI, "Wi-Fi"); lv_obj_add_event_cb(menuListBtn, menu_event_handler_thunk, LV_EVENT_CLICKED, NULL); menuListBtn = lv_list_add_btn(menuList, LV_SYMBOL_BATTERY_3, "Battery"); lv_obj_add_event_cb(menuListBtn, menu_event_handler_thunk, LV_EVENT_CLICKED, NULL); lv_list_add_text(menuList, ""); menuListBtn = lv_list_add_btn(menuList, LV_SYMBOL_SD_CARD, "SD CARD"); lv_obj_add_event_cb(menuListBtn, menu_event_handler_thunk, LV_EVENT_CLICKED, NULL); lv_list_add_text(menuList, ""); menuListBtn = lv_list_add_btn(menuList, LV_SYMBOL_POWER, "Restart..."); lv_obj_add_event_cb(menuListBtn, menu_event_handler_thunk, LV_EVENT_CLICKED, NULL); this->ui_menu_open(false); } void Menu::ui_menu_open(bool isOn) { if (isOn) { lv_obj_clear_flag(menuList, LV_OBJ_FLAG_HIDDEN); } else { lv_obj_add_flag(menuList, LV_OBJ_FLAG_HIDDEN); } } void Menu::ui_menu_items() { this->ui_menu_wifi(); this->ui_wifi_conenct_box(); this->ui_menu_battery(); this->ui_menu_sdcard(); } void Menu::ui_menu_wifi() { uiMenuWiFI = lv_obj_create(_uiRoot); lv_obj_add_flag(uiMenuWiFI, LV_OBJ_FLAG_HIDDEN); lv_obj_set_size(uiMenuWiFI, DISPLAY_WIDTH - 100, DISPLAY_HEIGHT - 40); lv_obj_align(uiMenuWiFI, LV_ALIGN_TOP_MID, 0, 20); lv_obj_t *titleLabel = lv_label_create(uiMenuWiFI); lv_label_set_text(titleLabel, "Wi-Fi " LV_SYMBOL_WIFI); lv_obj_set_style_text_font(titleLabel, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_align(titleLabel, LV_ALIGN_TOP_LEFT, 0, 0); uiWiFiCloseBtn = lv_btn_create(uiMenuWiFI); lv_obj_set_size(uiWiFiCloseBtn, 30, 30); lv_obj_align(uiWiFiCloseBtn, LV_ALIGN_TOP_RIGHT, 0, -10); lv_obj_add_event_cb(uiWiFiCloseBtn, menu_event_handler_thunk, LV_EVENT_CLICKED, NULL); lv_obj_t *btnSymbol = lv_label_create(uiWiFiCloseBtn); lv_label_set_text(btnSymbol, LV_SYMBOL_CLOSE); lv_obj_center(btnSymbol); uiWiFiSwitch = lv_switch_create(uiMenuWiFI); lv_obj_add_event_cb(uiWiFiSwitch, menu_event_handler_thunk, LV_EVENT_VALUE_CHANGED, NULL); lv_obj_align_to(uiWiFiSwitch, titleLabel, LV_ALIGN_TOP_RIGHT, 60, -5); uiWiFiList = lv_list_create(uiMenuWiFI); lv_obj_set_size(uiWiFiList, DISPLAY_WIDTH - 140, 210); lv_obj_align_to(uiWiFiList, titleLabel, LV_ALIGN_TOP_LEFT, 0, 30); } void Menu::ui_wifi_conenct_box() { mboxConnect = lv_obj_create(_uiRoot); lv_obj_set_size(mboxConnect, DISPLAY_WIDTH * 2 / 3, DISPLAY_HEIGHT / 2); lv_obj_center(mboxConnect); mboxTitle = lv_label_create(mboxConnect); lv_label_set_text(mboxTitle, ""); lv_obj_set_size(mboxTitle, DISPLAY_WIDTH * 2 / 3 - 40, 40); lv_obj_align(mboxTitle, LV_ALIGN_TOP_MID, 0, 0); mboxPassword = lv_textarea_create(mboxConnect); lv_obj_set_size(mboxPassword, DISPLAY_WIDTH * 2 / 3 - 40, 40); lv_obj_align_to(mboxPassword, mboxTitle, LV_ALIGN_TOP_MID, 0, 40); lv_textarea_set_placeholder_text(mboxPassword, "Password?"); lv_obj_add_event_cb(mboxPassword, menu_textarea_event_cb_thunk, LV_EVENT_FOCUSED, NULL); lv_obj_add_event_cb(mboxPassword, menu_textarea_event_cb_thunk, LV_EVENT_DEFOCUSED, NULL); mboxConnectBtn = lv_btn_create(mboxConnect); lv_obj_add_event_cb(mboxConnectBtn, menu_event_handler_thunk, LV_EVENT_ALL, NULL); lv_obj_align(mboxConnectBtn, LV_ALIGN_BOTTOM_RIGHT, 0, 0); lv_obj_t *btnLabel = lv_label_create(mboxConnectBtn); lv_label_set_text(btnLabel, "Connect"); lv_obj_center(btnLabel); mboxCloseBtn = lv_btn_create(mboxConnect); lv_obj_add_event_cb(mboxCloseBtn, menu_event_handler_thunk, LV_EVENT_ALL, NULL); lv_obj_align(mboxCloseBtn, LV_ALIGN_BOTTOM_LEFT, 0, 0); lv_obj_t *btnLabel2 = lv_label_create(mboxCloseBtn); lv_label_set_text(btnLabel2, "Cancel"); lv_obj_center(btnLabel2); lv_obj_move_background(mboxConnect); lv_obj_add_flag(mboxConnect, LV_OBJ_FLAG_HIDDEN); } void Menu::update_ui_network(std::vector<String> newWifiList) { xSemaphoreTake(_display->get_mutex(), portMAX_DELAY); if (!lv_obj_has_flag(mboxConnect, LV_OBJ_FLAG_HIDDEN)) { xSemaphoreGive(_display->get_mutex()); return; } lv_obj_clear_flag(uiWiFiList, LV_OBJ_FLAG_CLICKABLE); lv_obj_clear_flag(uiWiFiList, LV_OBJ_FLAG_SCROLLABLE); lv_obj_clean(uiWiFiList); lv_list_add_text(uiWiFiList, newWifiList.size() > 1 ? "WiFi: Found Networks" : "WiFi: Not Found!"); for (std::vector<String>::iterator item = newWifiList.begin(); item != newWifiList.end(); ++item) { lv_obj_t *btn = lv_list_add_btn(uiWiFiList, LV_SYMBOL_WIFI, (*item).c_str()); lv_obj_add_event_cb(btn, wifi_event_cb_thunk, LV_EVENT_CLICKED, NULL); } lv_obj_add_flag(uiWiFiList, LV_OBJ_FLAG_CLICKABLE); lv_obj_add_flag(uiWiFiList, LV_OBJ_FLAG_SCROLLABLE); xSemaphoreGive(_display->get_mutex()); } void Menu::ui_network_switch(bool isOn) { if (!isOn) { lv_obj_clear_state(uiWiFiSwitch, LV_STATE_CHECKED); } } void Menu::ui_menu_battery() { lv_style_init(&batteryStyle); lv_style_set_bg_opa(&batteryStyle, LV_OPA_COVER); lv_style_set_bg_color(&batteryStyle, lv_palette_main(LV_PALETTE_GREEN)); lv_style_set_bg_grad_color(&batteryStyle, lv_palette_main(LV_PALETTE_GREY)); lv_style_set_bg_grad_dir(&batteryStyle, LV_GRAD_DIR_VER); lv_style_set_radius(&batteryStyle, 16); lv_style_set_border_width(&batteryStyle, 0); lv_style_init(&borderStyle); lv_style_set_radius(&borderStyle, 16); lv_style_set_border_width(&borderStyle, 4); lv_style_set_border_color(&borderStyle, lv_color_black()); uiMenuBattery = lv_obj_create(_uiRoot); lv_obj_add_flag(uiMenuBattery, LV_OBJ_FLAG_HIDDEN); lv_obj_set_size(uiMenuBattery, DISPLAY_WIDTH - 100, DISPLAY_HEIGHT - 40); lv_obj_align(uiMenuBattery, LV_ALIGN_TOP_MID, 0, 20); lv_obj_t *titleLabel = lv_label_create(uiMenuBattery); lv_label_set_text(titleLabel, "Battery " LV_SYMBOL_BATTERY_FULL); lv_obj_set_style_text_font(titleLabel, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_align(titleLabel, LV_ALIGN_TOP_LEFT, 0, 0); uiBatteryCloseBtn = lv_btn_create(uiMenuBattery); lv_obj_set_size(uiBatteryCloseBtn, 30, 30); lv_obj_align(uiBatteryCloseBtn, LV_ALIGN_TOP_RIGHT, 0, -10); lv_obj_add_event_cb(uiBatteryCloseBtn, menu_event_handler_thunk, LV_EVENT_CLICKED, NULL); lv_obj_t *btnSymbol = lv_label_create(uiBatteryCloseBtn); lv_label_set_text(btnSymbol, LV_SYMBOL_CLOSE); lv_obj_center(btnSymbol); lv_obj_t *batteryTop = lv_obj_create(uiMenuBattery); lv_obj_remove_style_all(batteryTop); lv_obj_add_style(batteryTop, &borderStyle, 0); lv_obj_set_size(batteryTop, 36, 36); lv_obj_align(batteryTop, LV_ALIGN_TOP_MID, 0, 0); lv_obj_t *batteryFrame = lv_obj_create(uiMenuBattery); lv_obj_add_style(batteryFrame, &borderStyle, 0); lv_obj_set_size(batteryFrame, 116, 216); lv_obj_center(batteryFrame); batteryMeter = lv_bar_create(uiMenuBattery); lv_obj_remove_style_all(batteryMeter); lv_obj_add_style(batteryMeter, &batteryStyle, LV_PART_INDICATOR); lv_obj_set_size(batteryMeter, 100, 200); lv_obj_center(batteryMeter); lv_bar_set_range(batteryMeter, 0, 100); uiBatteryVolts = lv_label_create(uiMenuBattery); lv_obj_set_width(uiBatteryVolts, 150); lv_label_set_text(uiBatteryVolts, "-.-- v"); lv_obj_align(uiBatteryVolts, LV_ALIGN_RIGHT_MID, 0, 0); lv_obj_set_style_text_align(uiBatteryVolts, LV_TEXT_ALIGN_RIGHT, 0); lv_obj_set_style_text_font(uiBatteryVolts, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT); uiBatteryPercent = lv_label_create(uiMenuBattery); lv_obj_set_width(uiBatteryPercent, 150); lv_label_set_text(uiBatteryPercent, ""); lv_obj_align(uiBatteryPercent, LV_ALIGN_LEFT_MID, 10, 0); lv_obj_set_style_text_align(uiBatteryPercent, LV_TEXT_ALIGN_LEFT, 0); lv_obj_set_style_text_font(uiBatteryPercent, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT); } void Menu::update_battery(String info) { int delimiterIdx = info.indexOf(","); if (delimiterIdx < 1) { return; } String _volt = info.substring(0, delimiterIdx); String _percent = info.substring(delimiterIdx + 1, info.length()); xSemaphoreTake(_display->get_mutex(), portMAX_DELAY); lv_bar_set_value(batteryMeter, _percent.toInt(), LV_ANIM_ON); _percent += " %"; lv_label_set_text(uiBatteryPercent, _percent.c_str()); _volt += " v"; lv_label_set_text(uiBatteryVolts, _volt.c_str()); xSemaphoreGive(_display->get_mutex()); } void Menu::ui_menu_sdcard() { uiMenuSDCard = lv_obj_create(_uiRoot); lv_obj_add_flag(uiMenuSDCard, LV_OBJ_FLAG_HIDDEN); lv_obj_set_size(uiMenuSDCard, DISPLAY_WIDTH - 100, DISPLAY_HEIGHT - 40); lv_obj_align(uiMenuSDCard, LV_ALIGN_TOP_MID, 0, 20); lv_obj_t *titleLabel = lv_label_create(uiMenuSDCard); lv_label_set_text(titleLabel, "SDCARD " LV_SYMBOL_SD_CARD); lv_obj_set_style_text_font(titleLabel, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_align(titleLabel, LV_ALIGN_TOP_LEFT, 0, 0); uiMenuCloseBtn = lv_btn_create(uiMenuSDCard); lv_obj_set_size(uiMenuCloseBtn, 30, 30); lv_obj_align(uiMenuCloseBtn, LV_ALIGN_TOP_RIGHT, 0, -10); lv_obj_add_event_cb(uiMenuCloseBtn, menu_event_handler_thunk, LV_EVENT_CLICKED, NULL); lv_obj_t *btnSymbol = lv_label_create(uiMenuCloseBtn); lv_label_set_text(btnSymbol, LV_SYMBOL_CLOSE); lv_obj_center(btnSymbol); uiArc = lv_arc_create(uiMenuSDCard); lv_obj_set_size(uiArc, 150, 150); lv_arc_set_rotation(uiArc, 135); lv_arc_set_bg_angles(uiArc, 0, 270); lv_arc_set_value(uiArc, 0); lv_obj_center(uiArc); lv_obj_clear_flag(uiArc, LV_OBJ_FLAG_CLICKABLE); uiUsedBytes = lv_label_create(uiMenuSDCard); lv_obj_set_width(uiUsedBytes, 150); lv_label_set_text(uiUsedBytes, ""); lv_obj_align(uiUsedBytes, LV_ALIGN_LEFT_MID, 10, 0); lv_obj_set_style_text_align(uiUsedBytes, LV_TEXT_ALIGN_LEFT, 0); lv_obj_set_style_text_font(uiUsedBytes, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT); uiTotalBytes = lv_label_create(uiMenuSDCard); lv_obj_set_width(uiTotalBytes, 150); lv_label_set_text(uiTotalBytes, ""); lv_obj_align(uiTotalBytes, LV_ALIGN_RIGHT_MID, 0, 0); lv_obj_set_style_text_align(uiTotalBytes, LV_TEXT_ALIGN_RIGHT, 0); lv_obj_set_style_text_font(uiTotalBytes, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT); uiPercentage = lv_label_create(uiMenuSDCard); lv_obj_set_width(uiPercentage, 150); lv_label_set_text(uiPercentage, ""); lv_obj_center(uiPercentage); lv_obj_set_style_text_align(uiPercentage, LV_TEXT_ALIGN_CENTER, 0); lv_obj_set_style_text_font(uiPercentage, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT); } void Menu::get_sdcard_info() { unsigned long totalBytes; unsigned long usedBytes; _system->sdcard_info(&totalBytes, &usedBytes); float percentage = usedBytes / totalBytes * 100; String strPercentage = String(percentage); strPercentage += "%"; lv_arc_set_value(uiArc, int(percentage)); lv_label_set_text(uiPercentage, strPercentage.c_str()); String strDummy = "Total:\n"; strDummy += String(totalBytes); strDummy += "\nMB"; lv_label_set_text(uiTotalBytes, strDummy.c_str()); strDummy = "Used:\n"; strDummy += String(usedBytes); strDummy += "\nMB"; lv_label_set_text(uiUsedBytes, strDummy.c_str()); } void Menu::open_menu_sdcard() { if (!_system->is_SDcard_available()) { _display->ui_popup_open("Oops!", "Check Your SD Card."); return; } this->get_sdcard_info(); lv_obj_clear_flag(uiMenuSDCard, LV_OBJ_FLAG_HIDDEN); }
16,031
ESP32Berry_Menu
cpp
en
cpp
code
{"qsc_code_num_words": 2346, "qsc_code_num_chars": 16031.0, "qsc_code_mean_word_length": 4.64705882, "qsc_code_frac_words_unique": 0.11935209, "qsc_code_frac_chars_top_2grams": 0.07659145, "qsc_code_frac_chars_top_3grams": 0.02494955, "qsc_code_frac_chars_top_4grams": 0.02889378, "qsc_code_frac_chars_dupe_5grams": 0.55411851, "qsc_code_frac_chars_dupe_6grams": 0.47936159, "qsc_code_frac_chars_dupe_7grams": 0.39506513, "qsc_code_frac_chars_dupe_8grams": 0.36296092, "qsc_code_frac_chars_dupe_9grams": 0.30187122, "qsc_code_frac_chars_dupe_10grams": 0.25600807, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01704871, "qsc_code_frac_chars_whitespace": 0.1291872, "qsc_code_size_file_byte": 16031.0, "qsc_code_num_lines": 430.0, "qsc_code_num_chars_line_max": 133.0, "qsc_code_num_chars_line_mean": 37.28139535, "qsc_code_frac_chars_alphabet": 0.76389685, "qsc_code_frac_chars_comments": 0.01684237, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.19373219, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.002849, "qsc_code_frac_chars_string_length": 0.01839868, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codecpp_frac_lines_preprocessor_directives": 0.002849, "qsc_codecpp_frac_lines_func_ratio": 0.00854701, "qsc_codecpp_cate_bitsstdc": 0.0, "qsc_codecpp_nums_lines_main": 0.0, "qsc_codecpp_frac_lines_goto": 0.0, "qsc_codecpp_cate_var_zero": 0.0, "qsc_codecpp_score_lines_no_logic": 0.01994302, "qsc_codecpp_frac_lines_print": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codecpp_frac_lines_func_ratio": 0, "qsc_codecpp_nums_lines_main": 0, "qsc_codecpp_score_lines_no_logic": 0, "qsc_codecpp_frac_lines_preprocessor_directives": 0, "qsc_codecpp_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_System.cpp
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #include "ESP32Berry_System.h" System::System(FuncPtrString callback) { fetchTimer = 0; currentTime = ""; isSDCardAvailable = false; requestedTimeUpdate = false; system_event_cb = callback; batteryTimer = 0; } System::~System() {} void System::set_config_tz_time() { const char* ntpServer0 = "time1.google.com"; const char* ntpServer1 = "pool.ntp.org"; const char* ntpServer2 = "time.nist.gov"; esp_netif_init(); if (sntp_enabled()) { sntp_stop(); } sntp_setoperatingmode(SNTP_OPMODE_POLL); sntp_setservername(0, (char*)ntpServer0); sntp_setservername(1, (char*)ntpServer1); sntp_setservername(2, (char*)ntpServer2); sntp_init(); setenv("TZ", TIME_ZONE, 1); tzset(); requestedTimeUpdate = true; } void System::update_local_time() { if (!requestedTimeUpdate) return; if (fetchTimer == 0 || millis() - fetchTimer >= TIME_UPDATE_INTERVAL) { fetchTimer = millis(); struct tm timeinfo; if (!getLocalTime(&timeinfo)) { return; } char hourMin[24]; strftime(hourMin, 24, "%a %H:%M\n%D", &timeinfo); currentTime = String(hourMin); system_event_cb(SYS_TIME, currentTime); } } String System::get_local_time_for_msg() { struct tm timeinfo; if (!getLocalTime(&timeinfo)) { return ""; } char dateTime[10]; strftime(dateTime, 10, "%T", &timeinfo); return String(dateTime); } bool System::init_SDCard() { if (!SD.begin(5)) { return false; } uint8_t cardType = SD.cardType(); if (cardType == CARD_NONE) { return false; } isSDCardAvailable = true; return true; } std::vector<String> System::list_dir(const char* dirname) { std::vector<String> fileList; File root = storage.open(dirname); if (!root) { return fileList; } if (!root.isDirectory()) { return fileList; } File file = root.openNextFile(); while (file) { char fileInfo[128]; snprintf(fileInfo, sizeof(fileInfo), "%s (%d bytes)", file.name(), file.size()); fileList.push_back(String(fileInfo)); file = root.openNextFile(); } return fileList; } bool System::create_dir(const char* path) { if (storage.exists(path)) { return true; } if (storage.mkdir(path)) { return true; } else { return false; } } bool System::write_file(const char* path, const char* message) { File file = storage.open(path, FILE_WRITE); if (!file) { file.close(); return false; } if (!file.print(message)) { file.close(); return false; } file.close(); return true; } int System::read_file_size(const char* path) { File file = storage.open(path, FILE_READ); if (!file) { file.close(); return 0; } return file.size(); } String System::read_file(const char* path) { File file = storage.open(path, FILE_READ); if (!file) { file.close(); return ""; } String temp = ""; while (file.available()) { temp += file.readStringUntil('\n'); } file.close(); return temp; } void System::sdcard_info(unsigned long* totalBytes, unsigned long* usedBytes) { *totalBytes = SD.totalBytes() / (1024 * 1024); *usedBytes = SD.usedBytes() / (1024 * 1024); } bool System::is_SDcard_available() { return isSDCardAvailable; } void System::read_battery() { if (millis() - batteryTimer >= 1000) { batteryTimer = millis(); int totalValue = 0; int averageValue = 0; for (int i = 0; i < BAT_READS; i++) { totalValue += analogRead(BAT_PIN); } averageValue = totalValue / BAT_READS; double batVolts = averageValue * BAT_CONV_FACTOR / 1000; if (batVolts > BAT_MAX_VOLT) { batVolts = BAT_MAX_VOLT; } int batPercent = map(batVolts * 100, 320, 420, 0, 100); if (batPercent < 0) { return; } String batData = String(batVolts); batData += ","; batData += String(batPercent); system_event_cb(SYS_BATTERY, batData); } } void System::update() { this->update_local_time(); this->read_battery(); } void System::restart() { ESP.restart(); }
4,270
ESP32Berry_System
cpp
en
cpp
code
{"qsc_code_num_words": 488, "qsc_code_num_chars": 4270.0, "qsc_code_mean_word_length": 5.30942623, "qsc_code_frac_words_unique": 0.33811475, "qsc_code_frac_chars_top_2grams": 0.03126206, "qsc_code_frac_chars_top_3grams": 0.03473562, "qsc_code_frac_chars_top_4grams": 0.02199923, "qsc_code_frac_chars_dupe_5grams": 0.10575068, "qsc_code_frac_chars_dupe_6grams": 0.0976457, "qsc_code_frac_chars_dupe_7grams": 0.08722501, "qsc_code_frac_chars_dupe_8grams": 0.08722501, "qsc_code_frac_chars_dupe_9grams": 0.05017368, "qsc_code_frac_chars_dupe_10grams": 0.05017368, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02228086, "qsc_code_frac_chars_whitespace": 0.20117096, "qsc_code_size_file_byte": 4270.0, "qsc_code_num_lines": 201.0, "qsc_code_num_chars_line_max": 85.0, "qsc_code_num_chars_line_mean": 21.24378109, "qsc_code_frac_chars_alphabet": 0.73732043, "qsc_code_frac_chars_comments": 0.06323185, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.19375, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.02299425, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codecpp_frac_lines_preprocessor_directives": 0.01875, "qsc_codecpp_frac_lines_func_ratio": 0.00625, "qsc_codecpp_cate_bitsstdc": 0.0, "qsc_codecpp_nums_lines_main": 0.0, "qsc_codecpp_frac_lines_goto": 0.0, "qsc_codecpp_cate_var_zero": 0.0, "qsc_codecpp_score_lines_no_logic": 0.13125, "qsc_codecpp_frac_lines_print": 0.00625}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codecpp_frac_lines_func_ratio": 0, "qsc_codecpp_nums_lines_main": 0, "qsc_codecpp_score_lines_no_logic": 0, "qsc_codecpp_frac_lines_preprocessor_directives": 0, "qsc_codecpp_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_Display.cpp
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #include "ESP32Berry_Display.h" static Display *instance = NULL; static lv_disp_draw_buf_t draw_buf; static lv_color_t buf[DISPLAY_WIDTH * 10]; Display::Display(FuncPtrInt callback) { instance = this; tft = new LGFX(); app_event_cb = callback; uiTimer = 0; focusedObj = NULL; this->init_tft(); } Display::~Display() { delete tft; } void Display::init_tft() { tft->begin(); tft->setRotation(3); tft->fillScreen(TFT_BLACK); #ifdef ESP32BERRY uint16_t calData[] = { 239, 3926, 233, 265, 3856, 3896, 3714, 308 }; tft->setTouchCalibrate(calData); #endif this->init_lvgl(); this->init_keypad(); } #ifdef ESP32BERRY void callbackFromKeyPad(char key) { if (instance->focused_obj() == NULL) return; if (key == 8) { lv_textarea_del_char(instance->focused_obj()); } else if (key == 1) { lv_textarea_cursor_left(instance->focused_obj()); } else if (key == 2) { lv_textarea_cursor_down(instance->focused_obj()); } else if (key == 3) { lv_textarea_cursor_up(instance->focused_obj()); } else if (key == 4) { lv_textarea_cursor_right(instance->focused_obj()); } else { lv_textarea_add_char(instance->focused_obj(), key); } } #endif void Display::init_keypad() { #ifdef ESP32BERRY void (*ptr)(char) = &callbackFromKeyPad; keypad = new KeyPad(ptr); #else kb = lv_keyboard_create(uiRoot); lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN); #endif } void Display::my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) { uint32_t w = (area->x2 - area->x1 + 1); uint32_t h = (area->y2 - area->y1 + 1); tft->startWrite(); tft->setAddrWindow(area->x1, area->y1, w, h); tft->writePixels((lgfx::rgb565_t *)&color_p->full, w * h); tft->endWrite(); lv_disp_flush_ready(disp); } void Display::my_touch_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data) { uint16_t touchX, touchY; bool touched = tft->getTouch(&touchX, &touchY); if (!touched) { data->state = LV_INDEV_STATE_REL; } else { data->state = LV_INDEV_STATE_PR; data->point.x = touchX; data->point.y = touchY; } } void Display::btn_event_cb(lv_event_t *e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t *btn = lv_event_get_target(e); if (code == LV_EVENT_CLICKED) { if (btn == popupBoxCloseBtn) { lv_obj_add_flag(popupBox, LV_OBJ_FLAG_HIDDEN); } else if (btn == timeDataBtn) { if (lv_obj_has_flag(calendar, LV_OBJ_FLAG_HIDDEN)) { lv_obj_clear_flag(calendar, LV_OBJ_FLAG_HIDDEN); } else { lv_obj_add_flag(calendar, LV_OBJ_FLAG_HIDDEN); } } else if (btn == appNoteBtn) { app_event_cb(APP_Note, NULL); } else if (btn == appTelegramBtn) { app_event_cb(APP_Telegram, NULL); }else if (btn == appESPNOWBtn) { app_event_cb(APP_ESPNOW, NULL); } } } void Display::textarea_event_cb(lv_event_t *e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t *obj = lv_event_get_target(e); if (code == LV_EVENT_FOCUSED) { focusedObj = obj; #ifndef ESP32BERRY lv_keyboard_set_textarea(kb, obj); lv_obj_clear_flag(kb, LV_OBJ_FLAG_HIDDEN); lv_obj_move_foreground(kb); #endif } else if (code == LV_EVENT_DEFOCUSED) { focusedObj = NULL; #ifndef ESP32BERRY lv_keyboard_set_textarea(kb, NULL); lv_obj_add_flag(kb, LV_OBJ_FLAG_HIDDEN); #endif } } extern "C" void my_disp_flush_thunk(lv_disp_drv_t *drv, const lv_area_t *area, lv_color_t *color_p) { instance->my_disp_flush(drv, area, color_p); } extern "C" void my_touch_read_thunk(lv_indev_drv_t *indev_driver, lv_indev_data_t *data) { instance->my_touch_read(indev_driver, data); } extern "C" void btn_event_cb_thunk(lv_event_t *e) { instance->btn_event_cb(e); } extern "C" void textarea_event_cb_thunk(lv_event_t *e) { instance->textarea_event_cb(e); } extern "C" void anim_event_cb_thunk(void *var, int32_t v) { instance->anim_x_cb(var, v); } void Display::anim_x_cb(void *var, int32_t v) { lv_obj_set_x((lv_obj_t *)var, v); } void update_ui_task(void *pvParameters) { while (1) { if (xSemaphoreTake(instance->bin_sem, portMAX_DELAY) == pdTRUE) { lv_timer_handler(); #ifdef ESP32BERRY instance->keypad->checkKeyInput(); #endif xSemaphoreGive(instance->bin_sem); } vTaskDelay(5); } } void Display::init_lvgl() { lv_init(); lv_disp_draw_buf_init(&draw_buf, buf, NULL, DISPLAY_WIDTH * 10); static lv_disp_drv_t disp_drv; lv_disp_drv_init(&disp_drv); disp_drv.hor_res = DISPLAY_WIDTH; disp_drv.ver_res = DISPLAY_HEIGHT; disp_drv.flush_cb = my_disp_flush_thunk; disp_drv.draw_buf = &draw_buf; lv_disp_drv_register(&disp_drv); static lv_indev_drv_t indev_drv; lv_indev_drv_init(&indev_drv); indev_drv.type = LV_INDEV_TYPE_POINTER; indev_drv.read_cb = my_touch_read_thunk; lv_indev_drv_register(&indev_drv); lv_disp_t *disp = lv_disp_get_default(); lv_theme_t *th = lv_theme_default_init(disp, lv_color_hex(0xffa500), lv_color_hex(0xa9a9a9), false, &lv_font_montserrat_14); lv_disp_set_theme(disp, th); this->ui_style(); this->ui_main(); this->ui_apps(); this->ui_calendar(); this->ui_popup_box(); this->ui_noti(); bin_sem = xSemaphoreCreateMutex(); xTaskCreatePinnedToCore(update_ui_task, "update_ui_task", 10000, NULL, 10, NULL, 0); } void Display::ui_style() { lv_style_init(&titleStyle); lv_style_set_text_font(&titleStyle, &lv_font_montserrat_20); lv_style_init(&borderStyle); lv_style_set_border_width(&borderStyle, 0); lv_style_init(&notiStyle); lv_style_set_text_font(&notiStyle, &lv_font_montserrat_20); lv_style_set_border_width(&notiStyle, 2); lv_style_set_radius(&notiStyle, 8); lv_style_set_bg_color(&notiStyle, lv_color_black()); lv_style_set_text_color(&notiStyle, lv_color_white()); lv_style_set_outline_width(&notiStyle, 2); lv_style_set_outline_color(&notiStyle, lv_palette_main(LV_PALETTE_ORANGE)); lv_style_set_outline_pad(&notiStyle, 8); } void Display::ui_main() { uiRoot = lv_scr_act(); lv_obj_clear_flag(uiRoot, LV_OBJ_FLAG_SCROLLABLE); lv_obj_t *statusBar = lv_obj_create(uiRoot); lv_obj_set_size(statusBar, tft->width() - 50, 40); lv_obj_align(statusBar, LV_ALIGN_TOP_RIGHT, 0, 0); lv_obj_clear_flag(statusBar, LV_OBJ_FLAG_SCROLLABLE); batLabel = lv_label_create(statusBar); lv_obj_remove_style_all(batLabel); lv_label_set_text(batLabel, "100% " LV_SYMBOL_BATTERY_FULL); lv_obj_set_style_text_align(batLabel, LV_TEXT_ALIGN_CENTER, 0); lv_obj_align(batLabel, LV_ALIGN_RIGHT_MID, 0, 0); networkIcon = lv_label_create(statusBar); lv_obj_remove_style_all(networkIcon); lv_label_set_text(networkIcon, LV_SYMBOL_WARNING); lv_obj_set_style_text_align(networkIcon, LV_TEXT_ALIGN_CENTER, 0); lv_obj_align_to(networkIcon, batLabel, LV_ALIGN_OUT_LEFT_MID, -10, 0); timeDataBtn = lv_btn_create(statusBar); lv_obj_remove_style_all(timeDataBtn); lv_obj_set_size(timeDataBtn, 100, 40); lv_obj_align_to(timeDataBtn, networkIcon, LV_ALIGN_OUT_LEFT_MID, -10, 0); lv_obj_add_event_cb(timeDataBtn, btn_event_cb_thunk, LV_EVENT_CLICKED, NULL); lv_obj_clear_flag(timeDataBtn, LV_OBJ_FLAG_CLICKABLE); timeDataLabel = lv_label_create(timeDataBtn); lv_obj_remove_style_all(timeDataLabel); lv_obj_set_size(timeDataLabel, 90, 30); lv_label_set_text(timeDataLabel, ""); lv_obj_set_style_text_align(timeDataLabel, LV_TEXT_ALIGN_RIGHT, 0); lv_obj_center(timeDataLabel); bodyScreen = lv_obj_create(uiRoot); lv_obj_add_style(bodyScreen, &borderStyle, 0); lv_obj_set_size(bodyScreen, tft->width(), tft->height() - 40); lv_obj_align(bodyScreen, LV_ALIGN_BOTTOM_MID, 0, 0); lv_obj_clear_flag(bodyScreen, LV_OBJ_FLAG_SCROLLABLE); LV_IMG_DECLARE(ESP32Berry_BG); lv_obj_t *bg = lv_img_create(bodyScreen); lv_obj_remove_style_all(bg); lv_img_set_src(bg, &ESP32Berry_BG); lv_obj_center(bg); lv_obj_clear_flag(bodyScreen, LV_OBJ_FLAG_SCROLLABLE); } void Display::ui_calendar() { calendar = lv_calendar_create(bodyScreen); lv_obj_set_size(calendar, tft->height() - 50, tft->height() - 50); lv_obj_align(calendar, LV_ALIGN_TOP_RIGHT, 10, -10); lv_obj_add_flag(calendar, LV_OBJ_FLAG_HIDDEN); } void Display::ui_apps() { lv_obj_t *icon_frame = lv_obj_create(bodyScreen); lv_obj_set_size(icon_frame, 80, 80); lv_obj_align(icon_frame, LV_ALIGN_TOP_LEFT, 12, 8); lv_obj_add_style(icon_frame, &borderStyle, 0); lv_obj_clear_flag(icon_frame, LV_OBJ_FLAG_SCROLLABLE); LV_IMG_DECLARE(ESP32Berry_Icon_Note); appNoteBtn = lv_imgbtn_create(icon_frame); lv_obj_set_size(appNoteBtn, 64, 64); lv_imgbtn_set_src(appNoteBtn, LV_IMGBTN_STATE_RELEASED, &ESP32Berry_Icon_Note, NULL, NULL); lv_obj_align(appNoteBtn, LV_ALIGN_CENTER, 0, -8); lv_obj_add_event_cb(appNoteBtn, btn_event_cb_thunk, LV_EVENT_CLICKED, NULL); lv_obj_t *appTitle = lv_label_create(icon_frame); lv_label_set_text(appTitle, "Note"); lv_obj_align(appTitle, LV_ALIGN_BOTTOM_MID, 0, 12); lv_obj_t *icon_frame2 = lv_obj_create(bodyScreen); lv_obj_set_size(icon_frame2, 80, 80); lv_obj_align_to(icon_frame2, icon_frame, LV_ALIGN_OUT_RIGHT_MID, 36, 0); lv_obj_add_style(icon_frame2, &borderStyle, 0); lv_obj_clear_flag(icon_frame2, LV_OBJ_FLAG_SCROLLABLE); LV_IMG_DECLARE(ESP32Berry_Icon_Telegram); appTelegramBtn = lv_imgbtn_create(icon_frame2); lv_obj_set_size(appTelegramBtn, 64, 64); lv_imgbtn_set_src(appTelegramBtn, LV_IMGBTN_STATE_RELEASED, &ESP32Berry_Icon_Telegram, NULL, NULL); lv_obj_align(appTelegramBtn, LV_ALIGN_CENTER, 0, -8); lv_obj_add_event_cb(appTelegramBtn, btn_event_cb_thunk, LV_EVENT_CLICKED, NULL); appTitle = lv_label_create(icon_frame2); lv_label_set_text(appTitle, "Telegram"); lv_obj_align(appTitle, LV_ALIGN_BOTTOM_MID, 0, 12); lv_obj_t *icon_frame3 = lv_obj_create(bodyScreen); lv_obj_set_size(icon_frame3, 80, 80); lv_obj_align_to(icon_frame3, icon_frame2, LV_ALIGN_OUT_RIGHT_MID, 36, 0); lv_obj_add_style(icon_frame3, &borderStyle, 0); lv_obj_clear_flag(icon_frame3, LV_OBJ_FLAG_SCROLLABLE); LV_IMG_DECLARE(ESP32Berry_Icon_ESPNow); appESPNOWBtn = lv_imgbtn_create(icon_frame3); lv_obj_set_size(appESPNOWBtn, 64, 64); lv_imgbtn_set_src(appESPNOWBtn, LV_IMGBTN_STATE_RELEASED, &ESP32Berry_Icon_ESPNow, NULL, NULL); lv_obj_align(appESPNOWBtn, LV_ALIGN_CENTER, 0, -8); lv_obj_add_event_cb(appESPNOWBtn, btn_event_cb_thunk, LV_EVENT_CLICKED, NULL); appTitle = lv_label_create(icon_frame3); lv_label_set_text(appTitle, "ESP-NOW"); lv_obj_align(appTitle, LV_ALIGN_BOTTOM_MID, 0, 12); } void Display::ui_popup_box() { popupBox = lv_obj_create(uiRoot); lv_obj_set_size(popupBox, tft->width() * 2 / 3, tft->height() / 2); lv_obj_center(popupBox); lv_obj_add_flag(popupBox, LV_OBJ_FLAG_HIDDEN); } void Display::ui_popup_open(String title, String msg) { lv_obj_clear_flag(popupBox, LV_OBJ_FLAG_HIDDEN); lv_obj_clean(popupBox); LV_IMG_DECLARE(ESP32Berry_Icon); lv_obj_t *logo = lv_img_create(popupBox); lv_img_set_src(logo, &ESP32Berry_Icon); lv_obj_set_size(logo, 40, 40); lv_obj_align(logo, LV_ALIGN_TOP_RIGHT, -8, 4); lv_obj_t *popupTitle = lv_label_create(popupBox); lv_obj_add_style(popupTitle, &titleStyle, 0); lv_label_set_text(popupTitle, title.c_str()); lv_obj_set_width(popupTitle, tft->width() * 2 / 3 - 50); lv_obj_align(popupTitle, LV_ALIGN_TOP_LEFT, 0, 0); lv_obj_t *popupMSG = lv_label_create(popupBox); lv_obj_set_width(popupMSG, tft->width() * 2 / 3 - 50); lv_label_set_text(popupMSG, msg.c_str()); lv_obj_align(popupMSG, LV_ALIGN_TOP_LEFT, 0, 40); popupBoxCloseBtn = lv_btn_create(popupBox); lv_obj_add_event_cb(popupBoxCloseBtn, btn_event_cb_thunk, LV_EVENT_ALL, NULL); lv_obj_align(popupBoxCloseBtn, LV_ALIGN_BOTTOM_RIGHT, 0, 0); lv_obj_t *btnLabel = lv_label_create(popupBoxCloseBtn); lv_label_set_text(btnLabel, "OK"); lv_obj_center(btnLabel); } void Display::show_loading_popup(bool isOn) { if (isOn) { popupLoading = lv_obj_create(uiRoot); lv_obj_set_size(popupLoading, 120, 140); lv_obj_t *loading_spinner = lv_spinner_create(popupLoading, 1000, 60); lv_obj_set_size(loading_spinner, 80, 80); lv_obj_align(loading_spinner, LV_ALIGN_TOP_MID, 0, 0); lv_obj_t *loading_label = lv_label_create(popupLoading); lv_label_set_text(loading_label, "Loading..."); lv_obj_align(loading_label, LV_ALIGN_BOTTOM_MID, 0, 0); lv_obj_center(popupLoading); } else { if (popupLoading != NULL) { xSemaphoreTake(bin_sem, portMAX_DELAY); lv_obj_del(popupLoading); xSemaphoreGive(bin_sem); popupLoading = NULL; } } } void Display::set_wifi_icon(bool isConnected) { lv_label_set_text(networkIcon, isConnected ? LV_SYMBOL_WIFI : LV_SYMBOL_MINUS); } void Display::ui_noti() { notiBtn = lv_btn_create(lv_scr_act()); lv_obj_set_size(notiBtn, DISPLAY_WIDTH / 2, 60); lv_obj_align(notiBtn, LV_ALIGN_OUT_TOP_RIGHT, 20, 50); lv_obj_add_style(notiBtn, &notiStyle, 0); notiLabel = lv_label_create(notiBtn); lv_label_set_long_mode(notiLabel, LV_LABEL_LONG_WRAP); lv_label_set_text(notiLabel, "Welcome Back!"); lv_obj_set_size(notiLabel, DISPLAY_WIDTH / 2, 60); lv_obj_align(notiLabel, LV_ALIGN_LEFT_MID, 2, 4); ui_noti_anim(); } void Display::ui_noti_anim() { lv_obj_move_foreground(notiBtn); lv_anim_t a; lv_anim_init(&a); lv_anim_set_var(&a, notiBtn); lv_anim_set_values(&a, 20, 50); lv_anim_set_time(&a, 800); lv_anim_set_playback_delay(&a, 1200); lv_anim_set_playback_time(&a, 300); lv_anim_set_path_cb(&a, lv_anim_path_ease_in_out); lv_anim_set_exec_cb(&a, anim_event_cb_thunk); lv_anim_set_values(&a, DISPLAY_WIDTH + 50, DISPLAY_WIDTH / 2); lv_anim_start(&a); } void Display::launch_noti(String msg) { lv_label_set_text(notiLabel, msg.c_str()); ui_noti_anim(); } void Display::update_time(String time) { lv_label_set_text(timeDataLabel, time.c_str()); if (!lv_obj_has_flag(timeDataBtn, LV_OBJ_FLAG_CLICKABLE)) { lv_obj_add_flag(timeDataBtn, LV_OBJ_FLAG_CLICKABLE); } int year = time.substring(time.length() - 2, time.length()).toInt() + 2000; int day = time.substring(time.length() - 5, time.length() - 3).toInt(); int month = time.substring(time.length() - 8, time.length() - 6).toInt(); lv_calendar_set_today_date(calendar, year, month, day); lv_calendar_set_showed_date(calendar, year, month); } void Display::update_battery(String info) { int delimiterIdx = info.indexOf(","); if (delimiterIdx < 1) { return; } String _percent = info.substring(delimiterIdx + 1, info.length()); xSemaphoreTake(bin_sem, portMAX_DELAY); _percent += "% "; _percent += add_battery_icon(_percent.toInt()); lv_label_set_text(batLabel, _percent.c_str()); xSemaphoreGive(bin_sem); } String Display::add_battery_icon(int percentage) { if (percentage >= 90) { return String(LV_SYMBOL_BATTERY_FULL); } else if (percentage >= 65 && percentage < 90) { return String(LV_SYMBOL_BATTERY_3); } else if (percentage >= 40 && percentage < 65) { return String(LV_SYMBOL_BATTERY_2); } else if (percentage >= 15 && percentage < 40) { return String(LV_SYMBOL_BATTERY_1); } else { return String(LV_SYMBOL_BATTERY_EMPTY); } } lv_obj_t *Display::focused_obj() { return focusedObj; } void Display::set_focused_obj(lv_obj_t *obj) { focusedObj = obj; } lv_obj_t *Display::get_ui_root() { return uiRoot; } lv_obj_t *Display::get_body_screen() { return bodyScreen; } SemaphoreHandle_t Display::get_mutex() { return bin_sem; } LGFX * Display::get_lgfx() { return tft; }
16,079
ESP32Berry_Display
cpp
en
cpp
code
{"qsc_code_num_words": 2440, "qsc_code_num_chars": 16079.0, "qsc_code_mean_word_length": 4.30655738, "qsc_code_frac_words_unique": 0.13278689, "qsc_code_frac_chars_top_2grams": 0.06518843, "qsc_code_frac_chars_top_3grams": 0.01751047, "qsc_code_frac_chars_top_4grams": 0.01941378, "qsc_code_frac_chars_dupe_5grams": 0.39655501, "qsc_code_frac_chars_dupe_6grams": 0.28882756, "qsc_code_frac_chars_dupe_7grams": 0.20974496, "qsc_code_frac_chars_dupe_8grams": 0.15959269, "qsc_code_frac_chars_dupe_9grams": 0.13446898, "qsc_code_frac_chars_dupe_10grams": 0.0760373, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02492326, "qsc_code_frac_chars_whitespace": 0.14907644, "qsc_code_size_file_byte": 16079.0, "qsc_code_num_lines": 511.0, "qsc_code_num_chars_line_max": 102.0, "qsc_code_num_chars_line_mean": 31.46575342, "qsc_code_frac_chars_alphabet": 0.74309312, "qsc_code_frac_chars_comments": 0.01679209, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.09976247, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00575585, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00101202, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codecpp_frac_lines_preprocessor_directives": 0.03325416, "qsc_codecpp_frac_lines_func_ratio": 0.04038005, "qsc_codecpp_cate_bitsstdc": 0.0, "qsc_codecpp_nums_lines_main": 0.0, "qsc_codecpp_frac_lines_goto": 0.0, "qsc_codecpp_cate_var_zero": 0.0, "qsc_codecpp_score_lines_no_logic": 0.05700713, "qsc_codecpp_frac_lines_print": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codecpp_frac_lines_func_ratio": 0, "qsc_codecpp_nums_lines_main": 0, "qsc_codecpp_score_lines_no_logic": 0, "qsc_codecpp_frac_lines_preprocessor_directives": 0, "qsc_codecpp_frac_lines_print": 0}
00jacs/sveltekit-ultrafast
src/lib/components/page/pricing/simple-one-time.svelte
<script lang="ts"> import { Button } from '$lib/components'; import { Icon, Check } from 'svelte-hero-icons'; const whatsIncluded = [ 'Private forum access', 'Member resources', 'Entry to annual conference', 'Official member t-shirt' ]; </script> <div class="py-24 sm:py-32"> <div class="mx-auto max-w-7xl px-6 lg:px-8"> <div class="mx-auto max-w-2xl sm:text-center"> <h2 class="text-3xl font-bold tracking-tight sm:text-4xl"> Simple no-tricks pricing </h2> <!-- @DO: Use ChatGPT 4o to generate this text with a query like (once you explain your offer): Generate 1-3 interesting sentences about my product and my offer: ... --> <p class="mt-6 text-lg leading-8"> Distinctio et nulla eum soluta et neque labore quibusdam. Saepe et quasi iusto modi velit ut non voluptas in. Explicabo id ut laborum. </p> </div> <div class="mx-auto mt-16 max-w-2xl rounded-3xl ring-1 ring-base-200 sm:mt-20 lg:mx-0 lg:flex lg:max-w-none"> <div class="p-8 sm:p-10 lg:flex-auto"> <h3 class="text-2xl font-bold tracking-tight">Lifetime membership</h3> <!-- @DO: Use ChatGPT 4o to generate this text with one fitting your product and your offer. --> <p class="text-base-content-secondary mt-6 text-base leading-7"> Lorem ipsum dolor sit amet consect etur adipisicing elit. Itaque amet indis perferendis blanditiis repellendus etur quidem assumenda. </p> <div class="mt-10 flex items-center gap-x-4"> <h4 class="flex-none text-sm font-semibold leading-6 text-primary"> What’s included </h4> <div class="h-px flex-auto bg-base-200"></div> </div> <ul role="list" class="text-base-content-secondary mt-8 grid grid-cols-1 gap-4 text-sm leading-6 sm:grid-cols-2 sm:gap-6"> {#each whatsIncluded as benefit} <li class="flex gap-3"> <Icon src={Check} class="h-6 w-5 flex-none text-primary" /> {benefit} </li> {/each} </ul> </div> <div class="-mt-2 p-2 lg:mt-0 lg:w-full lg:max-w-md lg:flex-shrink-0"> <div class="rounded-2xl border border-base-300 py-10 text-center lg:flex lg:flex-col lg:justify-center lg:py-16"> <div class="mx-auto max-w-xs px-8"> <p class="text-base-content-secondary text-base font-semibold"> Pay once, own it forever </p> <p class="mt-6 flex items-baseline justify-center gap-x-2"> <span class="text-5xl font-bold tracking-tight">$349</span> <span class="text-base-content-secondary text-sm font-semibold leading-6 tracking-wide"> USD </span> </p> <Button type="submit" class="btn-primary mt-10 w-full">Get access</Button> <p class="text-base-content-secondary mt-6 text-xs leading-5"> Invoices and receipts available for easy company reimbursement </p> </div> </div> </div> </div> </div> </div>
2,980
simple-one-time
svelte
en
svelte
code
{"qsc_code_num_words": 470, "qsc_code_num_chars": 2980.0, "qsc_code_mean_word_length": 3.96382979, "qsc_code_frac_words_unique": 0.40212766, "qsc_code_frac_chars_top_2grams": 0.04294149, "qsc_code_frac_chars_top_3grams": 0.03488996, "qsc_code_frac_chars_top_4grams": 0.05367687, "qsc_code_frac_chars_dupe_5grams": 0.19538379, "qsc_code_frac_chars_dupe_6grams": 0.18572195, "qsc_code_frac_chars_dupe_7grams": 0.07836822, "qsc_code_frac_chars_dupe_8grams": 0.07836822, "qsc_code_frac_chars_dupe_9grams": 0.07836822, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.03454307, "qsc_code_frac_chars_whitespace": 0.23255034, "qsc_code_size_file_byte": 2980.0, "qsc_code_num_lines": 82.0, "qsc_code_num_chars_line_max": 114.0, "qsc_code_num_chars_line_mean": 36.34146341, "qsc_code_frac_chars_alphabet": 0.78006122, "qsc_code_frac_chars_comments": 0.76946309, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.34934498, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/lib/components/page/faq/faq-accordion.svelte
<script lang="ts"> const faq = [ { id: 0, question: 'Who is this boilerplate for?', answer: ` This boilerplate is for developers who want to build fast, modern web applications with SvelteKit, Tailwind CSS, and TypeScript who want to get started quickly and don't want to spend time setting up the project. ` }, { id: 1, question: 'Why sveltekit-ultrafast?', answer: ` sveltekit-ultrafast is a blazing fast SvelteKit template with Tailwind CSS and TypeScript. It is designed to help you build start-ups quickly and efficiently with built-in authentication (Supabase), PostgreSQL database (Supabase), payments (Stripe), analytics (Google Analytics), blog (Contentful), emails (MailGun), and a ready-to-go landing page. ` }, { id: 2, question: 'Why SvelteKit?', answer: `SvelteKit is a modern innovative framework for building web applications of all sizes, with a beautiful development experience and flexible filesystem-based routing. The performance is also much better than with other frameworks.` }, { id: 3, question: 'How do I get started?', answer: `You can get started by cloning the repository, reading the documentation, or by looking at the example pages.` } ] as const; let open = 0; </script> <div class="join join-vertical w-full"> {#each faq as { question, answer }, i} <div class="collapse join-item collapse-arrow border border-base-300"> <input type="radio" bind:group={open} value={i} class="l-0 absolute w-full" /> <div class="collapse-title font-semibold"> {question} </div> {#if open === i} <div class="text-base-content-secondary collapse-content"> <p>{answer}</p> </div> {/if} </div> {/each} </div>
1,906
faq-accordion
svelte
en
svelte
code
{"qsc_code_num_words": 243, "qsc_code_num_chars": 1906.0, "qsc_code_mean_word_length": 4.9382716, "qsc_code_frac_words_unique": 0.56790123, "qsc_code_frac_chars_top_2grams": 0.02666667, "qsc_code_frac_chars_top_3grams": 0.015, "qsc_code_frac_chars_top_4grams": 0.04, "qsc_code_frac_chars_dupe_5grams": 0.0, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00646088, "qsc_code_frac_chars_whitespace": 0.26915005, "qsc_code_size_file_byte": 1906.0, "qsc_code_num_lines": 54.0, "qsc_code_num_chars_line_max": 125.0, "qsc_code_num_chars_line_mean": 35.2962963, "qsc_code_frac_chars_alphabet": 0.85498923, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.11538462, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.13955929, "qsc_code_frac_chars_long_word_length": 0.01416579, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
007revad/Synology_Download_Station_Chrome_Extension
css/download-dialog.css
body { background-color: transparent; } #add-download textarea { resize: none; } .popover { z-index: 10000; } .folder-selection { position: relative; } .folder-selection.disabled { opacity: 0.4; } .folder-selection-overlay { display: none; width: 100%; height: 100%; position: absolute; z-index: 1; } .folder-selection.disabled .folder-selection-overlay { display: block; } .folderpath { border: 1px solid #ddd; margin-bottom: 0; border-bottom-right-radius: 0; border-bottom-left-radius: 0; } .folderpath li { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 35%; } .folderpath.breadcrumb>li+li:before { padding-left: 0; padding-right: 0; } .file-list { max-height: 195px; overflow-y: auto; border-style: solid; border-color: #ddd; border-width: 0 1px 1px 1px; border-radius: 0 0 4px 4px; margin-bottom: 20px; } .file-list .list-group { margin-bottom: 0; } .file-list .list-group-item { white-space: nowrap; border-left: none; border-right: none; } .file-list .list-group-item.editing { cursor: default; } .file-list .list-group-item:first-child { border-top: none; border-top-left-radius: 0; border-top-right-radius: 0; } .file-list .list-group-item:last-child { border-bottom: none; } .file-list .list-group-item .fa-folder-open-o { display: none;; } .file-list .list-group-item:not(.disabled):not(.editing):hover .fa-folder-o { display: none; } .file-list .list-group-item:not(.disabled):not(.editing):hover .fa-folder-open-o { display: inline-block; } .file-list .list-group-item .text-label { display: inline-block; max-width: 75%; overflow: hidden; text-overflow: ellipsis; line-height: 1; vertical-align: middle; } .file-list .list-group-item button { padding-top: 0; padding-bottom: 0; } .file-list .list-group-item .hover-button { display: none; } .file-list .list-group-item:hover .hover-button { display: inline-block; } .file-list .list-group-item input[type=text] { width: 75%; height: 22px; border: 1px solid #ccc; border-radius: 4px; background-color: #fff; color: #555; } .file-list .error-message { overflow: visible; text-overflow: ellipsis; white-space: normal; } .tooltip .tooltip-inner { background-color: #d9534f; white-space: normal; max-width: 250px; } .tooltip.top.tooltip-danger .tooltip-arrow { border-top-color: #d9534f; } .tooltip.right.tooltip-danger .tooltip-arrow { border-right-color: #d9534f; } .tooltip.bottom.tooltip-danger .tooltip-arrow { border-bottom-color: #d9534f; } .tooltip.left.tooltip-danger .tooltip-arrow { border-left-color: #d9534f; }
2,606
download-dialog
css
en
css
data
{"qsc_code_num_words": 362, "qsc_code_num_chars": 2606.0, "qsc_code_mean_word_length": 5.01933702, "qsc_code_frac_words_unique": 0.27071823, "qsc_code_frac_chars_top_2grams": 0.06604293, "qsc_code_frac_chars_top_3grams": 0.08585581, "qsc_code_frac_chars_top_4grams": 0.12162906, "qsc_code_frac_chars_dupe_5grams": 0.31095212, "qsc_code_frac_chars_dupe_6grams": 0.21023665, "qsc_code_frac_chars_dupe_7grams": 0.16510732, "qsc_code_frac_chars_dupe_8grams": 0.11667584, "qsc_code_frac_chars_dupe_9grams": 0.07374794, "qsc_code_frac_chars_dupe_10grams": 0.07374794, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.03334815, "qsc_code_frac_chars_whitespace": 0.13699156, "qsc_code_size_file_byte": 2606.0, "qsc_code_num_lines": 156.0, "qsc_code_num_chars_line_max": 83.0, "qsc_code_num_chars_line_mean": 16.70512821, "qsc_code_frac_chars_alphabet": 0.77456647, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.13492063, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_words_unique": 1, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0}
007revad/Synology_Download_Station_Chrome_Extension
css/hud.css
#dse-hud { width: 250px!important; height: 250px!important; background: rgba(100,100,100,0.7)!important; border-radius: 20px!important; position: fixed!important; bottom: -350px!important; left: 50%!important; margin: auto auto auto -125px!important; padding: 0!important; opacity: 0!important; visibility: hidden!important; transition: 0.2s!important; -webkit-transition: 0.2s!important; z-index: 10000!important; text-shadow: #000 0px 0px 2px!important; text-align: center!important; line-height: normal!important; font-size: auto!important; font-family: Helvetica, arial, sans-serif!important; color: #fff!important; } #dse-hud.visible { bottom: 100px!important; opacity: 1!important; visibility: visible!important; } #dse-message { position: absolute!important; box-sizing: border-box!important; bottom: 0px!important; width: 100%!important; padding: 10px!important; text-align: center!important; font-size: 15px!important; font-weight: normal!important; opacity: 0!important; visibility: hidden!important; transition: 0.1s!important; -webkit-transition: 0.1s!important; } #dse-message.visible { opacity: 1!important; visibility: visible!important; } #dse-icon { display: inline-block!important; width: 150px!important; height: 150px!important; background-size: 140px 140px!important; background-position: center center!important; background-repeat: no-repeat!important; margin-top: 20px!important; }
1,553
hud
css
en
css
data
{"qsc_code_num_words": 184, "qsc_code_num_chars": 1553.0, "qsc_code_mean_word_length": 5.96195652, "qsc_code_frac_words_unique": 0.38586957, "qsc_code_frac_chars_top_2grams": 0.06927985, "qsc_code_frac_chars_top_3grams": 0.03099362, "qsc_code_frac_chars_top_4grams": 0.04740201, "qsc_code_frac_chars_dupe_5grams": 0.25706472, "qsc_code_frac_chars_dupe_6grams": 0.19690064, "qsc_code_frac_chars_dupe_7grams": 0.19690064, "qsc_code_frac_chars_dupe_8grams": 0.11303555, "qsc_code_frac_chars_dupe_9grams": 0.11303555, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.05882353, "qsc_code_frac_chars_whitespace": 0.16806182, "qsc_code_size_file_byte": 1553.0, "qsc_code_num_lines": 59.0, "qsc_code_num_chars_line_max": 57.0, "qsc_code_num_chars_line_mean": 26.3220339, "qsc_code_frac_chars_alphabet": 0.79024768, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.18518519, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_words_unique": 1, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0}
007revad/Synology_Download_Station_Chrome_Extension
css/bootstrap.min.css
/*! * Bootstrap v3.3.4 (http://getbootstrap.com) * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) *//*! normalize.css v3.0.2 | MIT License | git.io/normalize */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{margin:.67em 0;font-size:2em}mark{color:#000;background:#ff0}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{height:0;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{margin:0;font:inherit;color:inherit}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid silver}legend{padding:0;border:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-spacing:0;border-collapse:collapse}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:after,:before{color:#000!important;text-shadow:none!important;background:0 0!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}@font-face{font-family:'Glyphicons Halflings';src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format('embedded-opentype'),url(../fonts/glyphicons-halflings-regular.woff2) format('woff2'),url(../fonts/glyphicons-halflings-regular.woff) format('woff'),url(../fonts/glyphicons-halflings-regular.ttf) format('truetype'),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-eur:before,.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.glyphicon-cd:before{content:"\e201"}.glyphicon-save-file:before{content:"\e202"}.glyphicon-open-file:before{content:"\e203"}.glyphicon-level-up:before{content:"\e204"}.glyphicon-copy:before{content:"\e205"}.glyphicon-paste:before{content:"\e206"}.glyphicon-alert:before{content:"\e209"}.glyphicon-equalizer:before{content:"\e210"}.glyphicon-king:before{content:"\e211"}.glyphicon-queen:before{content:"\e212"}.glyphicon-pawn:before{content:"\e213"}.glyphicon-bishop:before{content:"\e214"}.glyphicon-knight:before{content:"\e215"}.glyphicon-baby-formula:before{content:"\e216"}.glyphicon-tent:before{content:"\26fa"}.glyphicon-blackboard:before{content:"\e218"}.glyphicon-bed:before{content:"\e219"}.glyphicon-apple:before{content:"\f8ff"}.glyphicon-erase:before{content:"\e221"}.glyphicon-hourglass:before{content:"\231b"}.glyphicon-lamp:before{content:"\e223"}.glyphicon-duplicate:before{content:"\e224"}.glyphicon-piggy-bank:before{content:"\e225"}.glyphicon-scissors:before{content:"\e226"}.glyphicon-bitcoin:before{content:"\e227"}.glyphicon-btc:before{content:"\e227"}.glyphicon-xbt:before{content:"\e227"}.glyphicon-yen:before{content:"\00a5"}.glyphicon-jpy:before{content:"\00a5"}.glyphicon-ruble:before{content:"\20bd"}.glyphicon-rub:before{content:"\20bd"}.glyphicon-scale:before{content:"\e230"}.glyphicon-ice-lolly:before{content:"\e231"}.glyphicon-ice-lolly-tasted:before{content:"\e232"}.glyphicon-education:before{content:"\e233"}.glyphicon-option-horizontal:before{content:"\e234"}.glyphicon-option-vertical:before{content:"\e235"}.glyphicon-menu-hamburger:before{content:"\e236"}.glyphicon-modal-window:before{content:"\e237"}.glyphicon-oil:before{content:"\e238"}.glyphicon-grain:before{content:"\e239"}.glyphicon-sunglasses:before{content:"\e240"}.glyphicon-text-size:before{content:"\e241"}.glyphicon-text-color:before{content:"\e242"}.glyphicon-text-background:before{content:"\e243"}.glyphicon-object-align-top:before{content:"\e244"}.glyphicon-object-align-bottom:before{content:"\e245"}.glyphicon-object-align-horizontal:before{content:"\e246"}.glyphicon-object-align-left:before{content:"\e247"}.glyphicon-object-align-vertical:before{content:"\e248"}.glyphicon-object-align-right:before{content:"\e249"}.glyphicon-triangle-right:before{content:"\e250"}.glyphicon-triangle-left:before{content:"\e251"}.glyphicon-triangle-bottom:before{content:"\e252"}.glyphicon-triangle-top:before{content:"\e253"}.glyphicon-console:before{content:"\e254"}.glyphicon-superscript:before{content:"\e255"}.glyphicon-subscript:before{content:"\e256"}.glyphicon-menu-left:before{content:"\e257"}.glyphicon-menu-right:before{content:"\e258"}.glyphicon-menu-down:before{content:"\e259"}.glyphicon-menu-up:before{content:"\e260"}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:after,:before{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:10px;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.42857143;color:#333;background-color:#fff}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#337ab7;text-decoration:none}a:focus,a:hover{color:#23527c;text-decoration:underline}a:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}figure{margin:0}img{vertical-align:middle}.carousel-inner>.item>a>img,.carousel-inner>.item>img,.img-responsive,.thumbnail a>img,.thumbnail>img{display:block;max-width:100%;height:auto}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;max-width:100%;height:auto;padding:4px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}[role=button]{cursor:pointer}.h1,.h2,.h3,.h4,.h5,.h6,h1,h2,h3,h4,h5,h6{font-family:inherit;font-weight:500;line-height:1.1;color:inherit}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-weight:400;line-height:1;color:#777}.h1,.h2,.h3,h1,h2,h3{margin-top:20px;margin-bottom:10px}.h1 .small,.h1 small,.h2 .small,.h2 small,.h3 .small,.h3 small,h1 .small,h1 small,h2 .small,h2 small,h3 .small,h3 small{font-size:65%}.h4,.h5,.h6,h4,h5,h6{margin-top:10px;margin-bottom:10px}.h4 .small,.h4 small,.h5 .small,.h5 small,.h6 .small,.h6 small,h4 .small,h4 small,h5 .small,h5 small,h6 .small,h6 small{font-size:75%}.h1,h1{font-size:36px}.h2,h2{font-size:30px}.h3,h3{font-size:24px}.h4,h4{font-size:18px}.h5,h5{font-size:14px}.h6,h6{font-size:12px}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:300;line-height:1.4}@media (min-width:768px){.lead{font-size:21px}}.small,small{font-size:85%}.mark,mark{padding:.2em;background-color:#fcf8e3}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}.text-justify{text-align:justify}.text-nowrap{white-space:nowrap}.text-lowercase{text-transform:lowercase}.text-uppercase{text-transform:uppercase}.text-capitalize{text-transform:capitalize}.text-muted{color:#777}.text-primary{color:#337ab7}a.text-primary:hover{color:#286090}.text-success{color:#3c763d}a.text-success:hover{color:#2b542c}.text-info{color:#31708f}a.text-info:hover{color:#245269}.text-warning{color:#8a6d3b}a.text-warning:hover{color:#66512c}.text-danger{color:#a94442}a.text-danger:hover{color:#843534}.bg-primary{color:#fff;background-color:#337ab7}a.bg-primary:hover{background-color:#286090}.bg-success{background-color:#dff0d8}a.bg-success:hover{background-color:#c1e2b3}.bg-info{background-color:#d9edf7}a.bg-info:hover{background-color:#afd9ee}.bg-warning{background-color:#fcf8e3}a.bg-warning:hover{background-color:#f7ecb5}.bg-danger{background-color:#f2dede}a.bg-danger:hover{background-color:#e4b9b9}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ol,ul{margin-top:0;margin-bottom:10px}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;margin-left:-5px;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-top:0;margin-bottom:20px}dd,dt{line-height:1.42857143}dt{font-weight:700}dd{margin-left:0}@media (min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}}abbr[data-original-title],abbr[title]{cursor:help;border-bottom:1px dotted #777}.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;font-size:17.5px;border-left:5px solid #eee}blockquote ol:last-child,blockquote p:last-child,blockquote ul:last-child{margin-bottom:0}blockquote .small,blockquote footer,blockquote small{display:block;font-size:80%;line-height:1.42857143;color:#777}blockquote .small:before,blockquote footer:before,blockquote small:before{content:'\2014 \00A0'}.blockquote-reverse,blockquote.pull-right{padding-right:15px;padding-left:0;text-align:right;border-right:5px solid #eee;border-left:0}.blockquote-reverse .small:before,.blockquote-reverse footer:before,.blockquote-reverse small:before,blockquote.pull-right .small:before,blockquote.pull-right footer:before,blockquote.pull-right small:before{content:''}.blockquote-reverse .small:after,.blockquote-reverse footer:after,.blockquote-reverse small:after,blockquote.pull-right .small:after,blockquote.pull-right footer:after,blockquote.pull-right small:after{content:'\00A0 \2014'}address{margin-bottom:20px;font-style:normal;line-height:1.42857143}code,kbd,pre,samp{font-family:Menlo,Monaco,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;background-color:#f9f2f4;border-radius:4px}kbd{padding:2px 4px;font-size:90%;color:#fff;background-color:#333;border-radius:3px;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.25);box-shadow:inset 0 -1px 0 rgba(0,0,0,.25)}kbd kbd{padding:0;font-size:100%;font-weight:700;-webkit-box-shadow:none;box-shadow:none}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:768px){.container{width:750px}}@media (min-width:992px){.container{width:970px}}@media (min-width:1200px){.container{width:1170px}}.container-fluid{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{margin-right:-15px;margin-left:-15px}.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-10,.col-xs-11,.col-xs-12,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666667%}.col-xs-10{width:83.33333333%}.col-xs-9{width:75%}.col-xs-8{width:66.66666667%}.col-xs-7{width:58.33333333%}.col-xs-6{width:50%}.col-xs-5{width:41.66666667%}.col-xs-4{width:33.33333333%}.col-xs-3{width:25%}.col-xs-2{width:16.66666667%}.col-xs-1{width:8.33333333%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666667%}.col-xs-pull-10{right:83.33333333%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666667%}.col-xs-pull-7{right:58.33333333%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666667%}.col-xs-pull-4{right:33.33333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.66666667%}.col-xs-pull-1{right:8.33333333%}.col-xs-pull-0{right:auto}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666667%}.col-xs-push-10{left:83.33333333%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666667%}.col-xs-push-7{left:58.33333333%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666667%}.col-xs-push-4{left:33.33333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.66666667%}.col-xs-push-1{left:8.33333333%}.col-xs-push-0{left:auto}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666667%}.col-xs-offset-10{margin-left:83.33333333%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666667%}.col-xs-offset-7{margin-left:58.33333333%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666667%}.col-xs-offset-4{margin-left:33.33333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.66666667%}.col-xs-offset-1{margin-left:8.33333333%}.col-xs-offset-0{margin-left:0}@media (min-width:768px){.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666667%}.col-sm-10{width:83.33333333%}.col-sm-9{width:75%}.col-sm-8{width:66.66666667%}.col-sm-7{width:58.33333333%}.col-sm-6{width:50%}.col-sm-5{width:41.66666667%}.col-sm-4{width:33.33333333%}.col-sm-3{width:25%}.col-sm-2{width:16.66666667%}.col-sm-1{width:8.33333333%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666667%}.col-sm-pull-10{right:83.33333333%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666667%}.col-sm-pull-7{right:58.33333333%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666667%}.col-sm-pull-4{right:33.33333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.66666667%}.col-sm-pull-1{right:8.33333333%}.col-sm-pull-0{right:auto}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666667%}.col-sm-push-10{left:83.33333333%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666667%}.col-sm-push-7{left:58.33333333%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666667%}.col-sm-push-4{left:33.33333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.66666667%}.col-sm-push-1{left:8.33333333%}.col-sm-push-0{left:auto}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666667%}.col-sm-offset-10{margin-left:83.33333333%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666667%}.col-sm-offset-7{margin-left:58.33333333%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666667%}.col-sm-offset-4{margin-left:33.33333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.66666667%}.col-sm-offset-1{margin-left:8.33333333%}.col-sm-offset-0{margin-left:0}}@media (min-width:992px){.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666667%}.col-md-10{width:83.33333333%}.col-md-9{width:75%}.col-md-8{width:66.66666667%}.col-md-7{width:58.33333333%}.col-md-6{width:50%}.col-md-5{width:41.66666667%}.col-md-4{width:33.33333333%}.col-md-3{width:25%}.col-md-2{width:16.66666667%}.col-md-1{width:8.33333333%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666667%}.col-md-pull-10{right:83.33333333%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666667%}.col-md-pull-7{right:58.33333333%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666667%}.col-md-pull-4{right:33.33333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.66666667%}.col-md-pull-1{right:8.33333333%}.col-md-pull-0{right:auto}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666667%}.col-md-push-10{left:83.33333333%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666667%}.col-md-push-7{left:58.33333333%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666667%}.col-md-push-4{left:33.33333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.66666667%}.col-md-push-1{left:8.33333333%}.col-md-push-0{left:auto}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666667%}.col-md-offset-10{margin-left:83.33333333%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666667%}.col-md-offset-7{margin-left:58.33333333%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666667%}.col-md-offset-4{margin-left:33.33333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.66666667%}.col-md-offset-1{margin-left:8.33333333%}.col-md-offset-0{margin-left:0}}@media (min-width:1200px){.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666667%}.col-lg-10{width:83.33333333%}.col-lg-9{width:75%}.col-lg-8{width:66.66666667%}.col-lg-7{width:58.33333333%}.col-lg-6{width:50%}.col-lg-5{width:41.66666667%}.col-lg-4{width:33.33333333%}.col-lg-3{width:25%}.col-lg-2{width:16.66666667%}.col-lg-1{width:8.33333333%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666667%}.col-lg-pull-10{right:83.33333333%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666667%}.col-lg-pull-7{right:58.33333333%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666667%}.col-lg-pull-4{right:33.33333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.66666667%}.col-lg-pull-1{right:8.33333333%}.col-lg-pull-0{right:auto}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666667%}.col-lg-push-10{left:83.33333333%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666667%}.col-lg-push-7{left:58.33333333%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666667%}.col-lg-push-4{left:33.33333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.66666667%}.col-lg-push-1{left:8.33333333%}.col-lg-push-0{left:auto}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666667%}.col-lg-offset-10{margin-left:83.33333333%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666667%}.col-lg-offset-7{margin-left:58.33333333%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666667%}.col-lg-offset-4{margin-left:33.33333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.66666667%}.col-lg-offset-1{margin-left:8.33333333%}.col-lg-offset-0{margin-left:0}}table{background-color:transparent}caption{padding-top:8px;padding-bottom:8px;color:#777;text-align:left}th{text-align:left}.table{width:100%;max-width:100%;margin-bottom:20px}.table>tbody>tr>td,.table>tbody>tr>th,.table>tfoot>tr>td,.table>tfoot>tr>th,.table>thead>tr>td,.table>thead>tr>th{padding:8px;line-height:1.42857143;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>td,.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>td,.table>thead:first-child>tr:first-child>th{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>tbody>tr>td,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>td,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>thead>tr>th{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>tbody>tr>td,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>td,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border:1px solid #ddd}.table-bordered>thead>tr>td,.table-bordered>thead>tr>th{border-bottom-width:2px}.table-striped>tbody>tr:nth-of-type(odd){background-color:#f9f9f9}.table-hover>tbody>tr:hover{background-color:#f5f5f5}table col[class*=col-]{position:static;display:table-column;float:none}table td[class*=col-],table th[class*=col-]{position:static;display:table-cell;float:none}.table>tbody>tr.active>td,.table>tbody>tr.active>th,.table>tbody>tr>td.active,.table>tbody>tr>th.active,.table>tfoot>tr.active>td,.table>tfoot>tr.active>th,.table>tfoot>tr>td.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>thead>tr.active>th,.table>thead>tr>td.active,.table>thead>tr>th.active{background-color:#f5f5f5}.table-hover>tbody>tr.active:hover>td,.table-hover>tbody>tr.active:hover>th,.table-hover>tbody>tr:hover>.active,.table-hover>tbody>tr>td.active:hover,.table-hover>tbody>tr>th.active:hover{background-color:#e8e8e8}.table>tbody>tr.success>td,.table>tbody>tr.success>th,.table>tbody>tr>td.success,.table>tbody>tr>th.success,.table>tfoot>tr.success>td,.table>tfoot>tr.success>th,.table>tfoot>tr>td.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>thead>tr.success>th,.table>thead>tr>td.success,.table>thead>tr>th.success{background-color:#dff0d8}.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th,.table-hover>tbody>tr:hover>.success,.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover{background-color:#d0e9c6}.table>tbody>tr.info>td,.table>tbody>tr.info>th,.table>tbody>tr>td.info,.table>tbody>tr>th.info,.table>tfoot>tr.info>td,.table>tfoot>tr.info>th,.table>tfoot>tr>td.info,.table>tfoot>tr>th.info,.table>thead>tr.info>td,.table>thead>tr.info>th,.table>thead>tr>td.info,.table>thead>tr>th.info{background-color:#d9edf7}.table-hover>tbody>tr.info:hover>td,.table-hover>tbody>tr.info:hover>th,.table-hover>tbody>tr:hover>.info,.table-hover>tbody>tr>td.info:hover,.table-hover>tbody>tr>th.info:hover{background-color:#c4e3f3}.table>tbody>tr.warning>td,.table>tbody>tr.warning>th,.table>tbody>tr>td.warning,.table>tbody>tr>th.warning,.table>tfoot>tr.warning>td,.table>tfoot>tr.warning>th,.table>tfoot>tr>td.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>thead>tr.warning>th,.table>thead>tr>td.warning,.table>thead>tr>th.warning{background-color:#fcf8e3}.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th,.table-hover>tbody>tr:hover>.warning,.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover{background-color:#faf2cc}.table>tbody>tr.danger>td,.table>tbody>tr.danger>th,.table>tbody>tr>td.danger,.table>tbody>tr>th.danger,.table>tfoot>tr.danger>td,.table>tfoot>tr.danger>th,.table>tfoot>tr>td.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>thead>tr.danger>th,.table>thead>tr>td.danger,.table>thead>tr>th.danger{background-color:#f2dede}.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th,.table-hover>tbody>tr:hover>.danger,.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover{background-color:#ebcccc}.table-responsive{min-height:.01%;overflow-x:auto}@media screen and (max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-y:hidden;-ms-overflow-style:-ms-autohiding-scrollbar;border:1px solid #ddd}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>td,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>thead>tr>th{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;max-width:100%;margin-bottom:5px;font-weight:700}input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=checkbox],input[type=radio]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type=file]{display:block}input[type=range]{display:block;width:100%}select[multiple],select[size]{height:auto}input[type=file]:focus,input[type=checkbox]:focus,input[type=radio]:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}output{display:block;padding-top:7px;font-size:14px;line-height:1.42857143;color:#555}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.42857143;color:#555;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition:border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;-o-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.form-control::-moz-placeholder{color:#999;opacity:1}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{background-color:#eee;opacity:1}.form-control[disabled],fieldset[disabled] .form-control{cursor:not-allowed}textarea.form-control{height:auto}input[type=search]{-webkit-appearance:none}@media screen and (-webkit-min-device-pixel-ratio:0){input[type=date],input[type=time],input[type=datetime-local],input[type=month]{line-height:34px}.input-group-sm input[type=date],.input-group-sm input[type=time],.input-group-sm input[type=datetime-local],.input-group-sm input[type=month],input[type=date].input-sm,input[type=time].input-sm,input[type=datetime-local].input-sm,input[type=month].input-sm{line-height:30px}.input-group-lg input[type=date],.input-group-lg input[type=time],.input-group-lg input[type=datetime-local],.input-group-lg input[type=month],input[type=date].input-lg,input[type=time].input-lg,input[type=datetime-local].input-lg,input[type=month].input-lg{line-height:46px}}.form-group{margin-bottom:15px}.checkbox,.radio{position:relative;display:block;margin-top:10px;margin-bottom:10px}.checkbox label,.radio label{min-height:20px;padding-left:20px;margin-bottom:0;font-weight:400;cursor:pointer}.checkbox input[type=checkbox],.checkbox-inline input[type=checkbox],.radio input[type=radio],.radio-inline input[type=radio]{position:absolute;margin-top:4px \9;margin-left:-20px}.checkbox+.checkbox,.radio+.radio{margin-top:-5px}.checkbox-inline,.radio-inline{position:relative;display:inline-block;padding-left:20px;margin-bottom:0;font-weight:400;vertical-align:middle;cursor:pointer}.checkbox-inline+.checkbox-inline,.radio-inline+.radio-inline{margin-top:0;margin-left:10px}fieldset[disabled] input[type=checkbox],fieldset[disabled] input[type=radio],input[type=checkbox].disabled,input[type=checkbox][disabled],input[type=radio].disabled,input[type=radio][disabled]{cursor:not-allowed}.checkbox-inline.disabled,.radio-inline.disabled,fieldset[disabled] .checkbox-inline,fieldset[disabled] .radio-inline{cursor:not-allowed}.checkbox.disabled label,.radio.disabled label,fieldset[disabled] .checkbox label,fieldset[disabled] .radio label{cursor:not-allowed}.form-control-static{min-height:34px;padding-top:7px;padding-bottom:7px;margin-bottom:0}.form-control-static.input-lg,.form-control-static.input-sm{padding-right:0;padding-left:0}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}select[multiple].input-sm,textarea.input-sm{height:auto}.form-group-sm .form-control{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.form-group-sm .form-control{height:30px;line-height:30px}select[multiple].form-group-sm .form-control,textarea.form-group-sm .form-control{height:auto}.form-group-sm .form-control-static{height:30px;min-height:32px;padding:5px 10px;font-size:12px;line-height:1.5}.input-lg{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-lg{height:46px;line-height:46px}select[multiple].input-lg,textarea.input-lg{height:auto}.form-group-lg .form-control{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.form-group-lg .form-control{height:46px;line-height:46px}select[multiple].form-group-lg .form-control,textarea.form-group-lg .form-control{height:auto}.form-group-lg .form-control-static{height:46px;min-height:38px;padding:10px 16px;font-size:18px;line-height:1.3333333}.has-feedback{position:relative}.has-feedback .form-control{padding-right:42.5px}.form-control-feedback{position:absolute;top:0;right:0;z-index:2;display:block;width:34px;height:34px;line-height:34px;text-align:center;pointer-events:none}.input-lg+.form-control-feedback{width:46px;height:46px;line-height:46px}.input-sm+.form-control-feedback{width:30px;height:30px;line-height:30px}.has-success .checkbox,.has-success .checkbox-inline,.has-success .control-label,.has-success .help-block,.has-success .radio,.has-success .radio-inline,.has-success.checkbox label,.has-success.checkbox-inline label,.has-success.radio label,.has-success.radio-inline label{color:#3c763d}.has-success .form-control{border-color:#3c763d;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-success .form-control:focus{border-color:#2b542c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168}.has-success .input-group-addon{color:#3c763d;background-color:#dff0d8;border-color:#3c763d}.has-success .form-control-feedback{color:#3c763d}.has-warning .checkbox,.has-warning .checkbox-inline,.has-warning .control-label,.has-warning .help-block,.has-warning .radio,.has-warning .radio-inline,.has-warning.checkbox label,.has-warning.checkbox-inline label,.has-warning.radio label,.has-warning.radio-inline label{color:#8a6d3b}.has-warning .form-control{border-color:#8a6d3b;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-warning .form-control:focus{border-color:#66512c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b}.has-warning .input-group-addon{color:#8a6d3b;background-color:#fcf8e3;border-color:#8a6d3b}.has-warning .form-control-feedback{color:#8a6d3b}.has-error .checkbox,.has-error .checkbox-inline,.has-error .control-label,.has-error .help-block,.has-error .radio,.has-error .radio-inline,.has-error.checkbox label,.has-error.checkbox-inline label,.has-error.radio label,.has-error.radio-inline label{color:#a94442}.has-error .form-control{border-color:#a94442;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 1px rgba(0,0,0,.075)}.has-error .form-control:focus{border-color:#843534;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483}.has-error .input-group-addon{color:#a94442;background-color:#f2dede;border-color:#a94442}.has-error .form-control-feedback{color:#a94442}.has-feedback label~.form-control-feedback{top:25px}.has-feedback label.sr-only~.form-control-feedback{top:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media (min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block;width:auto;vertical-align:middle}.form-inline .form-control-static{display:inline-block}.form-inline .input-group{display:inline-table;vertical-align:middle}.form-inline .input-group .form-control,.form-inline .input-group .input-group-addon,.form-inline .input-group .input-group-btn{width:auto}.form-inline .input-group>.form-control{width:100%}.form-inline .control-label{margin-bottom:0;vertical-align:middle}.form-inline .checkbox,.form-inline .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.form-inline .checkbox label,.form-inline .radio label{padding-left:0}.form-inline .checkbox input[type=checkbox],.form-inline .radio input[type=radio]{position:relative;margin-left:0}.form-inline .has-feedback .form-control-feedback{top:0}}.form-horizontal .checkbox,.form-horizontal .checkbox-inline,.form-horizontal .radio,.form-horizontal .radio-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .checkbox,.form-horizontal .radio{min-height:27px}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.form-horizontal .control-label{padding-top:7px;margin-bottom:0;text-align:right}}.form-horizontal .has-feedback .form-control-feedback{right:15px}@media (min-width:768px){.form-horizontal .form-group-lg .control-label{padding-top:14.33px}}@media (min-width:768px){.form-horizontal .form-group-sm .control-label{padding-top:6px}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:400;line-height:1.42857143;text-align:center;white-space:nowrap;vertical-align:middle;-ms-touch-action:manipulation;touch-action:manipulation;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-image:none;border:1px solid transparent;border-radius:4px}.btn.active.focus,.btn.active:focus,.btn.focus,.btn:active.focus,.btn:active:focus,.btn:focus{outline:thin dotted;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.focus,.btn:focus,.btn:hover{color:#333;text-decoration:none}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{pointer-events:none;cursor:not-allowed;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none;opacity:.65}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default.active,.btn-default.focus,.btn-default:active,.btn-default:focus,.btn-default:hover,.open>.dropdown-toggle.btn-default{color:#333;background-color:#e6e6e6;border-color:#adadad}.btn-default.active,.btn-default:active,.open>.dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default.disabled.active,.btn-default.disabled.focus,.btn-default.disabled:active,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled],.btn-default[disabled].active,.btn-default[disabled].focus,.btn-default[disabled]:active,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default,fieldset[disabled] .btn-default.active,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:active,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#fff;border-color:#ccc}.btn-default .badge{color:#fff;background-color:#333}.btn-primary{color:#fff;background-color:#337ab7;border-color:#2e6da4}.btn-primary.active,.btn-primary.focus,.btn-primary:active,.btn-primary:focus,.btn-primary:hover,.open>.dropdown-toggle.btn-primary{color:#fff;background-color:#286090;border-color:#204d74}.btn-primary.active,.btn-primary:active,.open>.dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary.disabled.active,.btn-primary.disabled.focus,.btn-primary.disabled:active,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled],.btn-primary[disabled].active,.btn-primary[disabled].focus,.btn-primary[disabled]:active,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-primary.active,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:active,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#337ab7;border-color:#2e6da4}.btn-primary .badge{color:#337ab7;background-color:#fff}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success.active,.btn-success.focus,.btn-success:active,.btn-success:focus,.btn-success:hover,.open>.dropdown-toggle.btn-success{color:#fff;background-color:#449d44;border-color:#398439}.btn-success.active,.btn-success:active,.open>.dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success.disabled.active,.btn-success.disabled.focus,.btn-success.disabled:active,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled],.btn-success[disabled].active,.btn-success[disabled].focus,.btn-success[disabled]:active,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success,fieldset[disabled] .btn-success.active,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:active,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#5cb85c;border-color:#4cae4c}.btn-success .badge{color:#5cb85c;background-color:#fff}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info.active,.btn-info.focus,.btn-info:active,.btn-info:focus,.btn-info:hover,.open>.dropdown-toggle.btn-info{color:#fff;background-color:#31b0d5;border-color:#269abc}.btn-info.active,.btn-info:active,.open>.dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info.disabled.active,.btn-info.disabled.focus,.btn-info.disabled:active,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled],.btn-info[disabled].active,.btn-info[disabled].focus,.btn-info[disabled]:active,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info,fieldset[disabled] .btn-info.active,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:active,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#5bc0de;border-color:#46b8da}.btn-info .badge{color:#5bc0de;background-color:#fff}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning.active,.btn-warning.focus,.btn-warning:active,.btn-warning:focus,.btn-warning:hover,.open>.dropdown-toggle.btn-warning{color:#fff;background-color:#ec971f;border-color:#d58512}.btn-warning.active,.btn-warning:active,.open>.dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning.disabled.active,.btn-warning.disabled.focus,.btn-warning.disabled:active,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled],.btn-warning[disabled].active,.btn-warning[disabled].focus,.btn-warning[disabled]:active,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning,fieldset[disabled] .btn-warning.active,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:active,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#f0ad4e;border-color:#eea236}.btn-warning .badge{color:#f0ad4e;background-color:#fff}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger.active,.btn-danger.focus,.btn-danger:active,.btn-danger:focus,.btn-danger:hover,.open>.dropdown-toggle.btn-danger{color:#fff;background-color:#c9302c;border-color:#ac2925}.btn-danger.active,.btn-danger:active,.open>.dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger.disabled.active,.btn-danger.disabled.focus,.btn-danger.disabled:active,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled],.btn-danger[disabled].active,.btn-danger[disabled].focus,.btn-danger[disabled]:active,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger,fieldset[disabled] .btn-danger.active,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:active,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#d9534f;border-color:#d43f3a}.btn-danger .badge{color:#d9534f;background-color:#fff}.btn-link{font-weight:400;color:#337ab7;border-radius:0}.btn-link,.btn-link.active,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:active,.btn-link:focus,.btn-link:hover{border-color:transparent}.btn-link:focus,.btn-link:hover{color:#23527c;text-decoration:underline;background-color:transparent}.btn-link[disabled]:focus,.btn-link[disabled]:hover,fieldset[disabled] .btn-link:focus,fieldset[disabled] .btn-link:hover{color:#777;text-decoration:none}.btn-group-lg>.btn,.btn-lg{padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}.btn-group-sm>.btn,.btn-sm{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-xs>.btn,.btn-xs{padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-block{display:block;width:100%}.btn-block+.btn-block{margin-top:5px}input[type=button].btn-block,input[type=reset].btn-block,input[type=submit].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}tr.collapse.in{display:table-row}tbody.collapse.in{display:table-row-group}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition-timing-function:ease;-o-transition-timing-function:ease;transition-timing-function:ease;-webkit-transition-duration:.35s;-o-transition-duration:.35s;transition-duration:.35s;-webkit-transition-property:height,visibility;-o-transition-property:height,visibility;transition-property:height,visibility}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px dashed;border-right:4px solid transparent;border-left:4px solid transparent}.dropdown,.dropup{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;text-align:left;list-style:none;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{color:#fff;text-decoration:none;background-color:#337ab7;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{color:#777}.dropdown-menu>.disabled>a:focus,.dropdown-menu>.disabled>a:hover{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-menu-right{right:0;left:auto}.dropdown-menu-left{right:auto;left:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.42857143;color:#777;white-space:nowrap}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{content:"";border-top:0;border-bottom:4px solid}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:2px}@media (min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}.navbar-right .dropdown-menu-left{right:auto;left:0}}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group-vertical>.btn,.btn-group>.btn{position:relative;float:left}.btn-group-vertical>.btn.active,.btn-group-vertical>.btn:active,.btn-group-vertical>.btn:focus,.btn-group-vertical>.btn:hover,.btn-group>.btn.active,.btn-group>.btn:active,.btn-group>.btn:focus,.btn-group>.btn:hover{z-index:2}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar{margin-left:-5px}.btn-toolbar .btn-group,.btn-toolbar .input-group{float:left}.btn-toolbar>.btn,.btn-toolbar>.btn-group,.btn-toolbar>.input-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-top-left-radius:0;border-bottom-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-bottom-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group,.btn-group-vertical>.btn-group>.btn{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:4px}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child:not(:last-child)>.btn:last-child,.btn-group-vertical>.btn-group:first-child:not(:last-child)>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child:not(:first-child)>.btn:first-child{border-top-left-radius:0;border-top-right-radius:0}.btn-group-justified{display:table;width:100%;table-layout:fixed;border-collapse:separate}.btn-group-justified>.btn,.btn-group-justified>.btn-group{display:table-cell;float:none;width:1%}.btn-group-justified>.btn-group .btn{width:100%}.btn-group-justified>.btn-group .dropdown-menu{left:auto}[data-toggle=buttons]>.btn input[type=checkbox],[data-toggle=buttons]>.btn input[type=radio],[data-toggle=buttons]>.btn-group>.btn input[type=checkbox],[data-toggle=buttons]>.btn-group>.btn input[type=radio]{position:absolute;clip:rect(0,0,0,0);pointer-events:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group[class*=col-]{float:none;padding-right:0;padding-left:0}.input-group .form-control{position:relative;z-index:2;float:left;width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:46px;padding:10px 16px;font-size:18px;line-height:1.3333333;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:46px;line-height:46px}select[multiple].input-group-lg>.form-control,select[multiple].input-group-lg>.input-group-addon,select[multiple].input-group-lg>.input-group-btn>.btn,textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}select[multiple].input-group-sm>.form-control,select[multiple].input-group-sm>.input-group-addon,select[multiple].input-group-sm>.input-group-btn>.btn,textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto}.input-group .form-control,.input-group-addon,.input-group-btn{display:table-cell}.input-group .form-control:not(:first-child):not(:last-child),.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:400;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type=checkbox],.input-group-addon input[type=radio]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn-group:not(:last-child)>.btn,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:first-child>.btn-group:not(:first-child)>.btn,.input-group-btn:first-child>.btn:not(:first-child),.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group>.btn,.input-group-btn:last-child>.dropdown-toggle{border-top-left-radius:0;border-bottom-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;font-size:0;white-space:nowrap}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-1px}.input-group-btn>.btn:active,.input-group-btn>.btn:focus,.input-group-btn>.btn:hover{z-index:2}.input-group-btn:first-child>.btn,.input-group-btn:first-child>.btn-group{margin-right:-1px}.input-group-btn:last-child>.btn,.input-group-btn:last-child>.btn-group{margin-left:-1px}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:focus,.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#777}.nav>li.disabled>a:focus,.nav>li.disabled>a:hover{color:#777;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:focus,.nav .open>a:hover{background-color:#eee;border-color:#337ab7}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.42857143;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:focus,.nav-tabs>li.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:focus,.nav-tabs.nav-justified>.active>a:hover{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:focus,.nav-pills>li.active>a:hover{color:#fff;background-color:#337ab7}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media (min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border:1px solid #ddd}@media (min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:focus,.nav-tabs-justified>.active>a:hover{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-left-radius:0;border-top-right-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}@media (min-width:768px){.navbar{border-radius:4px}}@media (min-width:768px){.navbar-header{float:left}}.navbar-collapse{padding-right:15px;padding-left:15px;overflow-x:visible;-webkit-overflow-scrolling:touch;border-top:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1)}.navbar-collapse.in{overflow-y:auto}@media (min-width:768px){.navbar-collapse{width:auto;border-top:0;-webkit-box-shadow:none;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:visible}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse,.navbar-static-top .navbar-collapse{padding-right:0;padding-left:0}}.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:340px}@media (max-device-width:480px)and (orientation:landscape){.navbar-fixed-bottom .navbar-collapse,.navbar-fixed-top .navbar-collapse{max-height:200px}}.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:-15px;margin-left:-15px}@media (min-width:768px){.container-fluid>.navbar-collapse,.container-fluid>.navbar-header,.container>.navbar-collapse,.container>.navbar-header{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media (min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-bottom,.navbar-fixed-top{position:fixed;right:0;left:0;z-index:1030}@media (min-width:768px){.navbar-fixed-bottom,.navbar-fixed-top{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;height:50px;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:focus,.navbar-brand:hover{text-decoration:none}.navbar-brand>img{display:block}@media (min-width:768px){.navbar>.container .navbar-brand,.navbar>.container-fluid .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;background-image:none;border:1px solid transparent;border-radius:4px}.navbar-toggle:focus{outline:0}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media (min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media (max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;-webkit-box-shadow:none;box-shadow:none}.navbar-nav .open .dropdown-menu .dropdown-header,.navbar-nav .open .dropdown-menu>li>a{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:focus,.navbar-nav .open .dropdown-menu>li>a:hover{background-image:none}}@media (min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.1),0 1px 0 rgba(255,255,255,.1)}@media (min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block;width:auto;vertical-align:middle}.navbar-form .form-control-static{display:inline-block}.navbar-form .input-group{display:inline-table;vertical-align:middle}.navbar-form .input-group .form-control,.navbar-form .input-group .input-group-addon,.navbar-form .input-group .input-group-btn{width:auto}.navbar-form .input-group>.form-control{width:100%}.navbar-form .control-label{margin-bottom:0;vertical-align:middle}.navbar-form .checkbox,.navbar-form .radio{display:inline-block;margin-top:0;margin-bottom:0;vertical-align:middle}.navbar-form .checkbox label,.navbar-form .radio label{padding-left:0}.navbar-form .checkbox input[type=checkbox],.navbar-form .radio input[type=radio]{position:relative;margin-left:0}.navbar-form .has-feedback .form-control-feedback{top:0}}@media (max-width:767px){.navbar-form .form-group{margin-bottom:5px}.navbar-form .form-group:last-child{margin-bottom:0}}@media (min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-left-radius:0;border-top-right-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{margin-bottom:0;border-top-left-radius:4px;border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-btn.btn-sm{margin-top:10px;margin-bottom:10px}.navbar-btn.btn-xs{margin-top:14px;margin-bottom:14px}.navbar-text{margin-top:15px;margin-bottom:15px}@media (min-width:768px){.navbar-text{float:left;margin-right:15px;margin-left:15px}}@media (min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important;margin-right:-15px}.navbar-right~.navbar-right{margin-right:0}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:focus,.navbar-default .navbar-brand:hover{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:focus,.navbar-default .navbar-nav>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:focus,.navbar-default .navbar-nav>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:focus,.navbar-default .navbar-nav>.disabled>a:hover{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:focus,.navbar-default .navbar-toggle:hover{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#888}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:focus,.navbar-default .navbar-nav>.open>a:hover{color:#555;background-color:#e7e7e7}@media (max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-default .btn-link{color:#777}.navbar-default .btn-link:focus,.navbar-default .btn-link:hover{color:#333}.navbar-default .btn-link[disabled]:focus,.navbar-default .btn-link[disabled]:hover,fieldset[disabled] .navbar-default .btn-link:focus,fieldset[disabled] .navbar-default .btn-link:hover{color:#ccc}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#9d9d9d}.navbar-inverse .navbar-brand:focus,.navbar-inverse .navbar-brand:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav>li>a:focus,.navbar-inverse .navbar-nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:focus,.navbar-inverse .navbar-nav>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:focus,.navbar-inverse .navbar-nav>.disabled>a:hover{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:focus,.navbar-inverse .navbar-toggle:hover{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:focus,.navbar-inverse .navbar-nav>.open>a:hover{color:#fff;background-color:#080808}@media (max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu .divider{background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#9d9d9d}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#9d9d9d}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .btn-link{color:#9d9d9d}.navbar-inverse .btn-link:focus,.navbar-inverse .btn-link:hover{color:#fff}.navbar-inverse .btn-link[disabled]:focus,.navbar-inverse .btn-link[disabled]:hover,fieldset[disabled] .navbar-inverse .btn-link:focus,fieldset[disabled] .navbar-inverse .btn-link:hover{color:#444}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#777}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.42857143;color:#337ab7;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-top-left-radius:4px;border-bottom-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:focus,.pagination>li>a:hover,.pagination>li>span:focus,.pagination>li>span:hover{color:#23527c;background-color:#eee;border-color:#ddd}.pagination>.active>a,.pagination>.active>a:focus,.pagination>.active>a:hover,.pagination>.active>span,.pagination>.active>span:focus,.pagination>.active>span:hover{z-index:2;color:#fff;cursor:default;background-color:#337ab7;border-color:#337ab7}.pagination>.disabled>a,.pagination>.disabled>a:focus,.pagination>.disabled>a:hover,.pagination>.disabled>span,.pagination>.disabled>span:focus,.pagination>.disabled>span:hover{color:#777;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-top-left-radius:6px;border-bottom-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-top-left-radius:3px;border-bottom-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:focus,.pager li>a:hover{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:focus,.pager .disabled>a:hover,.pager .disabled>span{color:#777;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}a.label:focus,a.label:hover{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.btn .label{position:relative;top:-1px}.label-default{background-color:#777}.label-default[href]:focus,.label-default[href]:hover{background-color:#5e5e5e}.label-primary{background-color:#337ab7}.label-primary[href]:focus,.label-primary[href]:hover{background-color:#286090}.label-success{background-color:#5cb85c}.label-success[href]:focus,.label-success[href]:hover{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:focus,.label-info[href]:hover{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:focus,.label-warning[href]:hover{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:focus,.label-danger[href]:hover{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:700;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;background-color:#777;border-radius:10px}.badge:empty{display:none}.btn .badge{position:relative;top:-1px}.btn-group-xs>.btn .badge,.btn-xs .badge{top:0;padding:1px 5px}a.badge:focus,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#337ab7;background-color:#fff}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px 15px;margin-bottom:30px;color:inherit;background-color:#eee}.jumbotron .h1,.jumbotron h1{color:inherit}.jumbotron p{margin-bottom:15px;font-size:21px;font-weight:200}.jumbotron>hr{border-top-color:#d5d5d5}.container .jumbotron,.container-fluid .jumbotron{border-radius:6px}.jumbotron .container{max-width:100%}@media screen and (min-width:768px){.jumbotron{padding:48px 0}.container .jumbotron,.container-fluid .jumbotron{padding-right:60px;padding-left:60px}.jumbotron .h1,.jumbotron h1{font-size:63px}}.thumbnail{display:block;padding:4px;margin-bottom:20px;line-height:1.42857143;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:border .2s ease-in-out;-o-transition:border .2s ease-in-out;transition:border .2s ease-in-out}.thumbnail a>img,.thumbnail>img{margin-right:auto;margin-left:auto}a.thumbnail.active,a.thumbnail:focus,a.thumbnail:hover{border-color:#337ab7}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:700}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable,.alert-dismissible{padding-right:35px}.alert-dismissable .close,.alert-dismissible .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#2b542c}.alert-info{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#245269}.alert-warning{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#66512c}.alert-danger{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#843534}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.1);box-shadow:inset 0 1px 2px rgba(0,0,0,.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#337ab7;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,.15);-webkit-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress-bar-striped,.progress-striped .progress-bar{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;background-size:40px 40px}.progress-bar.active,.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.media{margin-top:15px}.media:first-child{margin-top:0}.media,.media-body{overflow:hidden;zoom:1}.media-body{width:10000px}.media-object{display:block}.media-right,.media>.pull-right{padding-left:10px}.media-left,.media>.pull-left{padding-right:10px}.media-body,.media-left,.media-right{display:table-cell;vertical-align:top}.media-middle{vertical-align:middle}.media-bottom{vertical-align:bottom}.media-heading{margin-top:0;margin-bottom:5px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-left-radius:4px;border-top-right-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:focus,a.list-group-item:hover{color:#555;text-decoration:none;background-color:#f5f5f5}.list-group-item.disabled,.list-group-item.disabled:focus,.list-group-item.disabled:hover{color:#777;cursor:not-allowed;background-color:#eee}.list-group-item.disabled .list-group-item-heading,.list-group-item.disabled:focus .list-group-item-heading,.list-group-item.disabled:hover .list-group-item-heading{color:inherit}.list-group-item.disabled .list-group-item-text,.list-group-item.disabled:focus .list-group-item-text,.list-group-item.disabled:hover .list-group-item-text{color:#777}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{z-index:2;color:#fff;background-color:#337ab7;border-color:#337ab7}.list-group-item.active .list-group-item-heading,.list-group-item.active .list-group-item-heading>.small,.list-group-item.active .list-group-item-heading>small,.list-group-item.active:focus .list-group-item-heading,.list-group-item.active:focus .list-group-item-heading>.small,.list-group-item.active:focus .list-group-item-heading>small,.list-group-item.active:hover .list-group-item-heading,.list-group-item.active:hover .list-group-item-heading>.small,.list-group-item.active:hover .list-group-item-heading>small{color:inherit}.list-group-item.active .list-group-item-text,.list-group-item.active:focus .list-group-item-text,.list-group-item.active:hover .list-group-item-text{color:#c7ddef}.list-group-item-success{color:#3c763d;background-color:#dff0d8}a.list-group-item-success{color:#3c763d}a.list-group-item-success .list-group-item-heading{color:inherit}a.list-group-item-success:focus,a.list-group-item-success:hover{color:#3c763d;background-color:#d0e9c6}a.list-group-item-success.active,a.list-group-item-success.active:focus,a.list-group-item-success.active:hover{color:#fff;background-color:#3c763d;border-color:#3c763d}.list-group-item-info{color:#31708f;background-color:#d9edf7}a.list-group-item-info{color:#31708f}a.list-group-item-info .list-group-item-heading{color:inherit}a.list-group-item-info:focus,a.list-group-item-info:hover{color:#31708f;background-color:#c4e3f3}a.list-group-item-info.active,a.list-group-item-info.active:focus,a.list-group-item-info.active:hover{color:#fff;background-color:#31708f;border-color:#31708f}.list-group-item-warning{color:#8a6d3b;background-color:#fcf8e3}a.list-group-item-warning{color:#8a6d3b}a.list-group-item-warning .list-group-item-heading{color:inherit}a.list-group-item-warning:focus,a.list-group-item-warning:hover{color:#8a6d3b;background-color:#faf2cc}a.list-group-item-warning.active,a.list-group-item-warning.active:focus,a.list-group-item-warning.active:hover{color:#fff;background-color:#8a6d3b;border-color:#8a6d3b}.list-group-item-danger{color:#a94442;background-color:#f2dede}a.list-group-item-danger{color:#a94442}a.list-group-item-danger .list-group-item-heading{color:inherit}a.list-group-item-danger:focus,a.list-group-item-danger:hover{color:#a94442;background-color:#ebcccc}a.list-group-item-danger.active,a.list-group-item-danger.active:focus,a.list-group-item-danger.active:hover{color:#fff;background-color:#a94442;border-color:#a94442}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,.05);box-shadow:0 1px 1px rgba(0,0,0,.05)}.panel-body{padding:15px}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-left-radius:3px;border-top-right-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px;color:inherit}.panel-title>.small,.panel-title>.small>a,.panel-title>a,.panel-title>small,.panel-title>small>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.list-group,.panel>.panel-collapse>.list-group{margin-bottom:0}.panel>.list-group .list-group-item,.panel>.panel-collapse>.list-group .list-group-item{border-width:1px 0;border-radius:0}.panel>.list-group:first-child .list-group-item:first-child,.panel>.panel-collapse>.list-group:first-child .list-group-item:first-child{border-top:0;border-top-left-radius:3px;border-top-right-radius:3px}.panel>.list-group:last-child .list-group-item:last-child,.panel>.panel-collapse>.list-group:last-child .list-group-item:last-child{border-bottom:0;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.list-group+.panel-footer{border-top-width:0}.panel>.panel-collapse>.table,.panel>.table,.panel>.table-responsive>.table{margin-bottom:0}.panel>.panel-collapse>.table caption,.panel>.table caption,.panel>.table-responsive>.table caption{padding-right:15px;padding-left:15px}.panel>.table-responsive:first-child>.table:first-child,.panel>.table:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child,.panel>.table:first-child>thead:first-child>tr:first-child{border-top-left-radius:3px;border-top-right-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:first-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:first-child,.panel>.table:first-child>thead:first-child>tr:first-child td:first-child,.panel>.table:first-child>thead:first-child>tr:first-child th:first-child{border-top-left-radius:3px}.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table-responsive:first-child>.table:first-child>thead:first-child>tr:first-child th:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child td:last-child,.panel>.table:first-child>tbody:first-child>tr:first-child th:last-child,.panel>.table:first-child>thead:first-child>tr:first-child td:last-child,.panel>.table:first-child>thead:first-child>tr:first-child th:last-child{border-top-right-radius:3px}.panel>.table-responsive:last-child>.table:last-child,.panel>.table:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child{border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:first-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:first-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:first-child{border-bottom-left-radius:3px}.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table-responsive:last-child>.table:last-child>tfoot:last-child>tr:last-child th:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child td:last-child,.panel>.table:last-child>tbody:last-child>tr:last-child th:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child td:last-child,.panel>.table:last-child>tfoot:last-child>tr:last-child th:last-child{border-bottom-right-radius:3px}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive,.panel>.table+.panel-body,.panel>.table-responsive+.panel-body{border-top:1px solid #ddd}.panel>.table>tbody:first-child>tr:first-child td,.panel>.table>tbody:first-child>tr:first-child th{border-top:0}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child{border-left:0}.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child{border-right:0}.panel>.table-bordered>tbody>tr:first-child>td,.panel>.table-bordered>tbody>tr:first-child>th,.panel>.table-bordered>thead>tr:first-child>td,.panel>.table-bordered>thead>tr:first-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:first-child>th,.panel>.table-responsive>.table-bordered>thead>tr:first-child>td,.panel>.table-responsive>.table-bordered>thead>tr:first-child>th{border-bottom:0}.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th{border-bottom:0}.panel>.table-responsive{margin-bottom:0;border:0}.panel-group{margin-bottom:20px}.panel-group .panel{margin-bottom:0;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse>.list-group,.panel-group .panel-heading+.panel-collapse>.panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ddd}.panel-default>.panel-heading .badge{color:#f5f5f5;background-color:#333}.panel-default>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#337ab7}.panel-primary>.panel-heading{color:#fff;background-color:#337ab7;border-color:#337ab7}.panel-primary>.panel-heading+.panel-collapse>.panel-body{border-top-color:#337ab7}.panel-primary>.panel-heading .badge{color:#337ab7;background-color:#fff}.panel-primary>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#337ab7}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#3c763d;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse>.panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading .badge{color:#dff0d8;background-color:#3c763d}.panel-success>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#d6e9c6}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#31708f;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse>.panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading .badge{color:#d9edf7;background-color:#31708f}.panel-info>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#bce8f1}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#8a6d3b;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse>.panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading .badge{color:#fcf8e3;background-color:#8a6d3b}.panel-warning>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#a94442;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse>.panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading .badge{color:#f2dede;background-color:#a94442}.panel-danger>.panel-footer+.panel-collapse>.panel-body{border-bottom-color:#ebccd1}.embed-responsive{position:relative;display:block;height:0;padding:0;overflow:hidden}.embed-responsive .embed-responsive-item,.embed-responsive embed,.embed-responsive iframe,.embed-responsive object,.embed-responsive video{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;border:0}.embed-responsive-16by9{padding-bottom:56.25%}.embed-responsive-4by3{padding-bottom:75%}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.05);box-shadow:inset 0 1px 1px rgba(0,0,0,.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:700;line-height:1;color:#000;text-shadow:0 1px 0 #fff;filter:alpha(opacity=20);opacity:.2}.close:focus,.close:hover{color:#000;text-decoration:none;cursor:pointer;filter:alpha(opacity=50);opacity:.5}button.close{-webkit-appearance:none;padding:0;cursor:pointer;background:0 0;border:0}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;-webkit-overflow-scrolling:touch;outline:0}.modal.fade .modal-dialog{-webkit-transition:-webkit-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out;-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);-o-transform:translate(0,-25%);transform:translate(0,-25%)}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);-o-transform:translate(0,0);transform:translate(0,0)}.modal-open .modal{overflow-x:hidden;overflow-y:auto}.modal-dialog{position:relative;width:auto;margin:10px}.modal-content{position:relative;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #999;border:1px solid rgba(0,0,0,.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,.5);box-shadow:0 3px 9px rgba(0,0,0,.5)}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{filter:alpha(opacity=0);opacity:0}.modal-backdrop.in{filter:alpha(opacity=50);opacity:.5}.modal-header{min-height:16.43px;padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.42857143}.modal-body{position:relative;padding:15px}.modal-footer{padding:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}@media (min-width:768px){.modal-dialog{width:600px;margin:30px auto}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,.5);box-shadow:0 5px 15px rgba(0,0,0,.5)}.modal-sm{width:300px}}@media (min-width:992px){.modal-lg{width:900px}}.tooltip{position:absolute;z-index:1070;display:block;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:12px;font-weight:400;line-height:1.4;filter:alpha(opacity=0);opacity:0}.tooltip.in{filter:alpha(opacity=90);opacity:.9}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-left .tooltip-arrow{right:5px;bottom:0;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.top-right .tooltip-arrow{bottom:0;left:5px;margin-bottom:-5px;border-width:5px 5px 0;border-top-color:#000}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-width:5px 5px 5px 0;border-right-color:#000}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-width:5px 0 5px 5px;border-left-color:#000}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-left .tooltip-arrow{top:0;right:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.tooltip.bottom-right .tooltip-arrow{top:0;left:5px;margin-top:-5px;border-width:0 5px 5px;border-bottom-color:#000}.popover{position:absolute;top:0;left:0;z-index:1060;display:none;max-width:276px;padding:1px;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;font-weight:400;line-height:1.42857143;text-align:left;white-space:normal;background-color:#fff;-webkit-background-clip:padding-box;background-clip:padding-box;border:1px solid #ccc;border:1px solid rgba(0,0,0,.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,.2);box-shadow:0 5px 10px rgba(0,0,0,.2)}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover>.arrow,.popover>.arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover>.arrow{border-width:11px}.popover>.arrow:after{content:"";border-width:10px}.popover.top>.arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,.25);border-bottom-width:0}.popover.top>.arrow:after{bottom:1px;margin-left:-10px;content:" ";border-top-color:#fff;border-bottom-width:0}.popover.right>.arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,.25);border-left-width:0}.popover.right>.arrow:after{bottom:-10px;left:1px;content:" ";border-right-color:#fff;border-left-width:0}.popover.bottom>.arrow{top:-11px;left:50%;margin-left:-11px;border-top-width:0;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,.25)}.popover.bottom>.arrow:after{top:1px;margin-left:-10px;content:" ";border-top-width:0;border-bottom-color:#fff}.popover.left>.arrow{top:50%;right:-11px;margin-top:-11px;border-right-width:0;border-left-color:#999;border-left-color:rgba(0,0,0,.25)}.popover.left>.arrow:after{right:1px;bottom:-10px;content:" ";border-right-width:0;border-left-color:#fff}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>a>img,.carousel-inner>.item>img{line-height:1}@media all and (transform-3d),(-webkit-transform-3d){.carousel-inner>.item{-webkit-transition:-webkit-transform .6s ease-in-out;-o-transition:-o-transform .6s ease-in-out;transition:transform .6s ease-in-out;-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-perspective:1000;perspective:1000}.carousel-inner>.item.active.right,.carousel-inner>.item.next{left:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.carousel-inner>.item.active.left,.carousel-inner>.item.prev{left:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.carousel-inner>.item.active,.carousel-inner>.item.next.left,.carousel-inner>.item.prev.right{left:0;-webkit-transform:translate3d(0,0,0);transform:translate3d(0,0,0)}}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6);filter:alpha(opacity=50);opacity:.5}.carousel-control.left{background-image:-webkit-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.5)),to(rgba(0,0,0,.0001)));background-image:linear-gradient(to right,rgba(0,0,0,.5) 0,rgba(0,0,0,.0001) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);background-repeat:repeat-x}.carousel-control.right{right:0;left:auto;background-image:-webkit-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-o-linear-gradient(left,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);background-image:-webkit-gradient(linear,left top,right top,from(rgba(0,0,0,.0001)),to(rgba(0,0,0,.5)));background-image:linear-gradient(to right,rgba(0,0,0,.0001) 0,rgba(0,0,0,.5) 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);background-repeat:repeat-x}.carousel-control:focus,.carousel-control:hover{color:#fff;text-decoration:none;filter:alpha(opacity=90);outline:0;opacity:.9}.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{left:50%;margin-left:-10px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{right:50%;margin-right:-10px}.carousel-control .icon-next,.carousel-control .icon-prev{width:20px;height:20px;margin-top:-10px;font-family:serif;line-height:1}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next,.carousel-control .icon-prev{width:30px;height:30px;margin-top:-15px;font-size:30px}.carousel-control .glyphicon-chevron-left,.carousel-control .icon-prev{margin-left:-15px}.carousel-control .glyphicon-chevron-right,.carousel-control .icon-next{margin-right:-15px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.btn-group-vertical>.btn-group:after,.btn-group-vertical>.btn-group:before,.btn-toolbar:after,.btn-toolbar:before,.clearfix:after,.clearfix:before,.container-fluid:after,.container-fluid:before,.container:after,.container:before,.dl-horizontal dd:after,.dl-horizontal dd:before,.form-horizontal .form-group:after,.form-horizontal .form-group:before,.modal-footer:after,.modal-footer:before,.nav:after,.nav:before,.navbar-collapse:after,.navbar-collapse:before,.navbar-header:after,.navbar-header:before,.navbar:after,.navbar:before,.pager:after,.pager:before,.panel-body:after,.panel-body:before,.row:after,.row:before{display:table;content:" "}.btn-group-vertical>.btn-group:after,.btn-toolbar:after,.clearfix:after,.container-fluid:after,.container:after,.dl-horizontal dd:after,.form-horizontal .form-group:after,.modal-footer:after,.nav:after,.navbar-collapse:after,.navbar-header:after,.navbar:after,.pager:after,.panel-body:after,.row:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-lg,.visible-md,.visible-sm,.visible-xs{display:none!important}.visible-lg-block,.visible-lg-inline,.visible-lg-inline-block,.visible-md-block,.visible-md-inline,.visible-md-inline-block,.visible-sm-block,.visible-sm-inline,.visible-sm-inline-block,.visible-xs-block,.visible-xs-inline,.visible-xs-inline-block{display:none!important}@media (max-width:767px){.visible-xs{display:block!important}table.visible-xs{display:table}tr.visible-xs{display:table-row!important}td.visible-xs,th.visible-xs{display:table-cell!important}}@media (max-width:767px){.visible-xs-block{display:block!important}}@media (max-width:767px){.visible-xs-inline{display:inline!important}}@media (max-width:767px){.visible-xs-inline-block{display:inline-block!important}}@media (min-width:768px)and (max-width:991px){.visible-sm{display:block!important}table.visible-sm{display:table}tr.visible-sm{display:table-row!important}td.visible-sm,th.visible-sm{display:table-cell!important}}@media (min-width:768px)and (max-width:991px){.visible-sm-block{display:block!important}}@media (min-width:768px)and (max-width:991px){.visible-sm-inline{display:inline!important}}@media (min-width:768px)and (max-width:991px){.visible-sm-inline-block{display:inline-block!important}}@media (min-width:992px)and (max-width:1199px){.visible-md{display:block!important}table.visible-md{display:table}tr.visible-md{display:table-row!important}td.visible-md,th.visible-md{display:table-cell!important}}@media (min-width:992px)and (max-width:1199px){.visible-md-block{display:block!important}}@media (min-width:992px)and (max-width:1199px){.visible-md-inline{display:inline!important}}@media (min-width:992px)and (max-width:1199px){.visible-md-inline-block{display:inline-block!important}}@media (min-width:1200px){.visible-lg{display:block!important}table.visible-lg{display:table}tr.visible-lg{display:table-row!important}td.visible-lg,th.visible-lg{display:table-cell!important}}@media (min-width:1200px){.visible-lg-block{display:block!important}}@media (min-width:1200px){.visible-lg-inline{display:inline!important}}@media (min-width:1200px){.visible-lg-inline-block{display:inline-block!important}}@media (max-width:767px){.hidden-xs{display:none!important}}@media (min-width:768px)and (max-width:991px){.hidden-sm{display:none!important}}@media (min-width:992px)and (max-width:1199px){.hidden-md{display:none!important}}@media (min-width:1200px){.hidden-lg{display:none!important}}.visible-print{display:none!important}@media print{.visible-print{display:block!important}table.visible-print{display:table}tr.visible-print{display:table-row!important}td.visible-print,th.visible-print{display:table-cell!important}}.visible-print-block{display:none!important}@media print{.visible-print-block{display:block!important}}.visible-print-inline{display:none!important}@media print{.visible-print-inline{display:inline!important}}.visible-print-inline-block{display:none!important}@media print{.visible-print-inline-block{display:inline-block!important}}@media print{.hidden-print{display:none!important}}
117,305
bootstrap.min
css
en
css
data
{"qsc_code_num_words": 19140, "qsc_code_num_chars": 117305.0, "qsc_code_mean_word_length": 4.81243469, "qsc_code_frac_words_unique": 0.05752351, "qsc_code_frac_chars_top_2grams": 0.03754207, "qsc_code_frac_chars_top_3grams": 0.01383129, "qsc_code_frac_chars_top_4grams": 0.00501574, "qsc_code_frac_chars_dupe_5grams": 0.59778526, "qsc_code_frac_chars_dupe_6grams": 0.5039518, "qsc_code_frac_chars_dupe_7grams": 0.40257301, "qsc_code_frac_chars_dupe_8grams": 0.33591358, "qsc_code_frac_chars_dupe_9grams": 0.2863967, "qsc_code_frac_chars_dupe_10grams": 0.2234068, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.06362083, "qsc_code_frac_chars_whitespace": 0.01219897, "qsc_code_size_file_byte": 117305.0, "qsc_code_num_lines": 5.0, "qsc_code_num_chars_line_max": 117140.0, "qsc_code_num_chars_line_mean": 23461.0, "qsc_code_frac_chars_alphabet": 0.73129434, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01306839, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 1, "qsc_code_mean_word_length": 0, "qsc_code_frac_words_unique": 1, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 1, "qsc_code_num_chars_line_max": 1, "qsc_code_num_chars_line_mean": 1, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0}
007revad/Synology_Download_Station_Chrome_Extension
js/content-scripts/content.js
(function() { "use strict"; if (!document.body) { return; } var dseCurrentIcon = null; var bodyOverflowStyle = document.body.style.overflow; extension.onMessage(function(event) { if(event.name == "hud" && top === self) { showHud(event.message); } else if (event.name == "openDownloadDialog" && top === self) { showNewTaskDialog(event.message.url); } else if (event.name == "removeDialog") { $("iframe#" + event.message.dialogId).remove(); document.body.style.overflow = bodyOverflowStyle; } }); extension.sendMessageToBackground("getProtocols", null, function(protocols) { bindProtocolEvents(protocols); }); $("body").on("click", "#dse-hud", function() { $(this).removeClass('visible'); }); function showHud(hudItem) { var container = $("#dse-hud"); if(container.length === 0) { var resetContainer = $('<div class="yui3-cssreset"></div>').appendTo('body'); container = $('<div id="dse-hud"></div>').appendTo(resetContainer); container.html('<div id="dse-icon"></div><div id="dse-message"></div>'); } var message = $('#dse-message'); var icon = $('#dse-icon'); // Update icon if(hudItem.icon == undefined || hudItem.icon == null) hudItem.icon = 'progress'; if(container.hasClass('visible') && hudItem.icon != dseCurrentIcon) { icon.fadeOut(200, function() { icon.css('background-image', 'url('+extension.getResourceURL('css/img/hud-'+hudItem.icon+'.png')+')').fadeIn(200); }); } else icon.css('background-image', 'url('+extension.getResourceURL('css/img/hud-'+hudItem.icon+'.png')+')'); dseCurrentIcon = hudItem.icon; // Update hud if(hudItem.action === 'show') { if(message.text() != hudItem.text && message.text() != '' && container.hasClass('visible')) { message.fadeOut(200, function() { message.text(hudItem.text).fadeIn(200); }); } else { message.text(hudItem.text); setTimeout(function() {message.addClass('visible')}, 1); } if(hudItem.autoHide) setTimeout(function() {container.removeClass('visible')}, 3000); setTimeout(function() {container.addClass('visible')}, 1); } else if(hudItem.action === 'hide') { setTimeout(function() {container.removeClass('visible')}, 1); } } function bindProtocolEvents(protocols) { for(var i = 0; i < protocols.length; i++) { $("body").on("click", "a[href^='" + protocols[i] + "']", function(event) { event.preventDefault(); extension.sendMessageToBackground("addTaskWithHud", { url: $(this).prop("href"), taskType: protocols[i] }); }); } } function showNewTaskDialog(url) { var dialogId = Math.random().toString(36).substring(7); var dialogFrame = document.createElement("iframe"); dialogFrame.src = extension.getResourceURL('download-dialog.html?id=' + encodeURIComponent(dialogId) + '&url=' + encodeURIComponent(url)); dialogFrame.id = dialogId; dialogFrame.setAttribute('allowtransparency', 'true'); dialogFrame.setAttribute('frameborder', '0'); dialogFrame.setAttribute("style", "position: fixed!important; width: 100%!important; height: 100%!important; top: 0!important; left: 0!important; z-index: 2147483647!important;"); document.body.appendChild(dialogFrame); document.body.style.overflow = "hidden"; } })();
3,320
content
js
en
javascript
code
{"qsc_code_num_words": 341, "qsc_code_num_chars": 3320.0, "qsc_code_mean_word_length": 6.28739003, "qsc_code_frac_words_unique": 0.3255132, "qsc_code_frac_chars_top_2grams": 0.03591418, "qsc_code_frac_chars_top_3grams": 0.02378731, "qsc_code_frac_chars_top_4grams": 0.03498134, "qsc_code_frac_chars_dupe_5grams": 0.10820896, "qsc_code_frac_chars_dupe_6grams": 0.06623134, "qsc_code_frac_chars_dupe_7grams": 0.06623134, "qsc_code_frac_chars_dupe_8grams": 0.06623134, "qsc_code_frac_chars_dupe_9grams": 0.06623134, "qsc_code_frac_chars_dupe_10grams": 0.06623134, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01569747, "qsc_code_frac_chars_whitespace": 0.15572289, "qsc_code_size_file_byte": 3320.0, "qsc_code_num_lines": 105.0, "qsc_code_num_chars_line_max": 182.0, "qsc_code_num_chars_line_mean": 31.61904762, "qsc_code_frac_chars_alphabet": 0.74919729, "qsc_code_frac_chars_comments": 0.00813253, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.07954545, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.01136364, "qsc_code_frac_chars_string_length": 0.18791743, "qsc_code_frac_chars_long_word_length": 0.03642987, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejavascript_cate_ast": 1.0, "qsc_codejavascript_cate_var_zero": 0.0, "qsc_codejavascript_frac_lines_func_ratio": 0.03409091, "qsc_codejavascript_num_statement_line": 0.01136364, "qsc_codejavascript_score_lines_no_logic": 0.06818182, "qsc_codejavascript_frac_words_legal_var_name": 1.0, "qsc_codejavascript_frac_words_legal_func_name": 1.0, "qsc_codejavascript_frac_words_legal_class_name": null, "qsc_codejavascript_frac_lines_print": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejavascript_cate_ast": 0, "qsc_codejavascript_cate_var_zero": 0, "qsc_codejavascript_frac_lines_func_ratio": 0, "qsc_codejavascript_score_lines_no_logic": 0, "qsc_codejavascript_frac_lines_print": 0}
007revad/Synology_Download_Station_Chrome_Extension
js/lib/knockout.mapping.js
/// Knockout Mapping plugin v2.4.1 /// (c) 2013 Steven Sanderson, Roy Jacobs - http://knockoutjs.com/ /// License: MIT (http://www.opensource.org/licenses/mit-license.php) (function(e){"function"===typeof require&&"object"===typeof exports&&"object"===typeof module?e(require("knockout"),exports):"function"===typeof define&&define.amd?define(["knockout","exports"],e):e(ko,ko.mapping={})})(function(e,f){function y(b,c){var a,d;for(d in c)if(c.hasOwnProperty(d)&&c[d])if(a=f.getType(b[d]),d&&b[d]&&"array"!==a&&"string"!==a)y(b[d],c[d]);else if("array"===f.getType(b[d])&&"array"===f.getType(c[d])){a=b;for(var e=d,l=b[d],n=c[d],t={},g=l.length-1;0<=g;--g)t[l[g]]=l[g];for(g= n.length-1;0<=g;--g)t[n[g]]=n[g];l=[];n=void 0;for(n in t)l.push(t[n]);a[e]=l}else b[d]=c[d]}function E(b,c){var a={};y(a,b);y(a,c);return a}function z(b,c){for(var a=E({},b),e=L.length-1;0<=e;e--){var f=L[e];a[f]&&(a[""]instanceof Object||(a[""]={}),a[""][f]=a[f],delete a[f])}c&&(a.ignore=h(c.ignore,a.ignore),a.include=h(c.include,a.include),a.copy=h(c.copy,a.copy),a.observe=h(c.observe,a.observe));a.ignore=h(a.ignore,j.ignore);a.include=h(a.include,j.include);a.copy=h(a.copy,j.copy);a.observe=h(a.observe, j.observe);a.mappedProperties=a.mappedProperties||{};a.copiedProperties=a.copiedProperties||{};return a}function h(b,c){"array"!==f.getType(b)&&(b="undefined"===f.getType(b)?[]:[b]);"array"!==f.getType(c)&&(c="undefined"===f.getType(c)?[]:[c]);return e.utils.arrayGetDistinctValues(b.concat(c))}function F(b,c,a,d,k,l,n){var t="array"===f.getType(e.utils.unwrapObservable(c));l=l||"";if(f.isMapped(b)){var g=e.utils.unwrapObservable(b)[p];a=E(g,a)}var j=n||k,h=function(){return a[d]&&a[d].create instanceof Function},x=function(b){var f=G,g=e.dependentObservable;e.dependentObservable=function(a,b,c){c=c||{};a&&"object"==typeof a&&(c=a);var d=c.deferEvaluation,M=!1;c.deferEvaluation=!0;a=new H(a,b,c);if(!d){var g=a,d=e.dependentObservable;e.dependentObservable=H;a=e.isWriteableObservable(g);e.dependentObservable=d;d=H({read:function(){M||(e.utils.arrayRemoveItem(f,g),M=!0);return g.apply(g,arguments)},write:a&&function(a){return g(a)},deferEvaluation:!0});d.__DO=g;a=d;f.push(a)}return a};e.dependentObservable.fn= H.fn;e.computed=e.dependentObservable;b=e.utils.unwrapObservable(k)instanceof Array?a[d].create({data:b||c,parent:j,skip:N}):a[d].create({data:b||c,parent:j});e.dependentObservable=g;e.computed=e.dependentObservable;return b},u=function(){return a[d]&&a[d].update instanceof Function},v=function(b,f){var g={data:f||c,parent:j,target:e.utils.unwrapObservable(b)};e.isWriteableObservable(b)&&(g.observable=b);return a[d].update(g)};if(n=I.get(c))return n;d=d||"";if(t){var t=[],s=!1,m=function(a){return a}; a[d]&&a[d].key&&(m=a[d].key,s=!0);e.isObservable(b)||(b=e.observableArray([]),b.mappedRemove=function(a){var c="function"==typeof a?a:function(b){return b===m(a)};return b.remove(function(a){return c(m(a))})},b.mappedRemoveAll=function(a){var c=C(a,m);return b.remove(function(a){return-1!=e.utils.arrayIndexOf(c,m(a))})},b.mappedDestroy=function(a){var c="function"==typeof a?a:function(b){return b===m(a)};return b.destroy(function(a){return c(m(a))})},b.mappedDestroyAll=function(a){var c=C(a,m);return b.destroy(function(a){return-1!= e.utils.arrayIndexOf(c,m(a))})},b.mappedIndexOf=function(a){var c=C(b(),m);a=m(a);return e.utils.arrayIndexOf(c,a)},b.mappedGet=function(a){return b()[b.mappedIndexOf(a)]},b.mappedCreate=function(a){if(-1!==b.mappedIndexOf(a))throw Error("There already is an object with the key that you specified.");var c=h()?x(a):a;u()&&(a=v(c,a),e.isWriteableObservable(c)?c(a):c=a);b.push(c);return c});n=C(e.utils.unwrapObservable(b),m).sort();g=C(c,m);s&&g.sort();s=e.utils.compareArrays(n,g);n={};var J,A=e.utils.unwrapObservable(c), y={},z=!0,g=0;for(J=A.length;g<J;g++){var r=m(A[g]);if(void 0===r||r instanceof Object){z=!1;break}y[r]=A[g]}var A=[],B=0,g=0;for(J=s.length;g<J;g++){var r=s[g],q,w=l+"["+g+"]";switch(r.status){case "added":var D=z?y[r.value]:K(e.utils.unwrapObservable(c),r.value,m);q=F(void 0,D,a,d,b,w,k);h()||(q=e.utils.unwrapObservable(q));w=O(e.utils.unwrapObservable(c),D,n);q===N?B++:A[w-B]=q;n[w]=!0;break;case "retained":D=z?y[r.value]:K(e.utils.unwrapObservable(c),r.value,m);q=K(b,r.value,m);F(q,D,a,d,b,w, k);w=O(e.utils.unwrapObservable(c),D,n);A[w]=q;n[w]=!0;break;case "deleted":q=K(b,r.value,m)}t.push({event:r.status,item:q})}b(A);a[d]&&a[d].arrayChanged&&e.utils.arrayForEach(t,function(b){a[d].arrayChanged(b.event,b.item)})}else if(P(c)){b=e.utils.unwrapObservable(b);if(!b){if(h())return s=x(),u()&&(s=v(s)),s;if(u())return v(s);b={}}u()&&(b=v(b));I.save(c,b);if(u())return b;Q(c,function(d){var f=l.length?l+"."+d:d;if(-1==e.utils.arrayIndexOf(a.ignore,f))if(-1!=e.utils.arrayIndexOf(a.copy,f))b[d]= c[d];else if("object"!=typeof c[d]&&"array"!=typeof c[d]&&0<a.observe.length&&-1==e.utils.arrayIndexOf(a.observe,f))b[d]=c[d],a.copiedProperties[f]=!0;else{var g=I.get(c[d]),k=F(b[d],c[d],a,d,b,f,b),g=g||k;if(0<a.observe.length&&-1==e.utils.arrayIndexOf(a.observe,f))b[d]=g(),a.copiedProperties[f]=!0;else{if(e.isWriteableObservable(b[d])){if(g=e.utils.unwrapObservable(g),b[d]()!==g)b[d](g)}else g=void 0===b[d]?g:e.utils.unwrapObservable(g),b[d]=g;a.mappedProperties[f]=!0}}})}else switch(f.getType(c)){case "function":u()? e.isWriteableObservable(c)?(c(v(c)),b=c):b=v(c):b=c;break;default:if(e.isWriteableObservable(b))return q=u()?v(b):e.utils.unwrapObservable(c),b(q),q;h()||u();b=h()?x():e.observable(e.utils.unwrapObservable(c));u()&&b(v(b))}return b}function O(b,c,a){for(var d=0,e=b.length;d<e;d++)if(!0!==a[d]&&b[d]===c)return d;return null}function R(b,c){var a;c&&(a=c(b));"undefined"===f.getType(a)&&(a=b);return e.utils.unwrapObservable(a)}function K(b,c,a){b=e.utils.unwrapObservable(b);for(var d=0,f=b.length;d< f;d++){var l=b[d];if(R(l,a)===c)return l}throw Error("When calling ko.update*, the key '"+c+"' was not found!");}function C(b,c){return e.utils.arrayMap(e.utils.unwrapObservable(b),function(a){return c?R(a,c):a})}function Q(b,c){if("array"===f.getType(b))for(var a=0;a<b.length;a++)c(a);else for(a in b)c(a)}function P(b){var c=f.getType(b);return("object"===c||"array"===c)&&null!==b}function T(){var b=[],c=[];this.save=function(a,d){var f=e.utils.arrayIndexOf(b,a);0<=f?c[f]=d:(b.push(a),c.push(d))}; this.get=function(a){a=e.utils.arrayIndexOf(b,a);return 0<=a?c[a]:void 0}}function S(){var b={},c=function(a){var c;try{c=a}catch(e){c="$$$"}a=b[c];void 0===a&&(a=new T,b[c]=a);return a};this.save=function(a,b){c(a).save(a,b)};this.get=function(a){return c(a).get(a)}}var p="__ko_mapping__",H=e.dependentObservable,B=0,G,I,L=["create","update","key","arrayChanged"],N={},x={include:["_destroy"],ignore:[],copy:[],observe:[]},j=x;f.isMapped=function(b){return(b=e.utils.unwrapObservable(b))&&b[p]};f.fromJS= function(b){if(0==arguments.length)throw Error("When calling ko.fromJS, pass the object you want to convert.");try{B++||(G=[],I=new S);var c,a;2==arguments.length&&(arguments[1][p]?a=arguments[1]:c=arguments[1]);3==arguments.length&&(c=arguments[1],a=arguments[2]);a&&(c=E(c,a[p]));c=z(c);var d=F(a,b,c);a&&(d=a);if(!--B)for(;G.length;){var e=G.pop();e&&(e(),e.__DO.throttleEvaluation=e.throttleEvaluation)}d[p]=E(d[p],c);return d}catch(f){throw B=0,f;}};f.fromJSON=function(b){var c=e.utils.parseJson(b); arguments[0]=c;return f.fromJS.apply(this,arguments)};f.updateFromJS=function(){throw Error("ko.mapping.updateFromJS, use ko.mapping.fromJS instead. Please note that the order of parameters is different!");};f.updateFromJSON=function(){throw Error("ko.mapping.updateFromJSON, use ko.mapping.fromJSON instead. Please note that the order of parameters is different!");};f.toJS=function(b,c){j||f.resetDefaultOptions();if(0==arguments.length)throw Error("When calling ko.mapping.toJS, pass the object you want to convert."); if("array"!==f.getType(j.ignore))throw Error("ko.mapping.defaultOptions().ignore should be an array.");if("array"!==f.getType(j.include))throw Error("ko.mapping.defaultOptions().include should be an array.");if("array"!==f.getType(j.copy))throw Error("ko.mapping.defaultOptions().copy should be an array.");c=z(c,b[p]);return f.visitModel(b,function(a){return e.utils.unwrapObservable(a)},c)};f.toJSON=function(b,c){var a=f.toJS(b,c);return e.utils.stringifyJson(a)};f.defaultOptions=function(){if(0<arguments.length)j= arguments[0];else return j};f.resetDefaultOptions=function(){j={include:x.include.slice(0),ignore:x.ignore.slice(0),copy:x.copy.slice(0)}};f.getType=function(b){if(b&&"object"===typeof b){if(b.constructor===Date)return"date";if(b.constructor===Array)return"array"}return typeof b};f.visitModel=function(b,c,a){a=a||{};a.visitedObjects=a.visitedObjects||new S;var d,k=e.utils.unwrapObservable(b);if(P(k))a=z(a,k[p]),c(b,a.parentName),d="array"===f.getType(k)?[]:{};else return c(b,a.parentName);a.visitedObjects.save(b, d);var l=a.parentName;Q(k,function(b){if(!(a.ignore&&-1!=e.utils.arrayIndexOf(a.ignore,b))){var j=k[b],g=a,h=l||"";"array"===f.getType(k)?l&&(h+="["+b+"]"):(l&&(h+="."),h+=b);g.parentName=h;if(!(-1===e.utils.arrayIndexOf(a.copy,b)&&-1===e.utils.arrayIndexOf(a.include,b)&&k[p]&&k[p].mappedProperties&&!k[p].mappedProperties[b]&&k[p].copiedProperties&&!k[p].copiedProperties[b]&&"array"!==f.getType(k)))switch(f.getType(e.utils.unwrapObservable(j))){case "object":case "array":case "undefined":g=a.visitedObjects.get(j); d[b]="undefined"!==f.getType(g)?g:f.visitModel(j,c,a);break;default:d[b]=c(j,a.parentName)}}});return d}});
9,523
knockout.mapping
js
en
javascript
code
{"qsc_code_num_words": 1945, "qsc_code_num_chars": 9523.0, "qsc_code_mean_word_length": 3.31619537, "qsc_code_frac_words_unique": 0.0966581, "qsc_code_frac_chars_top_2grams": 0.03906977, "qsc_code_frac_chars_top_3grams": 0.07844961, "qsc_code_frac_chars_top_4grams": 0.02651163, "qsc_code_frac_chars_dupe_5grams": 0.28077519, "qsc_code_frac_chars_dupe_6grams": 0.18604651, "qsc_code_frac_chars_dupe_7grams": 0.14728682, "qsc_code_frac_chars_dupe_8grams": 0.12434109, "qsc_code_frac_chars_dupe_9grams": 0.10108527, "qsc_code_frac_chars_dupe_10grams": 0.07162791, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00756757, "qsc_code_frac_chars_whitespace": 0.02866744, "qsc_code_size_file_byte": 9523.0, "qsc_code_num_lines": 22.0, "qsc_code_num_chars_line_max": 539.0, "qsc_code_num_chars_line_mean": 432.86363636, "qsc_code_frac_chars_alphabet": 0.68972973, "qsc_code_frac_chars_comments": 0.01774651, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.10526316, "qsc_code_frac_chars_string_length": 0.10080171, "qsc_code_frac_chars_long_word_length": 0.0161411, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejavascript_cate_ast": 1.0, "qsc_codejavascript_cate_var_zero": 0.0, "qsc_codejavascript_frac_lines_func_ratio": 1.0, "qsc_codejavascript_num_statement_line": 0.05263158, "qsc_codejavascript_score_lines_no_logic": 3.42105263, "qsc_codejavascript_frac_words_legal_var_name": 0.85, "qsc_codejavascript_frac_words_legal_func_name": 1.0, "qsc_codejavascript_frac_words_legal_class_name": null, "qsc_codejavascript_frac_lines_print": 0.0}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 1, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejavascript_cate_ast": 0, "qsc_codejavascript_cate_var_zero": 0, "qsc_codejavascript_frac_lines_func_ratio": 1, "qsc_codejavascript_score_lines_no_logic": 1, "qsc_codejavascript_frac_lines_print": 0}
007revad/Synology_Download_Station_Chrome_Extension
js/lib/bootstrap.min.js
/*! * Bootstrap v3.3.4 (http://getbootstrap.com) * Copyright 2011-2015 Twitter, Inc. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) */ if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){"use strict";var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(a){"use strict";function b(){var a=document.createElement("bootstrap"),b={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var c in b)if(void 0!==a.style[c])return{end:b[c]};return!1}a.fn.emulateTransitionEnd=function(b){var c=!1,d=this;a(this).one("bsTransitionEnd",function(){c=!0});var e=function(){c||a(d).trigger(a.support.transition.end)};return setTimeout(e,b),this},a(function(){a.support.transition=b(),a.support.transition&&(a.event.special.bsTransitionEnd={bindType:a.support.transition.end,delegateType:a.support.transition.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var c=a(this),e=c.data("bs.alert");e||c.data("bs.alert",e=new d(this)),"string"==typeof b&&e[b].call(c)})}var c='[data-dismiss="alert"]',d=function(b){a(b).on("click",c,this.close)};d.VERSION="3.3.4",d.TRANSITION_DURATION=150,d.prototype.close=function(b){function c(){g.detach().trigger("closed.bs.alert").remove()}var e=a(this),f=e.attr("data-target");f||(f=e.attr("href"),f=f&&f.replace(/.*(?=#[^\s]*$)/,""));var g=a(f);b&&b.preventDefault(),g.length||(g=e.closest(".alert")),g.trigger(b=a.Event("close.bs.alert")),b.isDefaultPrevented()||(g.removeClass("in"),a.support.transition&&g.hasClass("fade")?g.one("bsTransitionEnd",c).emulateTransitionEnd(d.TRANSITION_DURATION):c())};var e=a.fn.alert;a.fn.alert=b,a.fn.alert.Constructor=d,a.fn.alert.noConflict=function(){return a.fn.alert=e,this},a(document).on("click.bs.alert.data-api",c,d.prototype.close)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.button"),f="object"==typeof b&&b;e||d.data("bs.button",e=new c(this,f)),"toggle"==b?e.toggle():b&&e.setState(b)})}var c=function(b,d){this.$element=a(b),this.options=a.extend({},c.DEFAULTS,d),this.isLoading=!1};c.VERSION="3.3.4",c.DEFAULTS={loadingText:"loading..."},c.prototype.setState=function(b){var c="disabled",d=this.$element,e=d.is("input")?"val":"html",f=d.data();b+="Text",null==f.resetText&&d.data("resetText",d[e]()),setTimeout(a.proxy(function(){d[e](null==f[b]?this.options[b]:f[b]),"loadingText"==b?(this.isLoading=!0,d.addClass(c).attr(c,c)):this.isLoading&&(this.isLoading=!1,d.removeClass(c).removeAttr(c))},this),0)},c.prototype.toggle=function(){var a=!0,b=this.$element.closest('[data-toggle="buttons"]');if(b.length){var c=this.$element.find("input");"radio"==c.prop("type")&&(c.prop("checked")&&this.$element.hasClass("active")?a=!1:b.find(".active").removeClass("active")),a&&c.prop("checked",!this.$element.hasClass("active")).trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active"));a&&this.$element.toggleClass("active")};var d=a.fn.button;a.fn.button=b,a.fn.button.Constructor=c,a.fn.button.noConflict=function(){return a.fn.button=d,this},a(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(c){var d=a(c.target);d.hasClass("btn")||(d=d.closest(".btn")),b.call(d,"toggle"),c.preventDefault()}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(b){a(b.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(b.type))})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.carousel"),f=a.extend({},c.DEFAULTS,d.data(),"object"==typeof b&&b),g="string"==typeof b?b:f.slide;e||d.data("bs.carousel",e=new c(this,f)),"number"==typeof b?e.to(b):g?e[g]():f.interval&&e.pause().cycle()})}var c=function(b,c){this.$element=a(b),this.$indicators=this.$element.find(".carousel-indicators"),this.options=c,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",a.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",a.proxy(this.pause,this)).on("mouseleave.bs.carousel",a.proxy(this.cycle,this))};c.VERSION="3.3.4",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(a){if(!/input|textarea/i.test(a.target.tagName)){switch(a.which){case 37:this.prev();break;case 39:this.next();break;default:return}a.preventDefault()}},c.prototype.cycle=function(b){return b||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(a.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(a){return this.$items=a.parent().children(".item"),this.$items.index(a||this.$active)},c.prototype.getItemForDirection=function(a,b){var c=this.getItemIndex(b),d="prev"==a&&0===c||"next"==a&&c==this.$items.length-1;if(d&&!this.options.wrap)return b;var e="prev"==a?-1:1,f=(c+e)%this.$items.length;return this.$items.eq(f)},c.prototype.to=function(a){var b=this,c=this.getItemIndex(this.$active=this.$element.find(".item.active"));return a>this.$items.length-1||0>a?void 0:this.sliding?this.$element.one("slid.bs.carousel",function(){b.to(a)}):c==a?this.pause().cycle():this.slide(a>c?"next":"prev",this.$items.eq(a))},c.prototype.pause=function(b){return b||(this.paused=!0),this.$element.find(".next, .prev").length&&a.support.transition&&(this.$element.trigger(a.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){return this.sliding?void 0:this.slide("next")},c.prototype.prev=function(){return this.sliding?void 0:this.slide("prev")},c.prototype.slide=function(b,d){var e=this.$element.find(".item.active"),f=d||this.getItemForDirection(b,e),g=this.interval,h="next"==b?"left":"right",i=this;if(f.hasClass("active"))return this.sliding=!1;var j=f[0],k=a.Event("slide.bs.carousel",{relatedTarget:j,direction:h});if(this.$element.trigger(k),!k.isDefaultPrevented()){if(this.sliding=!0,g&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var l=a(this.$indicators.children()[this.getItemIndex(f)]);l&&l.addClass("active")}var m=a.Event("slid.bs.carousel",{relatedTarget:j,direction:h});return a.support.transition&&this.$element.hasClass("slide")?(f.addClass(b),f[0].offsetWidth,e.addClass(h),f.addClass(h),e.one("bsTransitionEnd",function(){f.removeClass([b,h].join(" ")).addClass("active"),e.removeClass(["active",h].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger(m)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(e.removeClass("active"),f.addClass("active"),this.sliding=!1,this.$element.trigger(m)),g&&this.cycle(),this}};var d=a.fn.carousel;a.fn.carousel=b,a.fn.carousel.Constructor=c,a.fn.carousel.noConflict=function(){return a.fn.carousel=d,this};var e=function(c){var d,e=a(this),f=a(e.attr("data-target")||(d=e.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""));if(f.hasClass("carousel")){var g=a.extend({},f.data(),e.data()),h=e.attr("data-slide-to");h&&(g.interval=!1),b.call(f,g),h&&f.data("bs.carousel").to(h),c.preventDefault()}};a(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),a(window).on("load",function(){a('[data-ride="carousel"]').each(function(){var c=a(this);b.call(c,c.data())})})}(jQuery),+function(a){"use strict";function b(b){var c,d=b.attr("data-target")||(c=b.attr("href"))&&c.replace(/.*(?=#[^\s]+$)/,"");return a(d)}function c(b){return this.each(function(){var c=a(this),e=c.data("bs.collapse"),f=a.extend({},d.DEFAULTS,c.data(),"object"==typeof b&&b);!e&&f.toggle&&/show|hide/.test(b)&&(f.toggle=!1),e||c.data("bs.collapse",e=new d(this,f)),"string"==typeof b&&e[b]()})}var d=function(b,c){this.$element=a(b),this.options=a.extend({},d.DEFAULTS,c),this.$trigger=a('[data-toggle="collapse"][href="#'+b.id+'"],[data-toggle="collapse"][data-target="#'+b.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};d.VERSION="3.3.4",d.TRANSITION_DURATION=350,d.DEFAULTS={toggle:!0},d.prototype.dimension=function(){var a=this.$element.hasClass("width");return a?"width":"height"},d.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var b,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(b=e.data("bs.collapse"),b&&b.transitioning))){var f=a.Event("show.bs.collapse");if(this.$element.trigger(f),!f.isDefaultPrevented()){e&&e.length&&(c.call(e,"hide"),b||e.data("bs.collapse",null));var g=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[g](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var h=function(){this.$element.removeClass("collapsing").addClass("collapse in")[g](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return h.call(this);var i=a.camelCase(["scroll",g].join("-"));this.$element.one("bsTransitionEnd",a.proxy(h,this)).emulateTransitionEnd(d.TRANSITION_DURATION)[g](this.$element[0][i])}}}},d.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var b=a.Event("hide.bs.collapse");if(this.$element.trigger(b),!b.isDefaultPrevented()){var c=this.dimension();this.$element[c](this.$element[c]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var e=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};return a.support.transition?void this.$element[c](0).one("bsTransitionEnd",a.proxy(e,this)).emulateTransitionEnd(d.TRANSITION_DURATION):e.call(this)}}},d.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},d.prototype.getParent=function(){return a(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(c,d){var e=a(d);this.addAriaAndCollapsedClass(b(e),e)},this)).end()},d.prototype.addAriaAndCollapsedClass=function(a,b){var c=a.hasClass("in");a.attr("aria-expanded",c),b.toggleClass("collapsed",!c).attr("aria-expanded",c)};var e=a.fn.collapse;a.fn.collapse=c,a.fn.collapse.Constructor=d,a.fn.collapse.noConflict=function(){return a.fn.collapse=e,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(d){var e=a(this);e.attr("data-target")||d.preventDefault();var f=b(e),g=f.data("bs.collapse"),h=g?"toggle":e.data();c.call(f,h)})}(jQuery),+function(a){"use strict";function b(b){b&&3===b.which||(a(e).remove(),a(f).each(function(){var d=a(this),e=c(d),f={relatedTarget:this};e.hasClass("open")&&(e.trigger(b=a.Event("hide.bs.dropdown",f)),b.isDefaultPrevented()||(d.attr("aria-expanded","false"),e.removeClass("open").trigger("hidden.bs.dropdown",f)))}))}function c(b){var c=b.attr("data-target");c||(c=b.attr("href"),c=c&&/#[A-Za-z]/.test(c)&&c.replace(/.*(?=#[^\s]*$)/,""));var d=c&&a(c);return d&&d.length?d:b.parent()}function d(b){return this.each(function(){var c=a(this),d=c.data("bs.dropdown");d||c.data("bs.dropdown",d=new g(this)),"string"==typeof b&&d[b].call(c)})}var e=".dropdown-backdrop",f='[data-toggle="dropdown"]',g=function(b){a(b).on("click.bs.dropdown",this.toggle)};g.VERSION="3.3.4",g.prototype.toggle=function(d){var e=a(this);if(!e.is(".disabled, :disabled")){var f=c(e),g=f.hasClass("open");if(b(),!g){"ontouchstart"in document.documentElement&&!f.closest(".navbar-nav").length&&a('<div class="dropdown-backdrop"/>').insertAfter(a(this)).on("click",b);var h={relatedTarget:this};if(f.trigger(d=a.Event("show.bs.dropdown",h)),d.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),f.toggleClass("open").trigger("shown.bs.dropdown",h)}return!1}},g.prototype.keydown=function(b){if(/(38|40|27|32)/.test(b.which)&&!/input|textarea/i.test(b.target.tagName)){var d=a(this);if(b.preventDefault(),b.stopPropagation(),!d.is(".disabled, :disabled")){var e=c(d),g=e.hasClass("open");if(!g&&27!=b.which||g&&27==b.which)return 27==b.which&&e.find(f).trigger("focus"),d.trigger("click");var h=" li:not(.disabled):visible a",i=e.find('[role="menu"]'+h+', [role="listbox"]'+h);if(i.length){var j=i.index(b.target);38==b.which&&j>0&&j--,40==b.which&&j<i.length-1&&j++,~j||(j=0),i.eq(j).trigger("focus")}}}};var h=a.fn.dropdown;a.fn.dropdown=d,a.fn.dropdown.Constructor=g,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=h,this},a(document).on("click.bs.dropdown.data-api",b).on("click.bs.dropdown.data-api",".dropdown form",function(a){a.stopPropagation()}).on("click.bs.dropdown.data-api",f,g.prototype.toggle).on("keydown.bs.dropdown.data-api",f,g.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="menu"]',g.prototype.keydown).on("keydown.bs.dropdown.data-api",'[role="listbox"]',g.prototype.keydown)}(jQuery),+function(a){"use strict";function b(b,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},c.DEFAULTS,e.data(),"object"==typeof b&&b);f||e.data("bs.modal",f=new c(this,g)),"string"==typeof b?f[b](d):g.show&&f.show(d)})}var c=function(b,c){this.options=c,this.$body=a(document.body),this.$element=a(b),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};c.VERSION="3.3.4",c.TRANSITION_DURATION=300,c.BACKDROP_TRANSITION_DURATION=150,c.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},c.prototype.toggle=function(a){return this.isShown?this.hide():this.show(a)},c.prototype.show=function(b){var d=this,e=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(e),this.isShown||e.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){d.$element.one("mouseup.dismiss.bs.modal",function(b){a(b.target).is(d.$element)&&(d.ignoreBackdropClick=!0)})}),this.backdrop(function(){var e=a.support.transition&&d.$element.hasClass("fade");d.$element.parent().length||d.$element.appendTo(d.$body),d.$element.show().scrollTop(0),d.adjustDialog(),e&&d.$element[0].offsetWidth,d.$element.addClass("in").attr("aria-hidden",!1),d.enforceFocus();var f=a.Event("shown.bs.modal",{relatedTarget:b});e?d.$dialog.one("bsTransitionEnd",function(){d.$element.trigger("focus").trigger(f)}).emulateTransitionEnd(c.TRANSITION_DURATION):d.$element.trigger("focus").trigger(f)}))},c.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b),this.isShown&&!b.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(c.TRANSITION_DURATION):this.hideModal())},c.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]===a.target||this.$element.has(a.target).length||this.$element.trigger("focus")},this))},c.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(a){27==a.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},c.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},c.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.$body.removeClass("modal-open"),a.resetAdjustments(),a.resetScrollbar(),a.$element.trigger("hidden.bs.modal")})},c.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},c.prototype.backdrop=function(b){var d=this,e=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var f=a.support.transition&&e;if(this.$backdrop=a('<div class="modal-backdrop '+e+'" />').appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(a){return this.ignoreBackdropClick?void(this.ignoreBackdropClick=!1):void(a.target===a.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide()))},this)),f&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!b)return;f?this.$backdrop.one("bsTransitionEnd",b).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):b()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var g=function(){d.removeBackdrop(),b&&b()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",g).emulateTransitionEnd(c.BACKDROP_TRANSITION_DURATION):g()}else b&&b()},c.prototype.handleUpdate=function(){this.adjustDialog()},c.prototype.adjustDialog=function(){var a=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&a?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!a?this.scrollbarWidth:""})},c.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},c.prototype.checkScrollbar=function(){var a=window.innerWidth;if(!a){var b=document.documentElement.getBoundingClientRect();a=b.right-Math.abs(b.left)}this.bodyIsOverflowing=document.body.clientWidth<a,this.scrollbarWidth=this.measureScrollbar()},c.prototype.setScrollbar=function(){var a=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"",this.bodyIsOverflowing&&this.$body.css("padding-right",a+this.scrollbarWidth)},c.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad)},c.prototype.measureScrollbar=function(){var a=document.createElement("div");a.className="modal-scrollbar-measure",this.$body.append(a);var b=a.offsetWidth-a.clientWidth;return this.$body[0].removeChild(a),b};var d=a.fn.modal;a.fn.modal=b,a.fn.modal.Constructor=c,a.fn.modal.noConflict=function(){return a.fn.modal=d,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(c){var d=a(this),e=d.attr("href"),f=a(d.attr("data-target")||e&&e.replace(/.*(?=#[^\s]+$)/,"")),g=f.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(e)&&e},f.data(),d.data());d.is("a")&&c.preventDefault(),f.one("show.bs.modal",function(a){a.isDefaultPrevented()||f.one("hidden.bs.modal",function(){d.is(":visible")&&d.trigger("focus")})}),b.call(f,g,this)})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tooltip"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.tooltip",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.init("tooltip",a,b)};c.VERSION="3.3.4",c.TRANSITION_DURATION=150,c.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0}},c.prototype.init=function(b,c,d){if(this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.$viewport=this.options.viewport&&a(this.options.viewport.selector||this.options.viewport),this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var e=this.options.trigger.split(" "),f=e.length;f--;){var g=e[f];if("click"==g)this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if("manual"!=g){var h="hover"==g?"mouseenter":"focusin",i="hover"==g?"mouseleave":"focusout";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&"number"==typeof b.delay&&(b.delay={show:b.delay,hide:b.delay}),b},c.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},c.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c&&c.$tip&&c.$tip.is(":visible")?void(c.hoverState="in"):(c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="in",c.options.delay&&c.options.delay.show?void(c.timeout=setTimeout(function(){"in"==c.hoverState&&c.show()},c.options.delay.show)):c.show())},c.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget).data("bs."+this.type);return c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c)),clearTimeout(c.timeout),c.hoverState="out",c.options.delay&&c.options.delay.hide?void(c.timeout=setTimeout(function(){"out"==c.hoverState&&c.hide()},c.options.delay.hide)):c.hide()},c.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);var d=a.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(b.isDefaultPrevented()||!d)return;var e=this,f=this.tip(),g=this.getUID(this.type);this.setContent(),f.attr("id",g),this.$element.attr("aria-describedby",g),this.options.animation&&f.addClass("fade");var h="function"==typeof this.options.placement?this.options.placement.call(this,f[0],this.$element[0]):this.options.placement,i=/\s?auto?\s?/i,j=i.test(h);j&&(h=h.replace(i,"")||"top"),f.detach().css({top:0,left:0,display:"block"}).addClass(h).data("bs."+this.type,this),this.options.container?f.appendTo(this.options.container):f.insertAfter(this.$element);var k=this.getPosition(),l=f[0].offsetWidth,m=f[0].offsetHeight;if(j){var n=h,o=this.options.container?a(this.options.container):this.$element.parent(),p=this.getPosition(o);h="bottom"==h&&k.bottom+m>p.bottom?"top":"top"==h&&k.top-m<p.top?"bottom":"right"==h&&k.right+l>p.width?"left":"left"==h&&k.left-l<p.left?"right":h,f.removeClass(n).addClass(h)}var q=this.getCalculatedOffset(h,k,l,m);this.applyPlacement(q,h);var r=function(){var a=e.hoverState;e.$element.trigger("shown.bs."+e.type),e.hoverState=null,"out"==a&&e.leave(e)};a.support.transition&&this.$tip.hasClass("fade")?f.one("bsTransitionEnd",r).emulateTransitionEnd(c.TRANSITION_DURATION):r()}},c.prototype.applyPlacement=function(b,c){var d=this.tip(),e=d[0].offsetWidth,f=d[0].offsetHeight,g=parseInt(d.css("margin-top"),10),h=parseInt(d.css("margin-left"),10);isNaN(g)&&(g=0),isNaN(h)&&(h=0),b.top=b.top+g,b.left=b.left+h,a.offset.setOffset(d[0],a.extend({using:function(a){d.css({top:Math.round(a.top),left:Math.round(a.left)})}},b),0),d.addClass("in");var i=d[0].offsetWidth,j=d[0].offsetHeight;"top"==c&&j!=f&&(b.top=b.top+f-j);var k=this.getViewportAdjustedDelta(c,b,i,j);k.left?b.left+=k.left:b.top+=k.top;var l=/top|bottom/.test(c),m=l?2*k.left-e+i:2*k.top-f+j,n=l?"offsetWidth":"offsetHeight";d.offset(b),this.replaceArrow(m,d[0][n],l)},c.prototype.replaceArrow=function(a,b,c){this.arrow().css(c?"left":"top",50*(1-a/b)+"%").css(c?"top":"left","")},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle();a.find(".tooltip-inner")[this.options.html?"html":"text"](b),a.removeClass("fade in top bottom left right")},c.prototype.hide=function(b){function d(){"in"!=e.hoverState&&f.detach(),e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),b&&b()}var e=this,f=a(this.$tip),g=a.Event("hide.bs."+this.type);return this.$element.trigger(g),g.isDefaultPrevented()?void 0:(f.removeClass("in"),a.support.transition&&f.hasClass("fade")?f.one("bsTransitionEnd",d).emulateTransitionEnd(c.TRANSITION_DURATION):d(),this.hoverState=null,this)},c.prototype.fixTitle=function(){var a=this.$element;(a.attr("title")||"string"!=typeof a.attr("data-original-title"))&&a.attr("data-original-title",a.attr("title")||"").attr("title","")},c.prototype.hasContent=function(){return this.getTitle()},c.prototype.getPosition=function(b){b=b||this.$element;var c=b[0],d="BODY"==c.tagName,e=c.getBoundingClientRect();null==e.width&&(e=a.extend({},e,{width:e.right-e.left,height:e.bottom-e.top}));var f=d?{top:0,left:0}:b.offset(),g={scroll:d?document.documentElement.scrollTop||document.body.scrollTop:b.scrollTop()},h=d?{width:a(window).width(),height:a(window).height()}:null;return a.extend({},e,g,h,f)},c.prototype.getCalculatedOffset=function(a,b,c,d){return"bottom"==a?{top:b.top+b.height,left:b.left+b.width/2-c/2}:"top"==a?{top:b.top-d,left:b.left+b.width/2-c/2}:"left"==a?{top:b.top+b.height/2-d/2,left:b.left-c}:{top:b.top+b.height/2-d/2,left:b.left+b.width}},c.prototype.getViewportAdjustedDelta=function(a,b,c,d){var e={top:0,left:0};if(!this.$viewport)return e;var f=this.options.viewport&&this.options.viewport.padding||0,g=this.getPosition(this.$viewport);if(/right|left/.test(a)){var h=b.top-f-g.scroll,i=b.top+f-g.scroll+d;h<g.top?e.top=g.top-h:i>g.top+g.height&&(e.top=g.top+g.height-i)}else{var j=b.left-f,k=b.left+f+c;j<g.left?e.left=g.left-j:k>g.width&&(e.left=g.left+g.width-k)}return e},c.prototype.getTitle=function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||("function"==typeof c.title?c.title.call(b[0]):c.title)},c.prototype.getUID=function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},c.prototype.tip=function(){return this.$tip=this.$tip||a(this.options.template)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},c.prototype.enable=function(){this.enabled=!0},c.prototype.disable=function(){this.enabled=!1},c.prototype.toggleEnabled=function(){this.enabled=!this.enabled},c.prototype.toggle=function(b){var c=this;b&&(c=a(b.currentTarget).data("bs."+this.type),c||(c=new this.constructor(b.currentTarget,this.getDelegateOptions()),a(b.currentTarget).data("bs."+this.type,c))),c.tip().hasClass("in")?c.leave(c):c.enter(c)},c.prototype.destroy=function(){var a=this;clearTimeout(this.timeout),this.hide(function(){a.$element.off("."+a.type).removeData("bs."+a.type)})};var d=a.fn.tooltip;a.fn.tooltip=b,a.fn.tooltip.Constructor=c,a.fn.tooltip.noConflict=function(){return a.fn.tooltip=d,this}}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f="object"==typeof b&&b;(e||!/destroy|hide/.test(b))&&(e||d.data("bs.popover",e=new c(this,f)),"string"==typeof b&&e[b]())})}var c=function(a,b){this.init("popover",a,b)};if(!a.fn.tooltip)throw new Error("Popover requires tooltip.js");c.VERSION="3.3.4",c.DEFAULTS=a.extend({},a.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),c.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),c.prototype.constructor=c,c.prototype.getDefaults=function(){return c.DEFAULTS},c.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content").children().detach().end()[this.options.html?"string"==typeof c?"html":"append":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},c.prototype.hasContent=function(){return this.getTitle()||this.getContent()},c.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||("function"==typeof b.content?b.content.call(a[0]):b.content)},c.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var d=a.fn.popover;a.fn.popover=b,a.fn.popover.Constructor=c,a.fn.popover.noConflict=function(){return a.fn.popover=d,this}}(jQuery),+function(a){"use strict";function b(c,d){this.$body=a(document.body),this.$scrollElement=a(a(c).is(document.body)?window:c),this.options=a.extend({},b.DEFAULTS,d),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",a.proxy(this.process,this)),this.refresh(),this.process()}function c(c){return this.each(function(){var d=a(this),e=d.data("bs.scrollspy"),f="object"==typeof c&&c;e||d.data("bs.scrollspy",e=new b(this,f)),"string"==typeof c&&e[c]()})}b.VERSION="3.3.4",b.DEFAULTS={offset:10},b.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},b.prototype.refresh=function(){var b=this,c="offset",d=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),a.isWindow(this.$scrollElement[0])||(c="position",d=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var b=a(this),e=b.data("target")||b.attr("href"),f=/^#./.test(e)&&a(e);return f&&f.length&&f.is(":visible")&&[[f[c]().top+d,e]]||null}).sort(function(a,b){return a[0]-b[0]}).each(function(){b.offsets.push(this[0]),b.targets.push(this[1])})},b.prototype.process=function(){var a,b=this.$scrollElement.scrollTop()+this.options.offset,c=this.getScrollHeight(),d=this.options.offset+c-this.$scrollElement.height(),e=this.offsets,f=this.targets,g=this.activeTarget;if(this.scrollHeight!=c&&this.refresh(),b>=d)return g!=(a=f[f.length-1])&&this.activate(a);if(g&&b<e[0])return this.activeTarget=null,this.clear();for(a=e.length;a--;)g!=f[a]&&b>=e[a]&&(void 0===e[a+1]||b<e[a+1])&&this.activate(f[a])},b.prototype.activate=function(b){this.activeTarget=b,this.clear();var c=this.selector+'[data-target="'+b+'"],'+this.selector+'[href="'+b+'"]',d=a(c).parents("li").addClass("active");d.parent(".dropdown-menu").length&&(d=d.closest("li.dropdown").addClass("active")),d.trigger("activate.bs.scrollspy")},b.prototype.clear=function(){a(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var d=a.fn.scrollspy;a.fn.scrollspy=c,a.fn.scrollspy.Constructor=b,a.fn.scrollspy.noConflict=function(){return a.fn.scrollspy=d,this},a(window).on("load.bs.scrollspy.data-api",function(){a('[data-spy="scroll"]').each(function(){var b=a(this);c.call(b,b.data())})})}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.tab");e||d.data("bs.tab",e=new c(this)),"string"==typeof b&&e[b]()})}var c=function(b){this.element=a(b)};c.VERSION="3.3.4",c.TRANSITION_DURATION=150,c.prototype.show=function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.data("target");if(d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),!b.parent("li").hasClass("active")){ var e=c.find(".active:last a"),f=a.Event("hide.bs.tab",{relatedTarget:b[0]}),g=a.Event("show.bs.tab",{relatedTarget:e[0]});if(e.trigger(f),b.trigger(g),!g.isDefaultPrevented()&&!f.isDefaultPrevented()){var h=a(d);this.activate(b.closest("li"),c),this.activate(h,h.parent(),function(){e.trigger({type:"hidden.bs.tab",relatedTarget:b[0]}),b.trigger({type:"shown.bs.tab",relatedTarget:e[0]})})}}},c.prototype.activate=function(b,d,e){function f(){g.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),b.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),h?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu").length&&b.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),e&&e()}var g=d.find("> .active"),h=e&&a.support.transition&&(g.length&&g.hasClass("fade")||!!d.find("> .fade").length);g.length&&h?g.one("bsTransitionEnd",f).emulateTransitionEnd(c.TRANSITION_DURATION):f(),g.removeClass("in")};var d=a.fn.tab;a.fn.tab=b,a.fn.tab.Constructor=c,a.fn.tab.noConflict=function(){return a.fn.tab=d,this};var e=function(c){c.preventDefault(),b.call(a(this),"show")};a(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',e).on("click.bs.tab.data-api",'[data-toggle="pill"]',e)}(jQuery),+function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.affix"),f="object"==typeof b&&b;e||d.data("bs.affix",e=new c(this,f)),"string"==typeof b&&e[b]()})}var c=function(b,d){this.options=a.extend({},c.DEFAULTS,d),this.$target=a(this.options.target).on("scroll.bs.affix.data-api",a.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",a.proxy(this.checkPositionWithEventLoop,this)),this.$element=a(b),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};c.VERSION="3.3.4",c.RESET="affix affix-top affix-bottom",c.DEFAULTS={offset:0,target:window},c.prototype.getState=function(a,b,c,d){var e=this.$target.scrollTop(),f=this.$element.offset(),g=this.$target.height();if(null!=c&&"top"==this.affixed)return c>e?"top":!1;if("bottom"==this.affixed)return null!=c?e+this.unpin<=f.top?!1:"bottom":a-d>=e+g?!1:"bottom";var h=null==this.affixed,i=h?e:f.top,j=h?g:b;return null!=c&&c>=e?"top":null!=d&&i+j>=a-d?"bottom":!1},c.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(c.RESET).addClass("affix");var a=this.$target.scrollTop(),b=this.$element.offset();return this.pinnedOffset=b.top-a},c.prototype.checkPositionWithEventLoop=function(){setTimeout(a.proxy(this.checkPosition,this),1)},c.prototype.checkPosition=function(){if(this.$element.is(":visible")){var b=this.$element.height(),d=this.options.offset,e=d.top,f=d.bottom,g=a(document.body).height();"object"!=typeof d&&(f=e=d),"function"==typeof e&&(e=d.top(this.$element)),"function"==typeof f&&(f=d.bottom(this.$element));var h=this.getState(g,b,e,f);if(this.affixed!=h){null!=this.unpin&&this.$element.css("top","");var i="affix"+(h?"-"+h:""),j=a.Event(i+".bs.affix");if(this.$element.trigger(j),j.isDefaultPrevented())return;this.affixed=h,this.unpin="bottom"==h?this.getPinnedOffset():null,this.$element.removeClass(c.RESET).addClass(i).trigger(i.replace("affix","affixed")+".bs.affix")}"bottom"==h&&this.$element.offset({top:g-b-f})}};var d=a.fn.affix;a.fn.affix=b,a.fn.affix.Constructor=c,a.fn.affix.noConflict=function(){return a.fn.affix=d,this},a(window).on("load",function(){a('[data-spy="affix"]').each(function(){var c=a(this),d=c.data();d.offset=d.offset||{},null!=d.offsetBottom&&(d.offset.bottom=d.offsetBottom),null!=d.offsetTop&&(d.offset.top=d.offsetTop),b.call(c,d)})})}(jQuery);
35,951
bootstrap.min
js
en
javascript
code
{"qsc_code_num_words": 6069, "qsc_code_num_chars": 35951.0, "qsc_code_mean_word_length": 4.24979404, "qsc_code_frac_words_unique": 0.06821552, "qsc_code_frac_chars_top_2grams": 0.04051644, "qsc_code_frac_chars_top_3grams": 0.00387717, "qsc_code_frac_chars_top_4grams": 0.00434243, "qsc_code_frac_chars_dupe_5grams": 0.30842897, "qsc_code_frac_chars_dupe_6grams": 0.20905707, "qsc_code_frac_chars_dupe_7grams": 0.15849876, "qsc_code_frac_chars_dupe_8grams": 0.12631824, "qsc_code_frac_chars_dupe_9grams": 0.08979529, "qsc_code_frac_chars_dupe_10grams": 0.07037066, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00745765, "qsc_code_frac_chars_whitespace": 0.01159912, "qsc_code_size_file_byte": 35951.0, "qsc_code_num_lines": 7.0, "qsc_code_num_chars_line_max": 32026.0, "qsc_code_num_chars_line_mean": 5135.85714286, "qsc_code_frac_chars_alphabet": 0.71838239, "qsc_code_frac_chars_comments": 0.00467303, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 1.0, "qsc_code_frac_chars_string_length": 0.15140845, "qsc_code_frac_chars_long_word_length": 0.03747485, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejavascript_cate_ast": 1.0, "qsc_codejavascript_cate_var_zero": 0.0, "qsc_codejavascript_frac_lines_func_ratio": 18.0, "qsc_codejavascript_num_statement_line": 1.0, "qsc_codejavascript_score_lines_no_logic": 32.0, "qsc_codejavascript_frac_words_legal_var_name": 1.0, "qsc_codejavascript_frac_words_legal_func_name": 1.0, "qsc_codejavascript_frac_words_legal_class_name": null, "qsc_codejavascript_frac_lines_print": 0.0}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 1, "qsc_code_num_chars_line_max": 1, "qsc_code_num_chars_line_mean": 1, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 1, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejavascript_cate_ast": 0, "qsc_codejavascript_cate_var_zero": 0, "qsc_codejavascript_frac_lines_func_ratio": 1, "qsc_codejavascript_score_lines_no_logic": 1, "qsc_codejavascript_frac_lines_print": 0}
007revad/Synology_Download_Station_Chrome_Extension
js/lib/md5.js
/** * [js-md5]{@link https://github.com/emn178/js-md5} * * @namespace md5 * @version 0.4.1 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2014-2016 * @license MIT */ (function (root) { 'use strict'; var NODE_JS = typeof process == 'object' && process.versions && process.versions.node; if (NODE_JS) { root = global; } var COMMON_JS = !root.JS_MD5_TEST && typeof module == 'object' && module.exports; var AMD = typeof define == 'function' && define.amd; var ARRAY_BUFFER = !root.JS_MD5_TEST && typeof ArrayBuffer != 'undefined'; var HEX_CHARS = '0123456789abcdef'.split(''); var EXTRA = [128, 32768, 8388608, -2147483648]; var SHIFT = [0, 8, 16, 24]; var OUTPUT_TYPES = ['hex', 'array', 'digest', 'buffer', 'arrayBuffer']; var blocks = [], buffer8; if (ARRAY_BUFFER) { var buffer = new ArrayBuffer(68); buffer8 = new Uint8Array(buffer); blocks = new Uint32Array(buffer); } /** * @method hex * @memberof md5 * @description Output hash as hex string * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash * @returns {String} Hex string * @example * md5.hex('The quick brown fox jumps over the lazy dog'); * // equal to * md5('The quick brown fox jumps over the lazy dog'); */ /** * @method digest * @memberof md5 * @description Output hash as bytes array * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash * @returns {Array} Bytes array * @example * md5.digest('The quick brown fox jumps over the lazy dog'); */ /** * @method array * @memberof md5 * @description Output hash as bytes array * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash * @returns {Array} Bytes array * @example * md5.array('The quick brown fox jumps over the lazy dog'); */ /** * @method arrayBuffer * @memberof md5 * @description Output hash as ArrayBuffer * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash * @returns {ArrayBuffer} ArrayBuffer * @example * md5.arrayBuffer('The quick brown fox jumps over the lazy dog'); */ /** * @method buffer * @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead. * @memberof md5 * @description Output hash as ArrayBuffer * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash * @returns {ArrayBuffer} ArrayBuffer * @example * md5.buffer('The quick brown fox jumps over the lazy dog'); */ var createOutputMethod = function (outputType) { return function (message) { return new Md5(true).update(message)[outputType](); }; }; /** * @method create * @memberof md5 * @description Create Md5 object * @returns {Md5} Md5 object. * @example * var hash = md5.create(); */ /** * @method update * @memberof md5 * @description Create and update Md5 object * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash * @returns {Md5} Md5 object. * @example * var hash = md5.update('The quick brown fox jumps over the lazy dog'); * // equal to * var hash = md5.create(); * hash.update('The quick brown fox jumps over the lazy dog'); */ var createMethod = function () { var method = createOutputMethod('hex'); if (NODE_JS) { method = nodeWrap(method); } method.create = function () { return new Md5(); }; method.update = function (message) { return method.create().update(message); }; for (var i = 0;i < OUTPUT_TYPES.length;++i) { var type = OUTPUT_TYPES[i]; method[type] = createOutputMethod(type); } return method; }; var nodeWrap = function (method) { var crypto, Buffer; try { if (root.JS_MD5_TEST) { throw 'JS_MD5_TEST'; } crypto = require('crypto'); Buffer = require('buffer').Buffer; } catch (e) { console.log(e); return method; } var nodeMethod = function (message) { if (typeof message == 'string') { return crypto.createHash('md5').update(message, 'utf8').digest('hex'); } else if (message.constructor == ArrayBuffer) { message = new Uint8Array(message); } else if (message.length === undefined) { return method(message); } return crypto.createHash('md5').update(new Buffer(message)).digest('hex'); }; return nodeMethod; }; /** * Md5 class * @class Md5 * @description This is internal class. * @see {@link md5.create} */ function Md5(sharedMemory) { if (sharedMemory) { blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0; this.blocks = blocks; this.buffer8 = buffer8; } else { if (ARRAY_BUFFER) { var buffer = new ArrayBuffer(68); this.buffer8 = new Uint8Array(buffer); this.blocks = new Uint32Array(buffer); } else { this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; } } this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = 0; this.finalized = this.hashed = false; this.first = true; } /** * @method update * @memberof Md5 * @instance * @description Update hash * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash * @returns {Md5} Md5 object. * @see {@link md5.update} */ Md5.prototype.update = function (message) { if (this.finalized) { return; } var notString = typeof(message) != 'string'; if (notString && message.constructor == root.ArrayBuffer) { message = new Uint8Array(message); } var code, index = 0, i, length = message.length || 0, blocks = this.blocks; var buffer8 = this.buffer8; while (index < length) { if (this.hashed) { this.hashed = false; blocks[0] = blocks[16]; blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0; } if (notString) { if (ARRAY_BUFFER) { for (i = this.start;index < length && i < 64; ++index) { buffer8[i++] = message[index]; } } else { for (i = this.start;index < length && i < 64; ++index) { blocks[i >> 2] |= message[index] << SHIFT[i++ & 3]; } } } else { if (ARRAY_BUFFER) { for (i = this.start;index < length && i < 64; ++index) { code = message.charCodeAt(index); if (code < 0x80) { buffer8[i++] = code; } else if (code < 0x800) { buffer8[i++] = 0xc0 | (code >> 6); buffer8[i++] = 0x80 | (code & 0x3f); } else if (code < 0xd800 || code >= 0xe000) { buffer8[i++] = 0xe0 | (code >> 12); buffer8[i++] = 0x80 | ((code >> 6) & 0x3f); buffer8[i++] = 0x80 | (code & 0x3f); } else { code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); buffer8[i++] = 0xf0 | (code >> 18); buffer8[i++] = 0x80 | ((code >> 12) & 0x3f); buffer8[i++] = 0x80 | ((code >> 6) & 0x3f); buffer8[i++] = 0x80 | (code & 0x3f); } } } else { for (i = this.start;index < length && i < 64; ++index) { code = message.charCodeAt(index); if (code < 0x80) { blocks[i >> 2] |= code << SHIFT[i++ & 3]; } else if (code < 0x800) { blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; } else if (code < 0xd800 || code >= 0xe000) { blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; } else { code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff)); blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3]; blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3]; } } } } this.lastByteIndex = i; this.bytes += i - this.start; if (i >= 64) { this.start = i - 64; this.hash(); this.hashed = true; } else { this.start = i; } } return this; }; Md5.prototype.finalize = function () { if (this.finalized) { return; } this.finalized = true; var blocks = this.blocks, i = this.lastByteIndex; blocks[i >> 2] |= EXTRA[i & 3]; if (i >= 56) { if (!this.hashed) { this.hash(); } blocks[0] = blocks[16]; blocks[16] = blocks[1] = blocks[2] = blocks[3] = blocks[4] = blocks[5] = blocks[6] = blocks[7] = blocks[8] = blocks[9] = blocks[10] = blocks[11] = blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0; } blocks[14] = this.bytes << 3; this.hash(); }; Md5.prototype.hash = function () { var a, b, c, d, bc, da, blocks = this.blocks; if (this.first) { a = blocks[0] - 680876937; a = (a << 7 | a >>> 25) - 271733879 << 0; d = (-1732584194 ^ a & 2004318071) + blocks[1] - 117830708; d = (d << 12 | d >>> 20) + a << 0; c = (-271733879 ^ (d & (a ^ -271733879))) + blocks[2] - 1126478375; c = (c << 17 | c >>> 15) + d << 0; b = (a ^ (c & (d ^ a))) + blocks[3] - 1316259209; b = (b << 22 | b >>> 10) + c << 0; } else { a = this.h0; b = this.h1; c = this.h2; d = this.h3; a += (d ^ (b & (c ^ d))) + blocks[0] - 680876936; a = (a << 7 | a >>> 25) + b << 0; d += (c ^ (a & (b ^ c))) + blocks[1] - 389564586; d = (d << 12 | d >>> 20) + a << 0; c += (b ^ (d & (a ^ b))) + blocks[2] + 606105819; c = (c << 17 | c >>> 15) + d << 0; b += (a ^ (c & (d ^ a))) + blocks[3] - 1044525330; b = (b << 22 | b >>> 10) + c << 0; } a += (d ^ (b & (c ^ d))) + blocks[4] - 176418897; a = (a << 7 | a >>> 25) + b << 0; d += (c ^ (a & (b ^ c))) + blocks[5] + 1200080426; d = (d << 12 | d >>> 20) + a << 0; c += (b ^ (d & (a ^ b))) + blocks[6] - 1473231341; c = (c << 17 | c >>> 15) + d << 0; b += (a ^ (c & (d ^ a))) + blocks[7] - 45705983; b = (b << 22 | b >>> 10) + c << 0; a += (d ^ (b & (c ^ d))) + blocks[8] + 1770035416; a = (a << 7 | a >>> 25) + b << 0; d += (c ^ (a & (b ^ c))) + blocks[9] - 1958414417; d = (d << 12 | d >>> 20) + a << 0; c += (b ^ (d & (a ^ b))) + blocks[10] - 42063; c = (c << 17 | c >>> 15) + d << 0; b += (a ^ (c & (d ^ a))) + blocks[11] - 1990404162; b = (b << 22 | b >>> 10) + c << 0; a += (d ^ (b & (c ^ d))) + blocks[12] + 1804603682; a = (a << 7 | a >>> 25) + b << 0; d += (c ^ (a & (b ^ c))) + blocks[13] - 40341101; d = (d << 12 | d >>> 20) + a << 0; c += (b ^ (d & (a ^ b))) + blocks[14] - 1502002290; c = (c << 17 | c >>> 15) + d << 0; b += (a ^ (c & (d ^ a))) + blocks[15] + 1236535329; b = (b << 22 | b >>> 10) + c << 0; a += (c ^ (d & (b ^ c))) + blocks[1] - 165796510; a = (a << 5 | a >>> 27) + b << 0; d += (b ^ (c & (a ^ b))) + blocks[6] - 1069501632; d = (d << 9 | d >>> 23) + a << 0; c += (a ^ (b & (d ^ a))) + blocks[11] + 643717713; c = (c << 14 | c >>> 18) + d << 0; b += (d ^ (a & (c ^ d))) + blocks[0] - 373897302; b = (b << 20 | b >>> 12) + c << 0; a += (c ^ (d & (b ^ c))) + blocks[5] - 701558691; a = (a << 5 | a >>> 27) + b << 0; d += (b ^ (c & (a ^ b))) + blocks[10] + 38016083; d = (d << 9 | d >>> 23) + a << 0; c += (a ^ (b & (d ^ a))) + blocks[15] - 660478335; c = (c << 14 | c >>> 18) + d << 0; b += (d ^ (a & (c ^ d))) + blocks[4] - 405537848; b = (b << 20 | b >>> 12) + c << 0; a += (c ^ (d & (b ^ c))) + blocks[9] + 568446438; a = (a << 5 | a >>> 27) + b << 0; d += (b ^ (c & (a ^ b))) + blocks[14] - 1019803690; d = (d << 9 | d >>> 23) + a << 0; c += (a ^ (b & (d ^ a))) + blocks[3] - 187363961; c = (c << 14 | c >>> 18) + d << 0; b += (d ^ (a & (c ^ d))) + blocks[8] + 1163531501; b = (b << 20 | b >>> 12) + c << 0; a += (c ^ (d & (b ^ c))) + blocks[13] - 1444681467; a = (a << 5 | a >>> 27) + b << 0; d += (b ^ (c & (a ^ b))) + blocks[2] - 51403784; d = (d << 9 | d >>> 23) + a << 0; c += (a ^ (b & (d ^ a))) + blocks[7] + 1735328473; c = (c << 14 | c >>> 18) + d << 0; b += (d ^ (a & (c ^ d))) + blocks[12] - 1926607734; b = (b << 20 | b >>> 12) + c << 0; bc = b ^ c; a += (bc ^ d) + blocks[5] - 378558; a = (a << 4 | a >>> 28) + b << 0; d += (bc ^ a) + blocks[8] - 2022574463; d = (d << 11 | d >>> 21) + a << 0; da = d ^ a; c += (da ^ b) + blocks[11] + 1839030562; c = (c << 16 | c >>> 16) + d << 0; b += (da ^ c) + blocks[14] - 35309556; b = (b << 23 | b >>> 9) + c << 0; bc = b ^ c; a += (bc ^ d) + blocks[1] - 1530992060; a = (a << 4 | a >>> 28) + b << 0; d += (bc ^ a) + blocks[4] + 1272893353; d = (d << 11 | d >>> 21) + a << 0; da = d ^ a; c += (da ^ b) + blocks[7] - 155497632; c = (c << 16 | c >>> 16) + d << 0; b += (da ^ c) + blocks[10] - 1094730640; b = (b << 23 | b >>> 9) + c << 0; bc = b ^ c; a += (bc ^ d) + blocks[13] + 681279174; a = (a << 4 | a >>> 28) + b << 0; d += (bc ^ a) + blocks[0] - 358537222; d = (d << 11 | d >>> 21) + a << 0; da = d ^ a; c += (da ^ b) + blocks[3] - 722521979; c = (c << 16 | c >>> 16) + d << 0; b += (da ^ c) + blocks[6] + 76029189; b = (b << 23 | b >>> 9) + c << 0; bc = b ^ c; a += (bc ^ d) + blocks[9] - 640364487; a = (a << 4 | a >>> 28) + b << 0; d += (bc ^ a) + blocks[12] - 421815835; d = (d << 11 | d >>> 21) + a << 0; da = d ^ a; c += (da ^ b) + blocks[15] + 530742520; c = (c << 16 | c >>> 16) + d << 0; b += (da ^ c) + blocks[2] - 995338651; b = (b << 23 | b >>> 9) + c << 0; a += (c ^ (b | ~d)) + blocks[0] - 198630844; a = (a << 6 | a >>> 26) + b << 0; d += (b ^ (a | ~c)) + blocks[7] + 1126891415; d = (d << 10 | d >>> 22) + a << 0; c += (a ^ (d | ~b)) + blocks[14] - 1416354905; c = (c << 15 | c >>> 17) + d << 0; b += (d ^ (c | ~a)) + blocks[5] - 57434055; b = (b << 21 | b >>> 11) + c << 0; a += (c ^ (b | ~d)) + blocks[12] + 1700485571; a = (a << 6 | a >>> 26) + b << 0; d += (b ^ (a | ~c)) + blocks[3] - 1894986606; d = (d << 10 | d >>> 22) + a << 0; c += (a ^ (d | ~b)) + blocks[10] - 1051523; c = (c << 15 | c >>> 17) + d << 0; b += (d ^ (c | ~a)) + blocks[1] - 2054922799; b = (b << 21 | b >>> 11) + c << 0; a += (c ^ (b | ~d)) + blocks[8] + 1873313359; a = (a << 6 | a >>> 26) + b << 0; d += (b ^ (a | ~c)) + blocks[15] - 30611744; d = (d << 10 | d >>> 22) + a << 0; c += (a ^ (d | ~b)) + blocks[6] - 1560198380; c = (c << 15 | c >>> 17) + d << 0; b += (d ^ (c | ~a)) + blocks[13] + 1309151649; b = (b << 21 | b >>> 11) + c << 0; a += (c ^ (b | ~d)) + blocks[4] - 145523070; a = (a << 6 | a >>> 26) + b << 0; d += (b ^ (a | ~c)) + blocks[11] - 1120210379; d = (d << 10 | d >>> 22) + a << 0; c += (a ^ (d | ~b)) + blocks[2] + 718787259; c = (c << 15 | c >>> 17) + d << 0; b += (d ^ (c | ~a)) + blocks[9] - 343485551; b = (b << 21 | b >>> 11) + c << 0; if (this.first) { this.h0 = a + 1732584193 << 0; this.h1 = b - 271733879 << 0; this.h2 = c - 1732584194 << 0; this.h3 = d + 271733878 << 0; this.first = false; } else { this.h0 = this.h0 + a << 0; this.h1 = this.h1 + b << 0; this.h2 = this.h2 + c << 0; this.h3 = this.h3 + d << 0; } }; /** * @method hex * @memberof Md5 * @instance * @description Output hash as hex string * @returns {String} Hex string * @see {@link md5.hex} * @example * hash.hex(); */ Md5.prototype.hex = function () { this.finalize(); var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3; return HEX_CHARS[(h0 >> 4) & 0x0F] + HEX_CHARS[h0 & 0x0F] + HEX_CHARS[(h0 >> 12) & 0x0F] + HEX_CHARS[(h0 >> 8) & 0x0F] + HEX_CHARS[(h0 >> 20) & 0x0F] + HEX_CHARS[(h0 >> 16) & 0x0F] + HEX_CHARS[(h0 >> 28) & 0x0F] + HEX_CHARS[(h0 >> 24) & 0x0F] + HEX_CHARS[(h1 >> 4) & 0x0F] + HEX_CHARS[h1 & 0x0F] + HEX_CHARS[(h1 >> 12) & 0x0F] + HEX_CHARS[(h1 >> 8) & 0x0F] + HEX_CHARS[(h1 >> 20) & 0x0F] + HEX_CHARS[(h1 >> 16) & 0x0F] + HEX_CHARS[(h1 >> 28) & 0x0F] + HEX_CHARS[(h1 >> 24) & 0x0F] + HEX_CHARS[(h2 >> 4) & 0x0F] + HEX_CHARS[h2 & 0x0F] + HEX_CHARS[(h2 >> 12) & 0x0F] + HEX_CHARS[(h2 >> 8) & 0x0F] + HEX_CHARS[(h2 >> 20) & 0x0F] + HEX_CHARS[(h2 >> 16) & 0x0F] + HEX_CHARS[(h2 >> 28) & 0x0F] + HEX_CHARS[(h2 >> 24) & 0x0F] + HEX_CHARS[(h3 >> 4) & 0x0F] + HEX_CHARS[h3 & 0x0F] + HEX_CHARS[(h3 >> 12) & 0x0F] + HEX_CHARS[(h3 >> 8) & 0x0F] + HEX_CHARS[(h3 >> 20) & 0x0F] + HEX_CHARS[(h3 >> 16) & 0x0F] + HEX_CHARS[(h3 >> 28) & 0x0F] + HEX_CHARS[(h3 >> 24) & 0x0F]; }; /** * @method toString * @memberof Md5 * @instance * @description Output hash as hex string * @returns {String} Hex string * @see {@link md5.hex} * @example * hash.toString(); */ Md5.prototype.toString = Md5.prototype.hex; /** * @method digest * @memberof Md5 * @instance * @description Output hash as bytes array * @returns {Array} Bytes array * @see {@link md5.digest} * @example * hash.digest(); */ Md5.prototype.digest = function () { this.finalize(); var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3; return [ h0 & 0xFF, (h0 >> 8) & 0xFF, (h0 >> 16) & 0xFF, (h0 >> 24) & 0xFF, h1 & 0xFF, (h1 >> 8) & 0xFF, (h1 >> 16) & 0xFF, (h1 >> 24) & 0xFF, h2 & 0xFF, (h2 >> 8) & 0xFF, (h2 >> 16) & 0xFF, (h2 >> 24) & 0xFF, h3 & 0xFF, (h3 >> 8) & 0xFF, (h3 >> 16) & 0xFF, (h3 >> 24) & 0xFF ]; }; /** * @method array * @memberof Md5 * @instance * @description Output hash as bytes array * @returns {Array} Bytes array * @see {@link md5.array} * @example * hash.array(); */ Md5.prototype.array = Md5.prototype.digest; /** * @method arrayBuffer * @memberof Md5 * @instance * @description Output hash as ArrayBuffer * @returns {ArrayBuffer} ArrayBuffer * @see {@link md5.arrayBuffer} * @example * hash.arrayBuffer(); */ Md5.prototype.arrayBuffer = function () { this.finalize(); var buffer = new ArrayBuffer(16); var blocks = new Uint32Array(buffer); blocks[0] = this.h0; blocks[1] = this.h1; blocks[2] = this.h2; blocks[3] = this.h3; return buffer; }; /** * @method buffer * @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead. * @memberof Md5 * @instance * @description Output hash as ArrayBuffer * @returns {ArrayBuffer} ArrayBuffer * @see {@link md5.buffer} * @example * hash.buffer(); */ Md5.prototype.buffer = Md5.prototype.arrayBuffer; var exports = createMethod(); if (COMMON_JS) { module.exports = exports; } else { /** * @method md5 * @description Md5 hash function, export to global in browsers. * @param {String|Array|Uint8Array|ArrayBuffer} message message to hash * @returns {String} md5 hashes * @example * md5(''); // d41d8cd98f00b204e9800998ecf8427e * md5('The quick brown fox jumps over the lazy dog'); // 9e107d9d372bb6826bd81d3542a419d6 * md5('The quick brown fox jumps over the lazy dog.'); // e4d909c290d0fb1ca068ffaddf22cbd0 * * // It also supports UTF-8 encoding * md5('中文'); // a7bac2239fcdcb3a067903d8077c4a07 * * // It also supports byte `Array`, `Uint8Array`, `ArrayBuffer` * md5([]); // d41d8cd98f00b204e9800998ecf8427e * md5(new Uint8Array([])); // d41d8cd98f00b204e9800998ecf8427e */ root.md5 = exports; if (AMD) { define(function () { return exports; }); } } }(this));
20,799
md5
js
en
javascript
code
{"qsc_code_num_words": 2713, "qsc_code_num_chars": 20799.0, "qsc_code_mean_word_length": 3.67084408, "qsc_code_frac_words_unique": 0.1013638, "qsc_code_frac_chars_top_2grams": 0.02650869, "qsc_code_frac_chars_top_3grams": 0.03735315, "qsc_code_frac_chars_top_4grams": 0.00562305, "qsc_code_frac_chars_dupe_5grams": 0.48790039, "qsc_code_frac_chars_dupe_6grams": 0.46741641, "qsc_code_frac_chars_dupe_7grams": 0.45345918, "qsc_code_frac_chars_dupe_8grams": 0.44914148, "qsc_code_frac_chars_dupe_9grams": 0.43086655, "qsc_code_frac_chars_dupe_10grams": 0.42885832, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.1366856, "qsc_code_frac_chars_whitespace": 0.31443819, "qsc_code_size_file_byte": 20799.0, "qsc_code_num_lines": 607.0, "qsc_code_num_chars_line_max": 97.0, "qsc_code_num_chars_line_mean": 34.26523888, "qsc_code_frac_chars_alphabet": 0.56168034, "qsc_code_frac_chars_comments": 0.22977066, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.39416058, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00873853, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.02421821, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejavascript_cate_ast": 1.0, "qsc_codejavascript_cate_var_zero": 0.0, "qsc_codejavascript_frac_lines_func_ratio": 0.01216545, "qsc_codejavascript_num_statement_line": 0.00243309, "qsc_codejavascript_score_lines_no_logic": 0.06082725, "qsc_codejavascript_frac_words_legal_var_name": 0.79545455, "qsc_codejavascript_frac_words_legal_func_name": 1.0, "qsc_codejavascript_frac_words_legal_class_name": null, "qsc_codejavascript_frac_lines_print": 0.00243309}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejavascript_cate_ast": 0, "qsc_codejavascript_cate_var_zero": 0, "qsc_codejavascript_frac_lines_func_ratio": 0, "qsc_codejavascript_score_lines_no_logic": 0, "qsc_codejavascript_frac_lines_print": 0}
007revad/Synology_Download_Station_Chrome_Extension
js/lib/knockout.js
/*! * Knockout JavaScript library v3.3.0 * (c) Steven Sanderson - http://knockoutjs.com/ * License: MIT (http://www.opensource.org/licenses/mit-license.php) */ (function(){ var DEBUG=true; (function(undefined){ // (0, eval)('this') is a robust way of getting a reference to the global object // For details, see http://stackoverflow.com/questions/14119988/return-this-0-evalthis/14120023#14120023 var window = this || (0, eval)('this'), document = window['document'], navigator = window['navigator'], jQueryInstance = window["jQuery"], JSON = window["JSON"]; (function(factory) { // Support three module loading scenarios if (typeof define === 'function' && define['amd']) { // [1] AMD anonymous module define(['exports', 'require'], factory); } else if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') { // [2] CommonJS/Node.js factory(module['exports'] || exports); // module.exports is for Node.js } else { // [3] No module loader (plain <script> tag) - put directly in global namespace factory(window['ko'] = {}); } }(function(koExports, amdRequire){ // Internally, all KO objects are attached to koExports (even the non-exported ones whose names will be minified by the closure compiler). // In the future, the following "ko" variable may be made distinct from "koExports" so that private objects are not externally reachable. var ko = typeof koExports !== 'undefined' ? koExports : {}; // Google Closure Compiler helpers (used only to make the minified file smaller) ko.exportSymbol = function(koPath, object) { var tokens = koPath.split("."); // In the future, "ko" may become distinct from "koExports" (so that non-exported objects are not reachable) // At that point, "target" would be set to: (typeof koExports !== "undefined" ? koExports : ko) var target = ko; for (var i = 0; i < tokens.length - 1; i++) target = target[tokens[i]]; target[tokens[tokens.length - 1]] = object; }; ko.exportProperty = function(owner, publicName, object) { owner[publicName] = object; }; ko.version = "3.3.0"; ko.exportSymbol('version', ko.version); ko.utils = (function () { function objectForEach(obj, action) { for (var prop in obj) { if (obj.hasOwnProperty(prop)) { action(prop, obj[prop]); } } } function extend(target, source) { if (source) { for(var prop in source) { if(source.hasOwnProperty(prop)) { target[prop] = source[prop]; } } } return target; } function setPrototypeOf(obj, proto) { obj.__proto__ = proto; return obj; } var canSetPrototype = ({ __proto__: [] } instanceof Array); // Represent the known event types in a compact way, then at runtime transform it into a hash with event name as key (for fast lookup) var knownEvents = {}, knownEventTypesByEventName = {}; var keyEventTypeName = (navigator && /Firefox\/2/i.test(navigator.userAgent)) ? 'KeyboardEvent' : 'UIEvents'; knownEvents[keyEventTypeName] = ['keyup', 'keydown', 'keypress']; knownEvents['MouseEvents'] = ['click', 'dblclick', 'mousedown', 'mouseup', 'mousemove', 'mouseover', 'mouseout', 'mouseenter', 'mouseleave']; objectForEach(knownEvents, function(eventType, knownEventsForType) { if (knownEventsForType.length) { for (var i = 0, j = knownEventsForType.length; i < j; i++) knownEventTypesByEventName[knownEventsForType[i]] = eventType; } }); var eventsThatMustBeRegisteredUsingAttachEvent = { 'propertychange': true }; // Workaround for an IE9 issue - https://github.com/SteveSanderson/knockout/issues/406 // Detect IE versions for bug workarounds (uses IE conditionals, not UA string, for robustness) // Note that, since IE 10 does not support conditional comments, the following logic only detects IE < 10. // Currently this is by design, since IE 10+ behaves correctly when treated as a standard browser. // If there is a future need to detect specific versions of IE10+, we will amend this. var ieVersion = document && (function() { var version = 3, div = document.createElement('div'), iElems = div.getElementsByTagName('i'); // Keep constructing conditional HTML blocks until we hit one that resolves to an empty fragment while ( div.innerHTML = '<!--[if gt IE ' + (++version) + ']><i></i><![endif]-->', iElems[0] ) {} return version > 4 ? version : undefined; }()); var isIe6 = ieVersion === 6, isIe7 = ieVersion === 7; function isClickOnCheckableElement(element, eventType) { if ((ko.utils.tagNameLower(element) !== "input") || !element.type) return false; if (eventType.toLowerCase() != "click") return false; var inputType = element.type; return (inputType == "checkbox") || (inputType == "radio"); } // For details on the pattern for changing node classes // see: https://github.com/knockout/knockout/issues/1597 var cssClassNameRegex = /\S+/g; function toggleDomNodeCssClass(node, classNames, shouldHaveClass) { var addOrRemoveFn; if (classNames) { if (typeof node.classList === 'object') { addOrRemoveFn = node.classList[shouldHaveClass ? 'add' : 'remove']; ko.utils.arrayForEach(classNames.match(cssClassNameRegex), function(className) { addOrRemoveFn.call(node.classList, className); }); } else if (typeof node.className['baseVal'] === 'string') { // SVG tag .classNames is an SVGAnimatedString instance toggleObjectClassPropertyString(node.className, 'baseVal', classNames, shouldHaveClass); } else { // node.className ought to be a string. toggleObjectClassPropertyString(node, 'className', classNames, shouldHaveClass); } } } function toggleObjectClassPropertyString(obj, prop, classNames, shouldHaveClass) { // obj/prop is either a node/'className' or a SVGAnimatedString/'baseVal'. var currentClassNames = obj[prop].match(cssClassNameRegex) || []; ko.utils.arrayForEach(classNames.match(cssClassNameRegex), function(className) { ko.utils.addOrRemoveItem(currentClassNames, className, shouldHaveClass); }); obj[prop] = currentClassNames.join(" "); } return { fieldsIncludedWithJsonPost: ['authenticity_token', /^__RequestVerificationToken(_.*)?$/], arrayForEach: function (array, action) { for (var i = 0, j = array.length; i < j; i++) action(array[i], i); }, arrayIndexOf: function (array, item) { if (typeof Array.prototype.indexOf == "function") return Array.prototype.indexOf.call(array, item); for (var i = 0, j = array.length; i < j; i++) if (array[i] === item) return i; return -1; }, arrayFirst: function (array, predicate, predicateOwner) { for (var i = 0, j = array.length; i < j; i++) if (predicate.call(predicateOwner, array[i], i)) return array[i]; return null; }, arrayRemoveItem: function (array, itemToRemove) { var index = ko.utils.arrayIndexOf(array, itemToRemove); if (index > 0) { array.splice(index, 1); } else if (index === 0) { array.shift(); } }, arrayGetDistinctValues: function (array) { array = array || []; var result = []; for (var i = 0, j = array.length; i < j; i++) { if (ko.utils.arrayIndexOf(result, array[i]) < 0) result.push(array[i]); } return result; }, arrayMap: function (array, mapping) { array = array || []; var result = []; for (var i = 0, j = array.length; i < j; i++) result.push(mapping(array[i], i)); return result; }, arrayFilter: function (array, predicate) { array = array || []; var result = []; for (var i = 0, j = array.length; i < j; i++) if (predicate(array[i], i)) result.push(array[i]); return result; }, arrayPushAll: function (array, valuesToPush) { if (valuesToPush instanceof Array) array.push.apply(array, valuesToPush); else for (var i = 0, j = valuesToPush.length; i < j; i++) array.push(valuesToPush[i]); return array; }, addOrRemoveItem: function(array, value, included) { var existingEntryIndex = ko.utils.arrayIndexOf(ko.utils.peekObservable(array), value); if (existingEntryIndex < 0) { if (included) array.push(value); } else { if (!included) array.splice(existingEntryIndex, 1); } }, canSetPrototype: canSetPrototype, extend: extend, setPrototypeOf: setPrototypeOf, setPrototypeOfOrExtend: canSetPrototype ? setPrototypeOf : extend, objectForEach: objectForEach, objectMap: function(source, mapping) { if (!source) return source; var target = {}; for (var prop in source) { if (source.hasOwnProperty(prop)) { target[prop] = mapping(source[prop], prop, source); } } return target; }, emptyDomNode: function (domNode) { while (domNode.firstChild) { ko.removeNode(domNode.firstChild); } }, moveCleanedNodesToContainerElement: function(nodes) { // Ensure it's a real array, as we're about to reparent the nodes and // we don't want the underlying collection to change while we're doing that. var nodesArray = ko.utils.makeArray(nodes); var templateDocument = (nodesArray[0] && nodesArray[0].ownerDocument) || document; var container = templateDocument.createElement('div'); for (var i = 0, j = nodesArray.length; i < j; i++) { container.appendChild(ko.cleanNode(nodesArray[i])); } return container; }, cloneNodes: function (nodesArray, shouldCleanNodes) { for (var i = 0, j = nodesArray.length, newNodesArray = []; i < j; i++) { var clonedNode = nodesArray[i].cloneNode(true); newNodesArray.push(shouldCleanNodes ? ko.cleanNode(clonedNode) : clonedNode); } return newNodesArray; }, setDomNodeChildren: function (domNode, childNodes) { ko.utils.emptyDomNode(domNode); if (childNodes) { for (var i = 0, j = childNodes.length; i < j; i++) domNode.appendChild(childNodes[i]); } }, replaceDomNodes: function (nodeToReplaceOrNodeArray, newNodesArray) { var nodesToReplaceArray = nodeToReplaceOrNodeArray.nodeType ? [nodeToReplaceOrNodeArray] : nodeToReplaceOrNodeArray; if (nodesToReplaceArray.length > 0) { var insertionPoint = nodesToReplaceArray[0]; var parent = insertionPoint.parentNode; for (var i = 0, j = newNodesArray.length; i < j; i++) parent.insertBefore(newNodesArray[i], insertionPoint); for (var i = 0, j = nodesToReplaceArray.length; i < j; i++) { ko.removeNode(nodesToReplaceArray[i]); } } }, fixUpContinuousNodeArray: function(continuousNodeArray, parentNode) { // Before acting on a set of nodes that were previously outputted by a template function, we have to reconcile // them against what is in the DOM right now. It may be that some of the nodes have already been removed, or that // new nodes might have been inserted in the middle, for example by a binding. Also, there may previously have been // leading comment nodes (created by rewritten string-based templates) that have since been removed during binding. // So, this function translates the old "map" output array into its best guess of the set of current DOM nodes. // // Rules: // [A] Any leading nodes that have been removed should be ignored // These most likely correspond to memoization nodes that were already removed during binding // See https://github.com/SteveSanderson/knockout/pull/440 // [B] We want to output a continuous series of nodes. So, ignore any nodes that have already been removed, // and include any nodes that have been inserted among the previous collection if (continuousNodeArray.length) { // The parent node can be a virtual element; so get the real parent node parentNode = (parentNode.nodeType === 8 && parentNode.parentNode) || parentNode; // Rule [A] while (continuousNodeArray.length && continuousNodeArray[0].parentNode !== parentNode) continuousNodeArray.splice(0, 1); // Rule [B] if (continuousNodeArray.length > 1) { var current = continuousNodeArray[0], last = continuousNodeArray[continuousNodeArray.length - 1]; // Replace with the actual new continuous node set continuousNodeArray.length = 0; while (current !== last) { continuousNodeArray.push(current); current = current.nextSibling; if (!current) // Won't happen, except if the developer has manually removed some DOM elements (then we're in an undefined scenario) return; } continuousNodeArray.push(last); } } return continuousNodeArray; }, setOptionNodeSelectionState: function (optionNode, isSelected) { // IE6 sometimes throws "unknown error" if you try to write to .selected directly, whereas Firefox struggles with setAttribute. Pick one based on browser. if (ieVersion < 7) optionNode.setAttribute("selected", isSelected); else optionNode.selected = isSelected; }, stringTrim: function (string) { return string === null || string === undefined ? '' : string.trim ? string.trim() : string.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g, ''); }, stringStartsWith: function (string, startsWith) { string = string || ""; if (startsWith.length > string.length) return false; return string.substring(0, startsWith.length) === startsWith; }, domNodeIsContainedBy: function (node, containedByNode) { if (node === containedByNode) return true; if (node.nodeType === 11) return false; // Fixes issue #1162 - can't use node.contains for document fragments on IE8 if (containedByNode.contains) return containedByNode.contains(node.nodeType === 3 ? node.parentNode : node); if (containedByNode.compareDocumentPosition) return (containedByNode.compareDocumentPosition(node) & 16) == 16; while (node && node != containedByNode) { node = node.parentNode; } return !!node; }, domNodeIsAttachedToDocument: function (node) { return ko.utils.domNodeIsContainedBy(node, node.ownerDocument.documentElement); }, anyDomNodeIsAttachedToDocument: function(nodes) { return !!ko.utils.arrayFirst(nodes, ko.utils.domNodeIsAttachedToDocument); }, tagNameLower: function(element) { // For HTML elements, tagName will always be upper case; for XHTML elements, it'll be lower case. // Possible future optimization: If we know it's an element from an XHTML document (not HTML), // we don't need to do the .toLowerCase() as it will always be lower case anyway. return element && element.tagName && element.tagName.toLowerCase(); }, registerEventHandler: function (element, eventType, handler) { var mustUseAttachEvent = ieVersion && eventsThatMustBeRegisteredUsingAttachEvent[eventType]; if (!mustUseAttachEvent && jQueryInstance) { jQueryInstance(element)['bind'](eventType, handler); } else if (!mustUseAttachEvent && typeof element.addEventListener == "function") element.addEventListener(eventType, handler, false); else if (typeof element.attachEvent != "undefined") { var attachEventHandler = function (event) { handler.call(element, event); }, attachEventName = "on" + eventType; element.attachEvent(attachEventName, attachEventHandler); // IE does not dispose attachEvent handlers automatically (unlike with addEventListener) // so to avoid leaks, we have to remove them manually. See bug #856 ko.utils.domNodeDisposal.addDisposeCallback(element, function() { element.detachEvent(attachEventName, attachEventHandler); }); } else throw new Error("Browser doesn't support addEventListener or attachEvent"); }, triggerEvent: function (element, eventType) { if (!(element && element.nodeType)) throw new Error("element must be a DOM node when calling triggerEvent"); // For click events on checkboxes and radio buttons, jQuery toggles the element checked state *after* the // event handler runs instead of *before*. (This was fixed in 1.9 for checkboxes but not for radio buttons.) // IE doesn't change the checked state when you trigger the click event using "fireEvent". // In both cases, we'll use the click method instead. var useClickWorkaround = isClickOnCheckableElement(element, eventType); if (jQueryInstance && !useClickWorkaround) { jQueryInstance(element)['trigger'](eventType); } else if (typeof document.createEvent == "function") { if (typeof element.dispatchEvent == "function") { var eventCategory = knownEventTypesByEventName[eventType] || "HTMLEvents"; var event = document.createEvent(eventCategory); event.initEvent(eventType, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, element); element.dispatchEvent(event); } else throw new Error("The supplied element doesn't support dispatchEvent"); } else if (useClickWorkaround && element.click) { element.click(); } else if (typeof element.fireEvent != "undefined") { element.fireEvent("on" + eventType); } else { throw new Error("Browser doesn't support triggering events"); } }, unwrapObservable: function (value) { return ko.isObservable(value) ? value() : value; }, peekObservable: function (value) { return ko.isObservable(value) ? value.peek() : value; }, toggleDomNodeCssClass: toggleDomNodeCssClass, setTextContent: function(element, textContent) { var value = ko.utils.unwrapObservable(textContent); if ((value === null) || (value === undefined)) value = ""; // We need there to be exactly one child: a text node. // If there are no children, more than one, or if it's not a text node, // we'll clear everything and create a single text node. var innerTextNode = ko.virtualElements.firstChild(element); if (!innerTextNode || innerTextNode.nodeType != 3 || ko.virtualElements.nextSibling(innerTextNode)) { ko.virtualElements.setDomNodeChildren(element, [element.ownerDocument.createTextNode(value)]); } else { innerTextNode.data = value; } ko.utils.forceRefresh(element); }, setElementName: function(element, name) { element.name = name; // Workaround IE 6/7 issue // - https://github.com/SteveSanderson/knockout/issues/197 // - http://www.matts411.com/post/setting_the_name_attribute_in_ie_dom/ if (ieVersion <= 7) { try { element.mergeAttributes(document.createElement("<input name='" + element.name + "'/>"), false); } catch(e) {} // For IE9 with doc mode "IE9 Standards" and browser mode "IE9 Compatibility View" } }, forceRefresh: function(node) { // Workaround for an IE9 rendering bug - https://github.com/SteveSanderson/knockout/issues/209 if (ieVersion >= 9) { // For text nodes and comment nodes (most likely virtual elements), we will have to refresh the container var elem = node.nodeType == 1 ? node : node.parentNode; if (elem.style) elem.style.zoom = elem.style.zoom; } }, ensureSelectElementIsRenderedCorrectly: function(selectElement) { // Workaround for IE9 rendering bug - it doesn't reliably display all the text in dynamically-added select boxes unless you force it to re-render by updating the width. // (See https://github.com/SteveSanderson/knockout/issues/312, http://stackoverflow.com/questions/5908494/select-only-shows-first-char-of-selected-option) // Also fixes IE7 and IE8 bug that causes selects to be zero width if enclosed by 'if' or 'with'. (See issue #839) if (ieVersion) { var originalWidth = selectElement.style.width; selectElement.style.width = 0; selectElement.style.width = originalWidth; } }, range: function (min, max) { min = ko.utils.unwrapObservable(min); max = ko.utils.unwrapObservable(max); var result = []; for (var i = min; i <= max; i++) result.push(i); return result; }, makeArray: function(arrayLikeObject) { var result = []; for (var i = 0, j = arrayLikeObject.length; i < j; i++) { result.push(arrayLikeObject[i]); }; return result; }, isIe6 : isIe6, isIe7 : isIe7, ieVersion : ieVersion, getFormFields: function(form, fieldName) { var fields = ko.utils.makeArray(form.getElementsByTagName("input")).concat(ko.utils.makeArray(form.getElementsByTagName("textarea"))); var isMatchingField = (typeof fieldName == 'string') ? function(field) { return field.name === fieldName } : function(field) { return fieldName.test(field.name) }; // Treat fieldName as regex or object containing predicate var matches = []; for (var i = fields.length - 1; i >= 0; i--) { if (isMatchingField(fields[i])) matches.push(fields[i]); }; return matches; }, parseJson: function (jsonString) { if (typeof jsonString == "string") { jsonString = ko.utils.stringTrim(jsonString); if (jsonString) { if (JSON && JSON.parse) // Use native parsing where available return JSON.parse(jsonString); return (new Function("return " + jsonString))(); // Fallback on less safe parsing for older browsers } } return null; }, stringifyJson: function (data, replacer, space) { // replacer and space are optional if (!JSON || !JSON.stringify) throw new Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js"); return JSON.stringify(ko.utils.unwrapObservable(data), replacer, space); }, postJson: function (urlOrForm, data, options) { options = options || {}; var params = options['params'] || {}; var includeFields = options['includeFields'] || this.fieldsIncludedWithJsonPost; var url = urlOrForm; // If we were given a form, use its 'action' URL and pick out any requested field values if((typeof urlOrForm == 'object') && (ko.utils.tagNameLower(urlOrForm) === "form")) { var originalForm = urlOrForm; url = originalForm.action; for (var i = includeFields.length - 1; i >= 0; i--) { var fields = ko.utils.getFormFields(originalForm, includeFields[i]); for (var j = fields.length - 1; j >= 0; j--) params[fields[j].name] = fields[j].value; } } data = ko.utils.unwrapObservable(data); var form = document.createElement("form"); form.style.display = "none"; form.action = url; form.method = "post"; for (var key in data) { // Since 'data' this is a model object, we include all properties including those inherited from its prototype var input = document.createElement("input"); input.type = "hidden"; input.name = key; input.value = ko.utils.stringifyJson(ko.utils.unwrapObservable(data[key])); form.appendChild(input); } objectForEach(params, function(key, value) { var input = document.createElement("input"); input.type = "hidden"; input.name = key; input.value = value; form.appendChild(input); }); document.body.appendChild(form); options['submitter'] ? options['submitter'](form) : form.submit(); setTimeout(function () { form.parentNode.removeChild(form); }, 0); } } }()); ko.exportSymbol('utils', ko.utils); ko.exportSymbol('utils.arrayForEach', ko.utils.arrayForEach); ko.exportSymbol('utils.arrayFirst', ko.utils.arrayFirst); ko.exportSymbol('utils.arrayFilter', ko.utils.arrayFilter); ko.exportSymbol('utils.arrayGetDistinctValues', ko.utils.arrayGetDistinctValues); ko.exportSymbol('utils.arrayIndexOf', ko.utils.arrayIndexOf); ko.exportSymbol('utils.arrayMap', ko.utils.arrayMap); ko.exportSymbol('utils.arrayPushAll', ko.utils.arrayPushAll); ko.exportSymbol('utils.arrayRemoveItem', ko.utils.arrayRemoveItem); ko.exportSymbol('utils.extend', ko.utils.extend); ko.exportSymbol('utils.fieldsIncludedWithJsonPost', ko.utils.fieldsIncludedWithJsonPost); ko.exportSymbol('utils.getFormFields', ko.utils.getFormFields); ko.exportSymbol('utils.peekObservable', ko.utils.peekObservable); ko.exportSymbol('utils.postJson', ko.utils.postJson); ko.exportSymbol('utils.parseJson', ko.utils.parseJson); ko.exportSymbol('utils.registerEventHandler', ko.utils.registerEventHandler); ko.exportSymbol('utils.stringifyJson', ko.utils.stringifyJson); ko.exportSymbol('utils.range', ko.utils.range); ko.exportSymbol('utils.toggleDomNodeCssClass', ko.utils.toggleDomNodeCssClass); ko.exportSymbol('utils.triggerEvent', ko.utils.triggerEvent); ko.exportSymbol('utils.unwrapObservable', ko.utils.unwrapObservable); ko.exportSymbol('utils.objectForEach', ko.utils.objectForEach); ko.exportSymbol('utils.addOrRemoveItem', ko.utils.addOrRemoveItem); ko.exportSymbol('utils.setTextContent', ko.utils.setTextContent); ko.exportSymbol('unwrap', ko.utils.unwrapObservable); // Convenient shorthand, because this is used so commonly if (!Function.prototype['bind']) { // Function.prototype.bind is a standard part of ECMAScript 5th Edition (December 2009, http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf) // In case the browser doesn't implement it natively, provide a JavaScript implementation. This implementation is based on the one in prototype.js Function.prototype['bind'] = function (object) { var originalFunction = this; if (arguments.length === 1) { return function () { return originalFunction.apply(object, arguments); }; } else { var partialArgs = Array.prototype.slice.call(arguments, 1); return function () { var args = partialArgs.slice(0); args.push.apply(args, arguments); return originalFunction.apply(object, args); }; } }; } ko.utils.domData = new (function () { var uniqueId = 0; var dataStoreKeyExpandoPropertyName = "__ko__" + (new Date).getTime(); var dataStore = {}; function getAll(node, createIfNotFound) { var dataStoreKey = node[dataStoreKeyExpandoPropertyName]; var hasExistingDataStore = dataStoreKey && (dataStoreKey !== "null") && dataStore[dataStoreKey]; if (!hasExistingDataStore) { if (!createIfNotFound) return undefined; dataStoreKey = node[dataStoreKeyExpandoPropertyName] = "ko" + uniqueId++; dataStore[dataStoreKey] = {}; } return dataStore[dataStoreKey]; } return { get: function (node, key) { var allDataForNode = getAll(node, false); return allDataForNode === undefined ? undefined : allDataForNode[key]; }, set: function (node, key, value) { if (value === undefined) { // Make sure we don't actually create a new domData key if we are actually deleting a value if (getAll(node, false) === undefined) return; } var allDataForNode = getAll(node, true); allDataForNode[key] = value; }, clear: function (node) { var dataStoreKey = node[dataStoreKeyExpandoPropertyName]; if (dataStoreKey) { delete dataStore[dataStoreKey]; node[dataStoreKeyExpandoPropertyName] = null; return true; // Exposing "did clean" flag purely so specs can infer whether things have been cleaned up as intended } return false; }, nextKey: function () { return (uniqueId++) + dataStoreKeyExpandoPropertyName; } }; })(); ko.exportSymbol('utils.domData', ko.utils.domData); ko.exportSymbol('utils.domData.clear', ko.utils.domData.clear); // Exporting only so specs can clear up after themselves fully ko.utils.domNodeDisposal = new (function () { var domDataKey = ko.utils.domData.nextKey(); var cleanableNodeTypes = { 1: true, 8: true, 9: true }; // Element, Comment, Document var cleanableNodeTypesWithDescendants = { 1: true, 9: true }; // Element, Document function getDisposeCallbacksCollection(node, createIfNotFound) { var allDisposeCallbacks = ko.utils.domData.get(node, domDataKey); if ((allDisposeCallbacks === undefined) && createIfNotFound) { allDisposeCallbacks = []; ko.utils.domData.set(node, domDataKey, allDisposeCallbacks); } return allDisposeCallbacks; } function destroyCallbacksCollection(node) { ko.utils.domData.set(node, domDataKey, undefined); } function cleanSingleNode(node) { // Run all the dispose callbacks var callbacks = getDisposeCallbacksCollection(node, false); if (callbacks) { callbacks = callbacks.slice(0); // Clone, as the array may be modified during iteration (typically, callbacks will remove themselves) for (var i = 0; i < callbacks.length; i++) callbacks[i](node); } // Erase the DOM data ko.utils.domData.clear(node); // Perform cleanup needed by external libraries (currently only jQuery, but can be extended) ko.utils.domNodeDisposal["cleanExternalData"](node); // Clear any immediate-child comment nodes, as these wouldn't have been found by // node.getElementsByTagName("*") in cleanNode() (comment nodes aren't elements) if (cleanableNodeTypesWithDescendants[node.nodeType]) cleanImmediateCommentTypeChildren(node); } function cleanImmediateCommentTypeChildren(nodeWithChildren) { var child, nextChild = nodeWithChildren.firstChild; while (child = nextChild) { nextChild = child.nextSibling; if (child.nodeType === 8) cleanSingleNode(child); } } return { addDisposeCallback : function(node, callback) { if (typeof callback != "function") throw new Error("Callback must be a function"); getDisposeCallbacksCollection(node, true).push(callback); }, removeDisposeCallback : function(node, callback) { var callbacksCollection = getDisposeCallbacksCollection(node, false); if (callbacksCollection) { ko.utils.arrayRemoveItem(callbacksCollection, callback); if (callbacksCollection.length == 0) destroyCallbacksCollection(node); } }, cleanNode : function(node) { // First clean this node, where applicable if (cleanableNodeTypes[node.nodeType]) { cleanSingleNode(node); // ... then its descendants, where applicable if (cleanableNodeTypesWithDescendants[node.nodeType]) { // Clone the descendants list in case it changes during iteration var descendants = []; ko.utils.arrayPushAll(descendants, node.getElementsByTagName("*")); for (var i = 0, j = descendants.length; i < j; i++) cleanSingleNode(descendants[i]); } } return node; }, removeNode : function(node) { ko.cleanNode(node); if (node.parentNode) node.parentNode.removeChild(node); }, "cleanExternalData" : function (node) { // Special support for jQuery here because it's so commonly used. // Many jQuery plugins (including jquery.tmpl) store data using jQuery's equivalent of domData // so notify it to tear down any resources associated with the node & descendants here. if (jQueryInstance && (typeof jQueryInstance['cleanData'] == "function")) jQueryInstance['cleanData']([node]); } }; })(); ko.cleanNode = ko.utils.domNodeDisposal.cleanNode; // Shorthand name for convenience ko.removeNode = ko.utils.domNodeDisposal.removeNode; // Shorthand name for convenience ko.exportSymbol('cleanNode', ko.cleanNode); ko.exportSymbol('removeNode', ko.removeNode); ko.exportSymbol('utils.domNodeDisposal', ko.utils.domNodeDisposal); ko.exportSymbol('utils.domNodeDisposal.addDisposeCallback', ko.utils.domNodeDisposal.addDisposeCallback); ko.exportSymbol('utils.domNodeDisposal.removeDisposeCallback', ko.utils.domNodeDisposal.removeDisposeCallback); (function () { var leadingCommentRegex = /^(\s*)<!--(.*?)-->/; function simpleHtmlParse(html, documentContext) { documentContext || (documentContext = document); var windowContext = documentContext['parentWindow'] || documentContext['defaultView'] || window; // Based on jQuery's "clean" function, but only accounting for table-related elements. // If you have referenced jQuery, this won't be used anyway - KO will use jQuery's "clean" function directly // Note that there's still an issue in IE < 9 whereby it will discard comment nodes that are the first child of // a descendant node. For example: "<div><!-- mycomment -->abc</div>" will get parsed as "<div>abc</div>" // This won't affect anyone who has referenced jQuery, and there's always the workaround of inserting a dummy node // (possibly a text node) in front of the comment. So, KO does not attempt to workaround this IE issue automatically at present. // Trim whitespace, otherwise indexOf won't work as expected var tags = ko.utils.stringTrim(html).toLowerCase(), div = documentContext.createElement("div"); // Finds the first match from the left column, and returns the corresponding "wrap" data from the right column var wrap = tags.match(/^<(thead|tbody|tfoot)/) && [1, "<table>", "</table>"] || !tags.indexOf("<tr") && [2, "<table><tbody>", "</tbody></table>"] || (!tags.indexOf("<td") || !tags.indexOf("<th")) && [3, "<table><tbody><tr>", "</tr></tbody></table>"] || /* anything else */ [0, "", ""]; // Go to html and back, then peel off extra wrappers // Note that we always prefix with some dummy text, because otherwise, IE<9 will strip out leading comment nodes in descendants. Total madness. var markup = "ignored<div>" + wrap[1] + html + wrap[2] + "</div>"; if (typeof windowContext['innerShiv'] == "function") { div.appendChild(windowContext['innerShiv'](markup)); } else { div.innerHTML = markup; } // Move to the right depth while (wrap[0]--) div = div.lastChild; return ko.utils.makeArray(div.lastChild.childNodes); } function jQueryHtmlParse(html, documentContext) { // jQuery's "parseHTML" function was introduced in jQuery 1.8.0 and is a documented public API. if (jQueryInstance['parseHTML']) { return jQueryInstance['parseHTML'](html, documentContext) || []; // Ensure we always return an array and never null } else { // For jQuery < 1.8.0, we fall back on the undocumented internal "clean" function. var elems = jQueryInstance['clean']([html], documentContext); // As of jQuery 1.7.1, jQuery parses the HTML by appending it to some dummy parent nodes held in an in-memory document fragment. // Unfortunately, it never clears the dummy parent nodes from the document fragment, so it leaks memory over time. // Fix this by finding the top-most dummy parent element, and detaching it from its owner fragment. if (elems && elems[0]) { // Find the top-most parent element that's a direct child of a document fragment var elem = elems[0]; while (elem.parentNode && elem.parentNode.nodeType !== 11 /* i.e., DocumentFragment */) elem = elem.parentNode; // ... then detach it if (elem.parentNode) elem.parentNode.removeChild(elem); } return elems; } } ko.utils.parseHtmlFragment = function(html, documentContext) { return jQueryInstance ? jQueryHtmlParse(html, documentContext) // As below, benefit from jQuery's optimisations where possible : simpleHtmlParse(html, documentContext); // ... otherwise, this simple logic will do in most common cases. }; ko.utils.setHtml = function(node, html) { ko.utils.emptyDomNode(node); // There's no legitimate reason to display a stringified observable without unwrapping it, so we'll unwrap it html = ko.utils.unwrapObservable(html); if ((html !== null) && (html !== undefined)) { if (typeof html != 'string') html = html.toString(); // jQuery contains a lot of sophisticated code to parse arbitrary HTML fragments, // for example <tr> elements which are not normally allowed to exist on their own. // If you've referenced jQuery we'll use that rather than duplicating its code. if (jQueryInstance) { jQueryInstance(node)['html'](html); } else { // ... otherwise, use KO's own parsing logic. var parsedNodes = ko.utils.parseHtmlFragment(html, node.ownerDocument); for (var i = 0; i < parsedNodes.length; i++) node.appendChild(parsedNodes[i]); } } }; })(); ko.exportSymbol('utils.parseHtmlFragment', ko.utils.parseHtmlFragment); ko.exportSymbol('utils.setHtml', ko.utils.setHtml); ko.memoization = (function () { var memos = {}; function randomMax8HexChars() { return (((1 + Math.random()) * 0x100000000) | 0).toString(16).substring(1); } function generateRandomId() { return randomMax8HexChars() + randomMax8HexChars(); } function findMemoNodes(rootNode, appendToArray) { if (!rootNode) return; if (rootNode.nodeType == 8) { var memoId = ko.memoization.parseMemoText(rootNode.nodeValue); if (memoId != null) appendToArray.push({ domNode: rootNode, memoId: memoId }); } else if (rootNode.nodeType == 1) { for (var i = 0, childNodes = rootNode.childNodes, j = childNodes.length; i < j; i++) findMemoNodes(childNodes[i], appendToArray); } } return { memoize: function (callback) { if (typeof callback != "function") throw new Error("You can only pass a function to ko.memoization.memoize()"); var memoId = generateRandomId(); memos[memoId] = callback; return "<!--[ko_memo:" + memoId + "]-->"; }, unmemoize: function (memoId, callbackParams) { var callback = memos[memoId]; if (callback === undefined) throw new Error("Couldn't find any memo with ID " + memoId + ". Perhaps it's already been unmemoized."); try { callback.apply(null, callbackParams || []); return true; } finally { delete memos[memoId]; } }, unmemoizeDomNodeAndDescendants: function (domNode, extraCallbackParamsArray) { var memos = []; findMemoNodes(domNode, memos); for (var i = 0, j = memos.length; i < j; i++) { var node = memos[i].domNode; var combinedParams = [node]; if (extraCallbackParamsArray) ko.utils.arrayPushAll(combinedParams, extraCallbackParamsArray); ko.memoization.unmemoize(memos[i].memoId, combinedParams); node.nodeValue = ""; // Neuter this node so we don't try to unmemoize it again if (node.parentNode) node.parentNode.removeChild(node); // If possible, erase it totally (not always possible - someone else might just hold a reference to it then call unmemoizeDomNodeAndDescendants again) } }, parseMemoText: function (memoText) { var match = memoText.match(/^\[ko_memo\:(.*?)\]$/); return match ? match[1] : null; } }; })(); ko.exportSymbol('memoization', ko.memoization); ko.exportSymbol('memoization.memoize', ko.memoization.memoize); ko.exportSymbol('memoization.unmemoize', ko.memoization.unmemoize); ko.exportSymbol('memoization.parseMemoText', ko.memoization.parseMemoText); ko.exportSymbol('memoization.unmemoizeDomNodeAndDescendants', ko.memoization.unmemoizeDomNodeAndDescendants); ko.extenders = { 'throttle': function(target, timeout) { // Throttling means two things: // (1) For dependent observables, we throttle *evaluations* so that, no matter how fast its dependencies // notify updates, the target doesn't re-evaluate (and hence doesn't notify) faster than a certain rate target['throttleEvaluation'] = timeout; // (2) For writable targets (observables, or writable dependent observables), we throttle *writes* // so the target cannot change value synchronously or faster than a certain rate var writeTimeoutInstance = null; return ko.dependentObservable({ 'read': target, 'write': function(value) { clearTimeout(writeTimeoutInstance); writeTimeoutInstance = setTimeout(function() { target(value); }, timeout); } }); }, 'rateLimit': function(target, options) { var timeout, method, limitFunction; if (typeof options == 'number') { timeout = options; } else { timeout = options['timeout']; method = options['method']; } limitFunction = method == 'notifyWhenChangesStop' ? debounce : throttle; target.limit(function(callback) { return limitFunction(callback, timeout); }); }, 'notify': function(target, notifyWhen) { target["equalityComparer"] = notifyWhen == "always" ? null : // null equalityComparer means to always notify valuesArePrimitiveAndEqual; } }; var primitiveTypes = { 'undefined':1, 'boolean':1, 'number':1, 'string':1 }; function valuesArePrimitiveAndEqual(a, b) { var oldValueIsPrimitive = (a === null) || (typeof(a) in primitiveTypes); return oldValueIsPrimitive ? (a === b) : false; } function throttle(callback, timeout) { var timeoutInstance; return function () { if (!timeoutInstance) { timeoutInstance = setTimeout(function() { timeoutInstance = undefined; callback(); }, timeout); } }; } function debounce(callback, timeout) { var timeoutInstance; return function () { clearTimeout(timeoutInstance); timeoutInstance = setTimeout(callback, timeout); }; } function applyExtenders(requestedExtenders) { var target = this; if (requestedExtenders) { ko.utils.objectForEach(requestedExtenders, function(key, value) { var extenderHandler = ko.extenders[key]; if (typeof extenderHandler == 'function') { target = extenderHandler(target, value) || target; } }); } return target; } ko.exportSymbol('extenders', ko.extenders); ko.subscription = function (target, callback, disposeCallback) { this._target = target; this.callback = callback; this.disposeCallback = disposeCallback; this.isDisposed = false; ko.exportProperty(this, 'dispose', this.dispose); }; ko.subscription.prototype.dispose = function () { this.isDisposed = true; this.disposeCallback(); }; ko.subscribable = function () { ko.utils.setPrototypeOfOrExtend(this, ko.subscribable['fn']); this._subscriptions = {}; this._versionNumber = 1; } var defaultEvent = "change"; var ko_subscribable_fn = { subscribe: function (callback, callbackTarget, event) { var self = this; event = event || defaultEvent; var boundCallback = callbackTarget ? callback.bind(callbackTarget) : callback; var subscription = new ko.subscription(self, boundCallback, function () { ko.utils.arrayRemoveItem(self._subscriptions[event], subscription); if (self.afterSubscriptionRemove) self.afterSubscriptionRemove(event); }); if (self.beforeSubscriptionAdd) self.beforeSubscriptionAdd(event); if (!self._subscriptions[event]) self._subscriptions[event] = []; self._subscriptions[event].push(subscription); return subscription; }, "notifySubscribers": function (valueToNotify, event) { event = event || defaultEvent; if (event === defaultEvent) { this.updateVersion(); } if (this.hasSubscriptionsForEvent(event)) { try { ko.dependencyDetection.begin(); // Begin suppressing dependency detection (by setting the top frame to undefined) for (var a = this._subscriptions[event].slice(0), i = 0, subscription; subscription = a[i]; ++i) { // In case a subscription was disposed during the arrayForEach cycle, check // for isDisposed on each subscription before invoking its callback if (!subscription.isDisposed) subscription.callback(valueToNotify); } } finally { ko.dependencyDetection.end(); // End suppressing dependency detection } } }, getVersion: function () { return this._versionNumber; }, hasChanged: function (versionToCheck) { return this.getVersion() !== versionToCheck; }, updateVersion: function () { ++this._versionNumber; }, limit: function(limitFunction) { var self = this, selfIsObservable = ko.isObservable(self), isPending, previousValue, pendingValue, beforeChange = 'beforeChange'; if (!self._origNotifySubscribers) { self._origNotifySubscribers = self["notifySubscribers"]; self["notifySubscribers"] = function(value, event) { if (!event || event === defaultEvent) { self._rateLimitedChange(value); } else if (event === beforeChange) { self._rateLimitedBeforeChange(value); } else { self._origNotifySubscribers(value, event); } }; } var finish = limitFunction(function() { // If an observable provided a reference to itself, access it to get the latest value. // This allows computed observables to delay calculating their value until needed. if (selfIsObservable && pendingValue === self) { pendingValue = self(); } isPending = false; if (self.isDifferent(previousValue, pendingValue)) { self._origNotifySubscribers(previousValue = pendingValue); } }); self._rateLimitedChange = function(value) { isPending = true; pendingValue = value; finish(); }; self._rateLimitedBeforeChange = function(value) { if (!isPending) { previousValue = value; self._origNotifySubscribers(value, beforeChange); } }; }, hasSubscriptionsForEvent: function(event) { return this._subscriptions[event] && this._subscriptions[event].length; }, getSubscriptionsCount: function (event) { if (event) { return this._subscriptions[event] && this._subscriptions[event].length || 0; } else { var total = 0; ko.utils.objectForEach(this._subscriptions, function(eventName, subscriptions) { total += subscriptions.length; }); return total; } }, isDifferent: function(oldValue, newValue) { return !this['equalityComparer'] || !this['equalityComparer'](oldValue, newValue); }, extend: applyExtenders }; ko.exportProperty(ko_subscribable_fn, 'subscribe', ko_subscribable_fn.subscribe); ko.exportProperty(ko_subscribable_fn, 'extend', ko_subscribable_fn.extend); ko.exportProperty(ko_subscribable_fn, 'getSubscriptionsCount', ko_subscribable_fn.getSubscriptionsCount); // For browsers that support proto assignment, we overwrite the prototype of each // observable instance. Since observables are functions, we need Function.prototype // to still be in the prototype chain. if (ko.utils.canSetPrototype) { ko.utils.setPrototypeOf(ko_subscribable_fn, Function.prototype); } ko.subscribable['fn'] = ko_subscribable_fn; ko.isSubscribable = function (instance) { return instance != null && typeof instance.subscribe == "function" && typeof instance["notifySubscribers"] == "function"; }; ko.exportSymbol('subscribable', ko.subscribable); ko.exportSymbol('isSubscribable', ko.isSubscribable); ko.computedContext = ko.dependencyDetection = (function () { var outerFrames = [], currentFrame, lastId = 0; // Return a unique ID that can be assigned to an observable for dependency tracking. // Theoretically, you could eventually overflow the number storage size, resulting // in duplicate IDs. But in JavaScript, the largest exact integral value is 2^53 // or 9,007,199,254,740,992. If you created 1,000,000 IDs per second, it would // take over 285 years to reach that number. // Reference http://blog.vjeux.com/2010/javascript/javascript-max_int-number-limits.html function getId() { return ++lastId; } function begin(options) { outerFrames.push(currentFrame); currentFrame = options; } function end() { currentFrame = outerFrames.pop(); } return { begin: begin, end: end, registerDependency: function (subscribable) { if (currentFrame) { if (!ko.isSubscribable(subscribable)) throw new Error("Only subscribable things can act as dependencies"); currentFrame.callback(subscribable, subscribable._id || (subscribable._id = getId())); } }, ignore: function (callback, callbackTarget, callbackArgs) { try { begin(); return callback.apply(callbackTarget, callbackArgs || []); } finally { end(); } }, getDependenciesCount: function () { if (currentFrame) return currentFrame.computed.getDependenciesCount(); }, isInitial: function() { if (currentFrame) return currentFrame.isInitial; } }; })(); ko.exportSymbol('computedContext', ko.computedContext); ko.exportSymbol('computedContext.getDependenciesCount', ko.computedContext.getDependenciesCount); ko.exportSymbol('computedContext.isInitial', ko.computedContext.isInitial); ko.exportSymbol('computedContext.isSleeping', ko.computedContext.isSleeping); ko.exportSymbol('ignoreDependencies', ko.ignoreDependencies = ko.dependencyDetection.ignore); ko.observable = function (initialValue) { var _latestValue = initialValue; function observable() { if (arguments.length > 0) { // Write // Ignore writes if the value hasn't changed if (observable.isDifferent(_latestValue, arguments[0])) { observable.valueWillMutate(); _latestValue = arguments[0]; if (DEBUG) observable._latestValue = _latestValue; observable.valueHasMutated(); } return this; // Permits chained assignments } else { // Read ko.dependencyDetection.registerDependency(observable); // The caller only needs to be notified of changes if they did a "read" operation return _latestValue; } } ko.subscribable.call(observable); ko.utils.setPrototypeOfOrExtend(observable, ko.observable['fn']); if (DEBUG) observable._latestValue = _latestValue; observable.peek = function() { return _latestValue }; observable.valueHasMutated = function () { observable["notifySubscribers"](_latestValue); } observable.valueWillMutate = function () { observable["notifySubscribers"](_latestValue, "beforeChange"); } ko.exportProperty(observable, 'peek', observable.peek); ko.exportProperty(observable, "valueHasMutated", observable.valueHasMutated); ko.exportProperty(observable, "valueWillMutate", observable.valueWillMutate); return observable; } ko.observable['fn'] = { "equalityComparer": valuesArePrimitiveAndEqual }; var protoProperty = ko.observable.protoProperty = "__ko_proto__"; ko.observable['fn'][protoProperty] = ko.observable; // Note that for browsers that don't support proto assignment, the // inheritance chain is created manually in the ko.observable constructor if (ko.utils.canSetPrototype) { ko.utils.setPrototypeOf(ko.observable['fn'], ko.subscribable['fn']); } ko.hasPrototype = function(instance, prototype) { if ((instance === null) || (instance === undefined) || (instance[protoProperty] === undefined)) return false; if (instance[protoProperty] === prototype) return true; return ko.hasPrototype(instance[protoProperty], prototype); // Walk the prototype chain }; ko.isObservable = function (instance) { return ko.hasPrototype(instance, ko.observable); } ko.isWriteableObservable = function (instance) { // Observable if ((typeof instance == "function") && instance[protoProperty] === ko.observable) return true; // Writeable dependent observable if ((typeof instance == "function") && (instance[protoProperty] === ko.dependentObservable) && (instance.hasWriteFunction)) return true; // Anything else return false; } ko.exportSymbol('observable', ko.observable); ko.exportSymbol('isObservable', ko.isObservable); ko.exportSymbol('isWriteableObservable', ko.isWriteableObservable); ko.exportSymbol('isWritableObservable', ko.isWriteableObservable); ko.observableArray = function (initialValues) { initialValues = initialValues || []; if (typeof initialValues != 'object' || !('length' in initialValues)) throw new Error("The argument passed when initializing an observable array must be an array, or null, or undefined."); var result = ko.observable(initialValues); ko.utils.setPrototypeOfOrExtend(result, ko.observableArray['fn']); return result.extend({'trackArrayChanges':true}); }; ko.observableArray['fn'] = { 'remove': function (valueOrPredicate) { var underlyingArray = this.peek(); var removedValues = []; var predicate = typeof valueOrPredicate == "function" && !ko.isObservable(valueOrPredicate) ? valueOrPredicate : function (value) { return value === valueOrPredicate; }; for (var i = 0; i < underlyingArray.length; i++) { var value = underlyingArray[i]; if (predicate(value)) { if (removedValues.length === 0) { this.valueWillMutate(); } removedValues.push(value); underlyingArray.splice(i, 1); i--; } } if (removedValues.length) { this.valueHasMutated(); } return removedValues; }, 'removeAll': function (arrayOfValues) { // If you passed zero args, we remove everything if (arrayOfValues === undefined) { var underlyingArray = this.peek(); var allValues = underlyingArray.slice(0); this.valueWillMutate(); underlyingArray.splice(0, underlyingArray.length); this.valueHasMutated(); return allValues; } // If you passed an arg, we interpret it as an array of entries to remove if (!arrayOfValues) return []; return this['remove'](function (value) { return ko.utils.arrayIndexOf(arrayOfValues, value) >= 0; }); }, 'destroy': function (valueOrPredicate) { var underlyingArray = this.peek(); var predicate = typeof valueOrPredicate == "function" && !ko.isObservable(valueOrPredicate) ? valueOrPredicate : function (value) { return value === valueOrPredicate; }; this.valueWillMutate(); for (var i = underlyingArray.length - 1; i >= 0; i--) { var value = underlyingArray[i]; if (predicate(value)) underlyingArray[i]["_destroy"] = true; } this.valueHasMutated(); }, 'destroyAll': function (arrayOfValues) { // If you passed zero args, we destroy everything if (arrayOfValues === undefined) return this['destroy'](function() { return true }); // If you passed an arg, we interpret it as an array of entries to destroy if (!arrayOfValues) return []; return this['destroy'](function (value) { return ko.utils.arrayIndexOf(arrayOfValues, value) >= 0; }); }, 'indexOf': function (item) { var underlyingArray = this(); return ko.utils.arrayIndexOf(underlyingArray, item); }, 'replace': function(oldItem, newItem) { var index = this['indexOf'](oldItem); if (index >= 0) { this.valueWillMutate(); this.peek()[index] = newItem; this.valueHasMutated(); } } }; // Populate ko.observableArray.fn with read/write functions from native arrays // Important: Do not add any additional functions here that may reasonably be used to *read* data from the array // because we'll eval them without causing subscriptions, so ko.computed output could end up getting stale ko.utils.arrayForEach(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function (methodName) { ko.observableArray['fn'][methodName] = function () { // Use "peek" to avoid creating a subscription in any computed that we're executing in the context of // (for consistency with mutating regular observables) var underlyingArray = this.peek(); this.valueWillMutate(); this.cacheDiffForKnownOperation(underlyingArray, methodName, arguments); var methodCallResult = underlyingArray[methodName].apply(underlyingArray, arguments); this.valueHasMutated(); return methodCallResult; }; }); // Populate ko.observableArray.fn with read-only functions from native arrays ko.utils.arrayForEach(["slice"], function (methodName) { ko.observableArray['fn'][methodName] = function () { var underlyingArray = this(); return underlyingArray[methodName].apply(underlyingArray, arguments); }; }); // Note that for browsers that don't support proto assignment, the // inheritance chain is created manually in the ko.observableArray constructor if (ko.utils.canSetPrototype) { ko.utils.setPrototypeOf(ko.observableArray['fn'], ko.observable['fn']); } ko.exportSymbol('observableArray', ko.observableArray); var arrayChangeEventName = 'arrayChange'; ko.extenders['trackArrayChanges'] = function(target) { // Only modify the target observable once if (target.cacheDiffForKnownOperation) { return; } var trackingChanges = false, cachedDiff = null, arrayChangeSubscription, pendingNotifications = 0, underlyingBeforeSubscriptionAddFunction = target.beforeSubscriptionAdd, underlyingAfterSubscriptionRemoveFunction = target.afterSubscriptionRemove; // Watch "subscribe" calls, and for array change events, ensure change tracking is enabled target.beforeSubscriptionAdd = function (event) { if (underlyingBeforeSubscriptionAddFunction) underlyingBeforeSubscriptionAddFunction.call(target, event); if (event === arrayChangeEventName) { trackChanges(); } }; // Watch "dispose" calls, and for array change events, ensure change tracking is disabled when all are disposed target.afterSubscriptionRemove = function (event) { if (underlyingAfterSubscriptionRemoveFunction) underlyingAfterSubscriptionRemoveFunction.call(target, event); if (event === arrayChangeEventName && !target.hasSubscriptionsForEvent(arrayChangeEventName)) { arrayChangeSubscription.dispose(); trackingChanges = false; } }; function trackChanges() { // Calling 'trackChanges' multiple times is the same as calling it once if (trackingChanges) { return; } trackingChanges = true; // Intercept "notifySubscribers" to track how many times it was called. var underlyingNotifySubscribersFunction = target['notifySubscribers']; target['notifySubscribers'] = function(valueToNotify, event) { if (!event || event === defaultEvent) { ++pendingNotifications; } return underlyingNotifySubscribersFunction.apply(this, arguments); }; // Each time the array changes value, capture a clone so that on the next // change it's possible to produce a diff var previousContents = [].concat(target.peek() || []); cachedDiff = null; arrayChangeSubscription = target.subscribe(function(currentContents) { // Make a copy of the current contents and ensure it's an array currentContents = [].concat(currentContents || []); // Compute the diff and issue notifications, but only if someone is listening if (target.hasSubscriptionsForEvent(arrayChangeEventName)) { var changes = getChanges(previousContents, currentContents); } // Eliminate references to the old, removed items, so they can be GCed previousContents = currentContents; cachedDiff = null; pendingNotifications = 0; if (changes && changes.length) { target['notifySubscribers'](changes, arrayChangeEventName); } }); } function getChanges(previousContents, currentContents) { // We try to re-use cached diffs. // The scenarios where pendingNotifications > 1 are when using rate-limiting or the Deferred Updates // plugin, which without this check would not be compatible with arrayChange notifications. Normally, // notifications are issued immediately so we wouldn't be queueing up more than one. if (!cachedDiff || pendingNotifications > 1) { cachedDiff = ko.utils.compareArrays(previousContents, currentContents, { 'sparse': true }); } return cachedDiff; } target.cacheDiffForKnownOperation = function(rawArray, operationName, args) { // Only run if we're currently tracking changes for this observable array // and there aren't any pending deferred notifications. if (!trackingChanges || pendingNotifications) { return; } var diff = [], arrayLength = rawArray.length, argsLength = args.length, offset = 0; function pushDiff(status, value, index) { return diff[diff.length] = { 'status': status, 'value': value, 'index': index }; } switch (operationName) { case 'push': offset = arrayLength; case 'unshift': for (var index = 0; index < argsLength; index++) { pushDiff('added', args[index], offset + index); } break; case 'pop': offset = arrayLength - 1; case 'shift': if (arrayLength) { pushDiff('deleted', rawArray[offset], offset); } break; case 'splice': // Negative start index means 'from end of array'. After that we clamp to [0...arrayLength]. // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice var startIndex = Math.min(Math.max(0, args[0] < 0 ? arrayLength + args[0] : args[0]), arrayLength), endDeleteIndex = argsLength === 1 ? arrayLength : Math.min(startIndex + (args[1] || 0), arrayLength), endAddIndex = startIndex + argsLength - 2, endIndex = Math.max(endDeleteIndex, endAddIndex), additions = [], deletions = []; for (var index = startIndex, argsIndex = 2; index < endIndex; ++index, ++argsIndex) { if (index < endDeleteIndex) deletions.push(pushDiff('deleted', rawArray[index], index)); if (index < endAddIndex) additions.push(pushDiff('added', args[argsIndex], index)); } ko.utils.findMovesInArrayComparison(deletions, additions); break; default: return; } cachedDiff = diff; }; }; ko.computed = ko.dependentObservable = function (evaluatorFunctionOrOptions, evaluatorFunctionTarget, options) { var _latestValue, _needsEvaluation = true, _isBeingEvaluated = false, _suppressDisposalUntilDisposeWhenReturnsFalse = false, _isDisposed = false, readFunction = evaluatorFunctionOrOptions, pure = false, isSleeping = false; if (readFunction && typeof readFunction == "object") { // Single-parameter syntax - everything is on this "options" param options = readFunction; readFunction = options["read"]; } else { // Multi-parameter syntax - construct the options according to the params passed options = options || {}; if (!readFunction) readFunction = options["read"]; } if (typeof readFunction != "function") throw new Error("Pass a function that returns the value of the ko.computed"); function addDependencyTracking(id, target, trackingObj) { if (pure && target === dependentObservable) { throw Error("A 'pure' computed must not be called recursively"); } dependencyTracking[id] = trackingObj; trackingObj._order = _dependenciesCount++; trackingObj._version = target.getVersion(); } function haveDependenciesChanged() { var id, dependency; for (id in dependencyTracking) { if (dependencyTracking.hasOwnProperty(id)) { dependency = dependencyTracking[id]; if (dependency._target.hasChanged(dependency._version)) { return true; } } } } function disposeComputed() { if (!isSleeping && dependencyTracking) { ko.utils.objectForEach(dependencyTracking, function (id, dependency) { if (dependency.dispose) dependency.dispose(); }); } dependencyTracking = null; _dependenciesCount = 0; _isDisposed = true; _needsEvaluation = false; isSleeping = false; } function evaluatePossiblyAsync() { var throttleEvaluationTimeout = dependentObservable['throttleEvaluation']; if (throttleEvaluationTimeout && throttleEvaluationTimeout >= 0) { clearTimeout(evaluationTimeoutInstance); evaluationTimeoutInstance = setTimeout(function () { evaluateImmediate(true /*notifyChange*/); }, throttleEvaluationTimeout); } else if (dependentObservable._evalRateLimited) { dependentObservable._evalRateLimited(); } else { evaluateImmediate(true /*notifyChange*/); } } function evaluateImmediate(notifyChange) { if (_isBeingEvaluated) { // If the evaluation of a ko.computed causes side effects, it's possible that it will trigger its own re-evaluation. // This is not desirable (it's hard for a developer to realise a chain of dependencies might cause this, and they almost // certainly didn't intend infinite re-evaluations). So, for predictability, we simply prevent ko.computeds from causing // their own re-evaluation. Further discussion at https://github.com/SteveSanderson/knockout/pull/387 return; } // Do not evaluate (and possibly capture new dependencies) if disposed if (_isDisposed) { return; } if (disposeWhen && disposeWhen()) { // See comment below about _suppressDisposalUntilDisposeWhenReturnsFalse if (!_suppressDisposalUntilDisposeWhenReturnsFalse) { dispose(); return; } } else { // It just did return false, so we can stop suppressing now _suppressDisposalUntilDisposeWhenReturnsFalse = false; } _isBeingEvaluated = true; try { // Initially, we assume that none of the subscriptions are still being used (i.e., all are candidates for disposal). // Then, during evaluation, we cross off any that are in fact still being used. var disposalCandidates = dependencyTracking, disposalCount = _dependenciesCount, isInitial = pure ? undefined : !_dependenciesCount; // If we're evaluating when there are no previous dependencies, it must be the first time ko.dependencyDetection.begin({ callback: function(subscribable, id) { if (!_isDisposed) { if (disposalCount && disposalCandidates[id]) { // Don't want to dispose this subscription, as it's still being used addDependencyTracking(id, subscribable, disposalCandidates[id]); delete disposalCandidates[id]; --disposalCount; } else if (!dependencyTracking[id]) { // Brand new subscription - add it addDependencyTracking(id, subscribable, isSleeping ? { _target: subscribable } : subscribable.subscribe(evaluatePossiblyAsync)); } } }, computed: dependentObservable, isInitial: isInitial }); dependencyTracking = {}; _dependenciesCount = 0; try { var newValue = evaluatorFunctionTarget ? readFunction.call(evaluatorFunctionTarget) : readFunction(); } finally { ko.dependencyDetection.end(); // For each subscription no longer being used, remove it from the active subscriptions list and dispose it if (disposalCount && !isSleeping) { ko.utils.objectForEach(disposalCandidates, function(id, toDispose) { if (toDispose.dispose) toDispose.dispose(); }); } _needsEvaluation = false; } if (dependentObservable.isDifferent(_latestValue, newValue)) { if (!isSleeping) { notify(_latestValue, "beforeChange"); } _latestValue = newValue; if (DEBUG) dependentObservable._latestValue = _latestValue; if (isSleeping) { dependentObservable.updateVersion(); } else if (notifyChange) { notify(_latestValue); } } if (isInitial) { notify(_latestValue, "awake"); } } finally { _isBeingEvaluated = false; } if (!_dependenciesCount) dispose(); } function dependentObservable() { if (arguments.length > 0) { if (typeof writeFunction === "function") { // Writing a value writeFunction.apply(evaluatorFunctionTarget, arguments); } else { throw new Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters."); } return this; // Permits chained assignments } else { // Reading the value ko.dependencyDetection.registerDependency(dependentObservable); if (_needsEvaluation || (isSleeping && haveDependenciesChanged())) { evaluateImmediate(); } return _latestValue; } } function peek() { // Peek won't re-evaluate, except while the computed is sleeping or to get the initial value when "deferEvaluation" is set. if ((_needsEvaluation && !_dependenciesCount) || (isSleeping && haveDependenciesChanged())) { evaluateImmediate(); } return _latestValue; } function isActive() { return _needsEvaluation || _dependenciesCount > 0; } function notify(value, event) { dependentObservable["notifySubscribers"](value, event); } // By here, "options" is always non-null var writeFunction = options["write"], disposeWhenNodeIsRemoved = options["disposeWhenNodeIsRemoved"] || options.disposeWhenNodeIsRemoved || null, disposeWhenOption = options["disposeWhen"] || options.disposeWhen, disposeWhen = disposeWhenOption, dispose = disposeComputed, dependencyTracking = {}, _dependenciesCount = 0, evaluationTimeoutInstance = null; if (!evaluatorFunctionTarget) evaluatorFunctionTarget = options["owner"]; ko.subscribable.call(dependentObservable); ko.utils.setPrototypeOfOrExtend(dependentObservable, ko.dependentObservable['fn']); dependentObservable.peek = peek; dependentObservable.getDependenciesCount = function () { return _dependenciesCount; }; dependentObservable.hasWriteFunction = typeof writeFunction === "function"; dependentObservable.dispose = function () { dispose(); }; dependentObservable.isActive = isActive; // Replace the limit function with one that delays evaluation as well. var originalLimit = dependentObservable.limit; dependentObservable.limit = function(limitFunction) { originalLimit.call(dependentObservable, limitFunction); dependentObservable._evalRateLimited = function() { dependentObservable._rateLimitedBeforeChange(_latestValue); _needsEvaluation = true; // Mark as dirty // Pass the observable to the rate-limit code, which will access it when // it's time to do the notification. dependentObservable._rateLimitedChange(dependentObservable); } }; if (options['pure']) { pure = true; isSleeping = true; // Starts off sleeping; will awake on the first subscription dependentObservable.beforeSubscriptionAdd = function (event) { // If asleep, wake up the computed by subscribing to any dependencies. if (!_isDisposed && isSleeping && event == 'change') { isSleeping = false; if (_needsEvaluation || haveDependenciesChanged()) { dependencyTracking = null; _dependenciesCount = 0; _needsEvaluation = true; evaluateImmediate(); } else { // First put the dependencies in order var dependeciesOrder = []; ko.utils.objectForEach(dependencyTracking, function (id, dependency) { dependeciesOrder[dependency._order] = id; }); // Next, subscribe to each one ko.utils.arrayForEach(dependeciesOrder, function(id, order) { var dependency = dependencyTracking[id], subscription = dependency._target.subscribe(evaluatePossiblyAsync); subscription._order = order; subscription._version = dependency._version; dependencyTracking[id] = subscription; }); } if (!_isDisposed) { // test since evaluating could trigger disposal notify(_latestValue, "awake"); } } }; dependentObservable.afterSubscriptionRemove = function (event) { if (!_isDisposed && event == 'change' && !dependentObservable.hasSubscriptionsForEvent('change')) { ko.utils.objectForEach(dependencyTracking, function (id, dependency) { if (dependency.dispose) { dependencyTracking[id] = { _target: dependency._target, _order: dependency._order, _version: dependency._version }; dependency.dispose(); } }); isSleeping = true; notify(undefined, "asleep"); } }; // Because a pure computed is not automatically updated while it is sleeping, we can't // simply return the version number. Instead, we check if any of the dependencies have // changed and conditionally re-evaluate the computed observable. dependentObservable._originalGetVersion = dependentObservable.getVersion; dependentObservable.getVersion = function () { if (isSleeping && (_needsEvaluation || haveDependenciesChanged())) { evaluateImmediate(); } return dependentObservable._originalGetVersion(); }; } else if (options['deferEvaluation']) { // This will force a computed with deferEvaluation to evaluate when the first subscriptions is registered. dependentObservable.beforeSubscriptionAdd = function (event) { if (event == 'change' || event == 'beforeChange') { peek(); } } } ko.exportProperty(dependentObservable, 'peek', dependentObservable.peek); ko.exportProperty(dependentObservable, 'dispose', dependentObservable.dispose); ko.exportProperty(dependentObservable, 'isActive', dependentObservable.isActive); ko.exportProperty(dependentObservable, 'getDependenciesCount', dependentObservable.getDependenciesCount); // Add a "disposeWhen" callback that, on each evaluation, disposes if the node was removed without using ko.removeNode. if (disposeWhenNodeIsRemoved) { // Since this computed is associated with a DOM node, and we don't want to dispose the computed // until the DOM node is *removed* from the document (as opposed to never having been in the document), // we'll prevent disposal until "disposeWhen" first returns false. _suppressDisposalUntilDisposeWhenReturnsFalse = true; // Only watch for the node's disposal if the value really is a node. It might not be, // e.g., { disposeWhenNodeIsRemoved: true } can be used to opt into the "only dispose // after first false result" behaviour even if there's no specific node to watch. This // technique is intended for KO's internal use only and shouldn't be documented or used // by application code, as it's likely to change in a future version of KO. if (disposeWhenNodeIsRemoved.nodeType) { disposeWhen = function () { return !ko.utils.domNodeIsAttachedToDocument(disposeWhenNodeIsRemoved) || (disposeWhenOption && disposeWhenOption()); }; } } // Evaluate, unless sleeping or deferEvaluation is true if (!isSleeping && !options['deferEvaluation']) evaluateImmediate(); // Attach a DOM node disposal callback so that the computed will be proactively disposed as soon as the node is // removed using ko.removeNode. But skip if isActive is false (there will never be any dependencies to dispose). if (disposeWhenNodeIsRemoved && isActive() && disposeWhenNodeIsRemoved.nodeType) { dispose = function() { ko.utils.domNodeDisposal.removeDisposeCallback(disposeWhenNodeIsRemoved, dispose); disposeComputed(); }; ko.utils.domNodeDisposal.addDisposeCallback(disposeWhenNodeIsRemoved, dispose); } return dependentObservable; }; ko.isComputed = function(instance) { return ko.hasPrototype(instance, ko.dependentObservable); }; var protoProp = ko.observable.protoProperty; // == "__ko_proto__" ko.dependentObservable[protoProp] = ko.observable; ko.dependentObservable['fn'] = { "equalityComparer": valuesArePrimitiveAndEqual }; ko.dependentObservable['fn'][protoProp] = ko.dependentObservable; // Note that for browsers that don't support proto assignment, the // inheritance chain is created manually in the ko.dependentObservable constructor if (ko.utils.canSetPrototype) { ko.utils.setPrototypeOf(ko.dependentObservable['fn'], ko.subscribable['fn']); } ko.exportSymbol('dependentObservable', ko.dependentObservable); ko.exportSymbol('computed', ko.dependentObservable); // Make "ko.computed" an alias for "ko.dependentObservable" ko.exportSymbol('isComputed', ko.isComputed); ko.pureComputed = function (evaluatorFunctionOrOptions, evaluatorFunctionTarget) { if (typeof evaluatorFunctionOrOptions === 'function') { return ko.computed(evaluatorFunctionOrOptions, evaluatorFunctionTarget, {'pure':true}); } else { evaluatorFunctionOrOptions = ko.utils.extend({}, evaluatorFunctionOrOptions); // make a copy of the parameter object evaluatorFunctionOrOptions['pure'] = true; return ko.computed(evaluatorFunctionOrOptions, evaluatorFunctionTarget); } } ko.exportSymbol('pureComputed', ko.pureComputed); (function() { var maxNestedObservableDepth = 10; // Escape the (unlikely) pathalogical case where an observable's current value is itself (or similar reference cycle) ko.toJS = function(rootObject) { if (arguments.length == 0) throw new Error("When calling ko.toJS, pass the object you want to convert."); // We just unwrap everything at every level in the object graph return mapJsObjectGraph(rootObject, function(valueToMap) { // Loop because an observable's value might in turn be another observable wrapper for (var i = 0; ko.isObservable(valueToMap) && (i < maxNestedObservableDepth); i++) valueToMap = valueToMap(); return valueToMap; }); }; ko.toJSON = function(rootObject, replacer, space) { // replacer and space are optional var plainJavaScriptObject = ko.toJS(rootObject); return ko.utils.stringifyJson(plainJavaScriptObject, replacer, space); }; function mapJsObjectGraph(rootObject, mapInputCallback, visitedObjects) { visitedObjects = visitedObjects || new objectLookup(); rootObject = mapInputCallback(rootObject); var canHaveProperties = (typeof rootObject == "object") && (rootObject !== null) && (rootObject !== undefined) && (!(rootObject instanceof Date)) && (!(rootObject instanceof String)) && (!(rootObject instanceof Number)) && (!(rootObject instanceof Boolean)); if (!canHaveProperties) return rootObject; var outputProperties = rootObject instanceof Array ? [] : {}; visitedObjects.save(rootObject, outputProperties); visitPropertiesOrArrayEntries(rootObject, function(indexer) { var propertyValue = mapInputCallback(rootObject[indexer]); switch (typeof propertyValue) { case "boolean": case "number": case "string": case "function": outputProperties[indexer] = propertyValue; break; case "object": case "undefined": var previouslyMappedValue = visitedObjects.get(propertyValue); outputProperties[indexer] = (previouslyMappedValue !== undefined) ? previouslyMappedValue : mapJsObjectGraph(propertyValue, mapInputCallback, visitedObjects); break; } }); return outputProperties; } function visitPropertiesOrArrayEntries(rootObject, visitorCallback) { if (rootObject instanceof Array) { for (var i = 0; i < rootObject.length; i++) visitorCallback(i); // For arrays, also respect toJSON property for custom mappings (fixes #278) if (typeof rootObject['toJSON'] == 'function') visitorCallback('toJSON'); } else { for (var propertyName in rootObject) { visitorCallback(propertyName); } } }; function objectLookup() { this.keys = []; this.values = []; }; objectLookup.prototype = { constructor: objectLookup, save: function(key, value) { var existingIndex = ko.utils.arrayIndexOf(this.keys, key); if (existingIndex >= 0) this.values[existingIndex] = value; else { this.keys.push(key); this.values.push(value); } }, get: function(key) { var existingIndex = ko.utils.arrayIndexOf(this.keys, key); return (existingIndex >= 0) ? this.values[existingIndex] : undefined; } }; })(); ko.exportSymbol('toJS', ko.toJS); ko.exportSymbol('toJSON', ko.toJSON); (function () { var hasDomDataExpandoProperty = '__ko__hasDomDataOptionValue__'; // Normally, SELECT elements and their OPTIONs can only take value of type 'string' (because the values // are stored on DOM attributes). ko.selectExtensions provides a way for SELECTs/OPTIONs to have values // that are arbitrary objects. This is very convenient when implementing things like cascading dropdowns. ko.selectExtensions = { readValue : function(element) { switch (ko.utils.tagNameLower(element)) { case 'option': if (element[hasDomDataExpandoProperty] === true) return ko.utils.domData.get(element, ko.bindingHandlers.options.optionValueDomDataKey); return ko.utils.ieVersion <= 7 ? (element.getAttributeNode('value') && element.getAttributeNode('value').specified ? element.value : element.text) : element.value; case 'select': return element.selectedIndex >= 0 ? ko.selectExtensions.readValue(element.options[element.selectedIndex]) : undefined; default: return element.value; } }, writeValue: function(element, value, allowUnset) { switch (ko.utils.tagNameLower(element)) { case 'option': switch(typeof value) { case "string": ko.utils.domData.set(element, ko.bindingHandlers.options.optionValueDomDataKey, undefined); if (hasDomDataExpandoProperty in element) { // IE <= 8 throws errors if you delete non-existent properties from a DOM node delete element[hasDomDataExpandoProperty]; } element.value = value; break; default: // Store arbitrary object using DomData ko.utils.domData.set(element, ko.bindingHandlers.options.optionValueDomDataKey, value); element[hasDomDataExpandoProperty] = true; // Special treatment of numbers is just for backward compatibility. KO 1.2.1 wrote numerical values to element.value. element.value = typeof value === "number" ? value : ""; break; } break; case 'select': if (value === "" || value === null) // A blank string or null value will select the caption value = undefined; var selection = -1; for (var i = 0, n = element.options.length, optionValue; i < n; ++i) { optionValue = ko.selectExtensions.readValue(element.options[i]); // Include special check to handle selecting a caption with a blank string value if (optionValue == value || (optionValue == "" && value === undefined)) { selection = i; break; } } if (allowUnset || selection >= 0 || (value === undefined && element.size > 1)) { element.selectedIndex = selection; } break; default: if ((value === null) || (value === undefined)) value = ""; element.value = value; break; } } }; })(); ko.exportSymbol('selectExtensions', ko.selectExtensions); ko.exportSymbol('selectExtensions.readValue', ko.selectExtensions.readValue); ko.exportSymbol('selectExtensions.writeValue', ko.selectExtensions.writeValue); ko.expressionRewriting = (function () { var javaScriptReservedWords = ["true", "false", "null", "undefined"]; // Matches something that can be assigned to--either an isolated identifier or something ending with a property accessor // This is designed to be simple and avoid false negatives, but could produce false positives (e.g., a+b.c). // This also will not properly handle nested brackets (e.g., obj1[obj2['prop']]; see #911). var javaScriptAssignmentTarget = /^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i; function getWriteableValue(expression) { if (ko.utils.arrayIndexOf(javaScriptReservedWords, expression) >= 0) return false; var match = expression.match(javaScriptAssignmentTarget); return match === null ? false : match[1] ? ('Object(' + match[1] + ')' + match[2]) : expression; } // The following regular expressions will be used to split an object-literal string into tokens // These two match strings, either with double quotes or single quotes var stringDouble = '"(?:[^"\\\\]|\\\\.)*"', stringSingle = "'(?:[^'\\\\]|\\\\.)*'", // Matches a regular expression (text enclosed by slashes), but will also match sets of divisions // as a regular expression (this is handled by the parsing loop below). stringRegexp = '/(?:[^/\\\\]|\\\\.)*/\w*', // These characters have special meaning to the parser and must not appear in the middle of a // token, except as part of a string. specials = ',"\'{}()/:[\\]', // Match text (at least two characters) that does not contain any of the above special characters, // although some of the special characters are allowed to start it (all but the colon and comma). // The text can contain spaces, but leading or trailing spaces are skipped. everyThingElse = '[^\\s:,/][^' + specials + ']*[^\\s' + specials + ']', // Match any non-space character not matched already. This will match colons and commas, since they're // not matched by "everyThingElse", but will also match any other single character that wasn't already // matched (for example: in "a: 1, b: 2", each of the non-space characters will be matched by oneNotSpace). oneNotSpace = '[^\\s]', // Create the actual regular expression by or-ing the above strings. The order is important. bindingToken = RegExp(stringDouble + '|' + stringSingle + '|' + stringRegexp + '|' + everyThingElse + '|' + oneNotSpace, 'g'), // Match end of previous token to determine whether a slash is a division or regex. divisionLookBehind = /[\])"'A-Za-z0-9_$]+$/, keywordRegexLookBehind = {'in':1,'return':1,'typeof':1}; function parseObjectLiteral(objectLiteralString) { // Trim leading and trailing spaces from the string var str = ko.utils.stringTrim(objectLiteralString); // Trim braces '{' surrounding the whole object literal if (str.charCodeAt(0) === 123) str = str.slice(1, -1); // Split into tokens var result = [], toks = str.match(bindingToken), key, values = [], depth = 0; if (toks) { // Append a comma so that we don't need a separate code block to deal with the last item toks.push(','); for (var i = 0, tok; tok = toks[i]; ++i) { var c = tok.charCodeAt(0); // A comma signals the end of a key/value pair if depth is zero if (c === 44) { // "," if (depth <= 0) { result.push((key && values.length) ? {key: key, value: values.join('')} : {'unknown': key || values.join('')}); key = depth = 0; values = []; continue; } // Simply skip the colon that separates the name and value } else if (c === 58) { // ":" if (!depth && !key && values.length === 1) { key = values.pop(); continue; } // A set of slashes is initially matched as a regular expression, but could be division } else if (c === 47 && i && tok.length > 1) { // "/" // Look at the end of the previous token to determine if the slash is actually division var match = toks[i-1].match(divisionLookBehind); if (match && !keywordRegexLookBehind[match[0]]) { // The slash is actually a division punctuator; re-parse the remainder of the string (not including the slash) str = str.substr(str.indexOf(tok) + 1); toks = str.match(bindingToken); toks.push(','); i = -1; // Continue with just the slash tok = '/'; } // Increment depth for parentheses, braces, and brackets so that interior commas are ignored } else if (c === 40 || c === 123 || c === 91) { // '(', '{', '[' ++depth; } else if (c === 41 || c === 125 || c === 93) { // ')', '}', ']' --depth; // The key will be the first token; if it's a string, trim the quotes } else if (!key && !values.length && (c === 34 || c === 39)) { // '"', "'" tok = tok.slice(1, -1); } values.push(tok); } } return result; } // Two-way bindings include a write function that allow the handler to update the value even if it's not an observable. var twoWayBindings = {}; function preProcessBindings(bindingsStringOrKeyValueArray, bindingOptions) { bindingOptions = bindingOptions || {}; function processKeyValue(key, val) { var writableVal; function callPreprocessHook(obj) { return (obj && obj['preprocess']) ? (val = obj['preprocess'](val, key, processKeyValue)) : true; } if (!bindingParams) { if (!callPreprocessHook(ko['getBindingHandler'](key))) return; if (twoWayBindings[key] && (writableVal = getWriteableValue(val))) { // For two-way bindings, provide a write method in case the value // isn't a writable observable. propertyAccessorResultStrings.push("'" + key + "':function(_z){" + writableVal + "=_z}"); } } // Values are wrapped in a function so that each value can be accessed independently if (makeValueAccessors) { val = 'function(){return ' + val + ' }'; } resultStrings.push("'" + key + "':" + val); } var resultStrings = [], propertyAccessorResultStrings = [], makeValueAccessors = bindingOptions['valueAccessors'], bindingParams = bindingOptions['bindingParams'], keyValueArray = typeof bindingsStringOrKeyValueArray === "string" ? parseObjectLiteral(bindingsStringOrKeyValueArray) : bindingsStringOrKeyValueArray; ko.utils.arrayForEach(keyValueArray, function(keyValue) { processKeyValue(keyValue.key || keyValue['unknown'], keyValue.value); }); if (propertyAccessorResultStrings.length) processKeyValue('_ko_property_writers', "{" + propertyAccessorResultStrings.join(",") + " }"); return resultStrings.join(","); } return { bindingRewriteValidators: [], twoWayBindings: twoWayBindings, parseObjectLiteral: parseObjectLiteral, preProcessBindings: preProcessBindings, keyValueArrayContainsKey: function(keyValueArray, key) { for (var i = 0; i < keyValueArray.length; i++) if (keyValueArray[i]['key'] == key) return true; return false; }, // Internal, private KO utility for updating model properties from within bindings // property: If the property being updated is (or might be) an observable, pass it here // If it turns out to be a writable observable, it will be written to directly // allBindings: An object with a get method to retrieve bindings in the current execution context. // This will be searched for a '_ko_property_writers' property in case you're writing to a non-observable // key: The key identifying the property to be written. Example: for { hasFocus: myValue }, write to 'myValue' by specifying the key 'hasFocus' // value: The value to be written // checkIfDifferent: If true, and if the property being written is a writable observable, the value will only be written if // it is !== existing value on that writable observable writeValueToProperty: function(property, allBindings, key, value, checkIfDifferent) { if (!property || !ko.isObservable(property)) { var propWriters = allBindings.get('_ko_property_writers'); if (propWriters && propWriters[key]) propWriters[key](value); } else if (ko.isWriteableObservable(property) && (!checkIfDifferent || property.peek() !== value)) { property(value); } } }; })(); ko.exportSymbol('expressionRewriting', ko.expressionRewriting); ko.exportSymbol('expressionRewriting.bindingRewriteValidators', ko.expressionRewriting.bindingRewriteValidators); ko.exportSymbol('expressionRewriting.parseObjectLiteral', ko.expressionRewriting.parseObjectLiteral); ko.exportSymbol('expressionRewriting.preProcessBindings', ko.expressionRewriting.preProcessBindings); // Making bindings explicitly declare themselves as "two way" isn't ideal in the long term (it would be better if // all bindings could use an official 'property writer' API without needing to declare that they might). However, // since this is not, and has never been, a public API (_ko_property_writers was never documented), it's acceptable // as an internal implementation detail in the short term. // For those developers who rely on _ko_property_writers in their custom bindings, we expose _twoWayBindings as an // undocumented feature that makes it relatively easy to upgrade to KO 3.0. However, this is still not an official // public API, and we reserve the right to remove it at any time if we create a real public property writers API. ko.exportSymbol('expressionRewriting._twoWayBindings', ko.expressionRewriting.twoWayBindings); // For backward compatibility, define the following aliases. (Previously, these function names were misleading because // they referred to JSON specifically, even though they actually work with arbitrary JavaScript object literal expressions.) ko.exportSymbol('jsonExpressionRewriting', ko.expressionRewriting); ko.exportSymbol('jsonExpressionRewriting.insertPropertyAccessorsIntoJson', ko.expressionRewriting.preProcessBindings); (function() { // "Virtual elements" is an abstraction on top of the usual DOM API which understands the notion that comment nodes // may be used to represent hierarchy (in addition to the DOM's natural hierarchy). // If you call the DOM-manipulating functions on ko.virtualElements, you will be able to read and write the state // of that virtual hierarchy // // The point of all this is to support containerless templates (e.g., <!-- ko foreach:someCollection -->blah<!-- /ko -->) // without having to scatter special cases all over the binding and templating code. // IE 9 cannot reliably read the "nodeValue" property of a comment node (see https://github.com/SteveSanderson/knockout/issues/186) // but it does give them a nonstandard alternative property called "text" that it can read reliably. Other browsers don't have that property. // So, use node.text where available, and node.nodeValue elsewhere var commentNodesHaveTextProperty = document && document.createComment("test").text === "<!--test-->"; var startCommentRegex = commentNodesHaveTextProperty ? /^<!--\s*ko(?:\s+([\s\S]+))?\s*-->$/ : /^\s*ko(?:\s+([\s\S]+))?\s*$/; var endCommentRegex = commentNodesHaveTextProperty ? /^<!--\s*\/ko\s*-->$/ : /^\s*\/ko\s*$/; var htmlTagsWithOptionallyClosingChildren = { 'ul': true, 'ol': true }; function isStartComment(node) { return (node.nodeType == 8) && startCommentRegex.test(commentNodesHaveTextProperty ? node.text : node.nodeValue); } function isEndComment(node) { return (node.nodeType == 8) && endCommentRegex.test(commentNodesHaveTextProperty ? node.text : node.nodeValue); } function getVirtualChildren(startComment, allowUnbalanced) { var currentNode = startComment; var depth = 1; var children = []; while (currentNode = currentNode.nextSibling) { if (isEndComment(currentNode)) { depth--; if (depth === 0) return children; } children.push(currentNode); if (isStartComment(currentNode)) depth++; } if (!allowUnbalanced) throw new Error("Cannot find closing comment tag to match: " + startComment.nodeValue); return null; } function getMatchingEndComment(startComment, allowUnbalanced) { var allVirtualChildren = getVirtualChildren(startComment, allowUnbalanced); if (allVirtualChildren) { if (allVirtualChildren.length > 0) return allVirtualChildren[allVirtualChildren.length - 1].nextSibling; return startComment.nextSibling; } else return null; // Must have no matching end comment, and allowUnbalanced is true } function getUnbalancedChildTags(node) { // e.g., from <div>OK</div><!-- ko blah --><span>Another</span>, returns: <!-- ko blah --><span>Another</span> // from <div>OK</div><!-- /ko --><!-- /ko -->, returns: <!-- /ko --><!-- /ko --> var childNode = node.firstChild, captureRemaining = null; if (childNode) { do { if (captureRemaining) // We already hit an unbalanced node and are now just scooping up all subsequent nodes captureRemaining.push(childNode); else if (isStartComment(childNode)) { var matchingEndComment = getMatchingEndComment(childNode, /* allowUnbalanced: */ true); if (matchingEndComment) // It's a balanced tag, so skip immediately to the end of this virtual set childNode = matchingEndComment; else captureRemaining = [childNode]; // It's unbalanced, so start capturing from this point } else if (isEndComment(childNode)) { captureRemaining = [childNode]; // It's unbalanced (if it wasn't, we'd have skipped over it already), so start capturing } } while (childNode = childNode.nextSibling); } return captureRemaining; } ko.virtualElements = { allowedBindings: {}, childNodes: function(node) { return isStartComment(node) ? getVirtualChildren(node) : node.childNodes; }, emptyNode: function(node) { if (!isStartComment(node)) ko.utils.emptyDomNode(node); else { var virtualChildren = ko.virtualElements.childNodes(node); for (var i = 0, j = virtualChildren.length; i < j; i++) ko.removeNode(virtualChildren[i]); } }, setDomNodeChildren: function(node, childNodes) { if (!isStartComment(node)) ko.utils.setDomNodeChildren(node, childNodes); else { ko.virtualElements.emptyNode(node); var endCommentNode = node.nextSibling; // Must be the next sibling, as we just emptied the children for (var i = 0, j = childNodes.length; i < j; i++) endCommentNode.parentNode.insertBefore(childNodes[i], endCommentNode); } }, prepend: function(containerNode, nodeToPrepend) { if (!isStartComment(containerNode)) { if (containerNode.firstChild) containerNode.insertBefore(nodeToPrepend, containerNode.firstChild); else containerNode.appendChild(nodeToPrepend); } else { // Start comments must always have a parent and at least one following sibling (the end comment) containerNode.parentNode.insertBefore(nodeToPrepend, containerNode.nextSibling); } }, insertAfter: function(containerNode, nodeToInsert, insertAfterNode) { if (!insertAfterNode) { ko.virtualElements.prepend(containerNode, nodeToInsert); } else if (!isStartComment(containerNode)) { // Insert after insertion point if (insertAfterNode.nextSibling) containerNode.insertBefore(nodeToInsert, insertAfterNode.nextSibling); else containerNode.appendChild(nodeToInsert); } else { // Children of start comments must always have a parent and at least one following sibling (the end comment) containerNode.parentNode.insertBefore(nodeToInsert, insertAfterNode.nextSibling); } }, firstChild: function(node) { if (!isStartComment(node)) return node.firstChild; if (!node.nextSibling || isEndComment(node.nextSibling)) return null; return node.nextSibling; }, nextSibling: function(node) { if (isStartComment(node)) node = getMatchingEndComment(node); if (node.nextSibling && isEndComment(node.nextSibling)) return null; return node.nextSibling; }, hasBindingValue: isStartComment, virtualNodeBindingValue: function(node) { var regexMatch = (commentNodesHaveTextProperty ? node.text : node.nodeValue).match(startCommentRegex); return regexMatch ? regexMatch[1] : null; }, normaliseVirtualElementDomStructure: function(elementVerified) { // Workaround for https://github.com/SteveSanderson/knockout/issues/155 // (IE <= 8 or IE 9 quirks mode parses your HTML weirdly, treating closing </li> tags as if they don't exist, thereby moving comment nodes // that are direct descendants of <ul> into the preceding <li>) if (!htmlTagsWithOptionallyClosingChildren[ko.utils.tagNameLower(elementVerified)]) return; // Scan immediate children to see if they contain unbalanced comment tags. If they do, those comment tags // must be intended to appear *after* that child, so move them there. var childNode = elementVerified.firstChild; if (childNode) { do { if (childNode.nodeType === 1) { var unbalancedTags = getUnbalancedChildTags(childNode); if (unbalancedTags) { // Fix up the DOM by moving the unbalanced tags to where they most likely were intended to be placed - *after* the child var nodeToInsertBefore = childNode.nextSibling; for (var i = 0; i < unbalancedTags.length; i++) { if (nodeToInsertBefore) elementVerified.insertBefore(unbalancedTags[i], nodeToInsertBefore); else elementVerified.appendChild(unbalancedTags[i]); } } } } while (childNode = childNode.nextSibling); } } }; })(); ko.exportSymbol('virtualElements', ko.virtualElements); ko.exportSymbol('virtualElements.allowedBindings', ko.virtualElements.allowedBindings); ko.exportSymbol('virtualElements.emptyNode', ko.virtualElements.emptyNode); //ko.exportSymbol('virtualElements.firstChild', ko.virtualElements.firstChild); // firstChild is not minified ko.exportSymbol('virtualElements.insertAfter', ko.virtualElements.insertAfter); //ko.exportSymbol('virtualElements.nextSibling', ko.virtualElements.nextSibling); // nextSibling is not minified ko.exportSymbol('virtualElements.prepend', ko.virtualElements.prepend); ko.exportSymbol('virtualElements.setDomNodeChildren', ko.virtualElements.setDomNodeChildren); (function() { var defaultBindingAttributeName = "data-bind"; ko.bindingProvider = function() { this.bindingCache = {}; }; ko.utils.extend(ko.bindingProvider.prototype, { 'nodeHasBindings': function(node) { switch (node.nodeType) { case 1: // Element return node.getAttribute(defaultBindingAttributeName) != null || ko.components['getComponentNameForNode'](node); case 8: // Comment node return ko.virtualElements.hasBindingValue(node); default: return false; } }, 'getBindings': function(node, bindingContext) { var bindingsString = this['getBindingsString'](node, bindingContext), parsedBindings = bindingsString ? this['parseBindingsString'](bindingsString, bindingContext, node) : null; return ko.components.addBindingsForCustomElement(parsedBindings, node, bindingContext, /* valueAccessors */ false); }, 'getBindingAccessors': function(node, bindingContext) { var bindingsString = this['getBindingsString'](node, bindingContext), parsedBindings = bindingsString ? this['parseBindingsString'](bindingsString, bindingContext, node, { 'valueAccessors': true }) : null; return ko.components.addBindingsForCustomElement(parsedBindings, node, bindingContext, /* valueAccessors */ true); }, // The following function is only used internally by this default provider. // It's not part of the interface definition for a general binding provider. 'getBindingsString': function(node, bindingContext) { switch (node.nodeType) { case 1: return node.getAttribute(defaultBindingAttributeName); // Element case 8: return ko.virtualElements.virtualNodeBindingValue(node); // Comment node default: return null; } }, // The following function is only used internally by this default provider. // It's not part of the interface definition for a general binding provider. 'parseBindingsString': function(bindingsString, bindingContext, node, options) { try { var bindingFunction = createBindingsStringEvaluatorViaCache(bindingsString, this.bindingCache, options); return bindingFunction(bindingContext, node); } catch (ex) { ex.message = "Unable to parse bindings.\nBindings value: " + bindingsString + "\nMessage: " + ex.message; throw ex; } } }); ko.bindingProvider['instance'] = new ko.bindingProvider(); function createBindingsStringEvaluatorViaCache(bindingsString, cache, options) { var cacheKey = bindingsString + (options && options['valueAccessors'] || ''); return cache[cacheKey] || (cache[cacheKey] = createBindingsStringEvaluator(bindingsString, options)); } function createBindingsStringEvaluator(bindingsString, options) { // Build the source for a function that evaluates "expression" // For each scope variable, add an extra level of "with" nesting // Example result: with(sc1) { with(sc0) { return (expression) } } var rewrittenBindings = ko.expressionRewriting.preProcessBindings(bindingsString, options), functionBody = "with($context){with($data||{}){return{" + rewrittenBindings + "}}}"; return new Function("$context", "$element", functionBody); } })(); ko.exportSymbol('bindingProvider', ko.bindingProvider); (function () { ko.bindingHandlers = {}; // The following element types will not be recursed into during binding. In the future, we // may consider adding <template> to this list, because such elements' contents are always // intended to be bound in a different context from where they appear in the document. var bindingDoesNotRecurseIntoElementTypes = { // Don't want bindings that operate on text nodes to mutate <script> and <textarea> contents, // because it's unexpected and a potential XSS issue 'script': true, 'textarea': true }; // Use an overridable method for retrieving binding handlers so that a plugins may support dynamically created handlers ko['getBindingHandler'] = function(bindingKey) { return ko.bindingHandlers[bindingKey]; }; // The ko.bindingContext constructor is only called directly to create the root context. For child // contexts, use bindingContext.createChildContext or bindingContext.extend. ko.bindingContext = function(dataItemOrAccessor, parentContext, dataItemAlias, extendCallback) { // The binding context object includes static properties for the current, parent, and root view models. // If a view model is actually stored in an observable, the corresponding binding context object, and // any child contexts, must be updated when the view model is changed. function updateContext() { // Most of the time, the context will directly get a view model object, but if a function is given, // we call the function to retrieve the view model. If the function accesses any obsevables or returns // an observable, the dependency is tracked, and those observables can later cause the binding // context to be updated. var dataItemOrObservable = isFunc ? dataItemOrAccessor() : dataItemOrAccessor, dataItem = ko.utils.unwrapObservable(dataItemOrObservable); if (parentContext) { // When a "parent" context is given, register a dependency on the parent context. Thus whenever the // parent context is updated, this context will also be updated. if (parentContext._subscribable) parentContext._subscribable(); // Copy $root and any custom properties from the parent context ko.utils.extend(self, parentContext); // Because the above copy overwrites our own properties, we need to reset them. // During the first execution, "subscribable" isn't set, so don't bother doing the update then. if (subscribable) { self._subscribable = subscribable; } } else { self['$parents'] = []; self['$root'] = dataItem; // Export 'ko' in the binding context so it will be available in bindings and templates // even if 'ko' isn't exported as a global, such as when using an AMD loader. // See https://github.com/SteveSanderson/knockout/issues/490 self['ko'] = ko; } self['$rawData'] = dataItemOrObservable; self['$data'] = dataItem; if (dataItemAlias) self[dataItemAlias] = dataItem; // The extendCallback function is provided when creating a child context or extending a context. // It handles the specific actions needed to finish setting up the binding context. Actions in this // function could also add dependencies to this binding context. if (extendCallback) extendCallback(self, parentContext, dataItem); return self['$data']; } function disposeWhen() { return nodes && !ko.utils.anyDomNodeIsAttachedToDocument(nodes); } var self = this, isFunc = typeof(dataItemOrAccessor) == "function" && !ko.isObservable(dataItemOrAccessor), nodes, subscribable = ko.dependentObservable(updateContext, null, { disposeWhen: disposeWhen, disposeWhenNodeIsRemoved: true }); // At this point, the binding context has been initialized, and the "subscribable" computed observable is // subscribed to any observables that were accessed in the process. If there is nothing to track, the // computed will be inactive, and we can safely throw it away. If it's active, the computed is stored in // the context object. if (subscribable.isActive()) { self._subscribable = subscribable; // Always notify because even if the model ($data) hasn't changed, other context properties might have changed subscribable['equalityComparer'] = null; // We need to be able to dispose of this computed observable when it's no longer needed. This would be // easy if we had a single node to watch, but binding contexts can be used by many different nodes, and // we cannot assume that those nodes have any relation to each other. So instead we track any node that // the context is attached to, and dispose the computed when all of those nodes have been cleaned. // Add properties to *subscribable* instead of *self* because any properties added to *self* may be overwritten on updates nodes = []; subscribable._addNode = function(node) { nodes.push(node); ko.utils.domNodeDisposal.addDisposeCallback(node, function(node) { ko.utils.arrayRemoveItem(nodes, node); if (!nodes.length) { subscribable.dispose(); self._subscribable = subscribable = undefined; } }); }; } } // Extend the binding context hierarchy with a new view model object. If the parent context is watching // any obsevables, the new child context will automatically get a dependency on the parent context. // But this does not mean that the $data value of the child context will also get updated. If the child // view model also depends on the parent view model, you must provide a function that returns the correct // view model on each update. ko.bindingContext.prototype['createChildContext'] = function (dataItemOrAccessor, dataItemAlias, extendCallback) { return new ko.bindingContext(dataItemOrAccessor, this, dataItemAlias, function(self, parentContext) { // Extend the context hierarchy by setting the appropriate pointers self['$parentContext'] = parentContext; self['$parent'] = parentContext['$data']; self['$parents'] = (parentContext['$parents'] || []).slice(0); self['$parents'].unshift(self['$parent']); if (extendCallback) extendCallback(self); }); }; // Extend the binding context with new custom properties. This doesn't change the context hierarchy. // Similarly to "child" contexts, provide a function here to make sure that the correct values are set // when an observable view model is updated. ko.bindingContext.prototype['extend'] = function(properties) { // If the parent context references an observable view model, "_subscribable" will always be the // latest view model object. If not, "_subscribable" isn't set, and we can use the static "$data" value. return new ko.bindingContext(this._subscribable || this['$data'], this, null, function(self, parentContext) { // This "child" context doesn't directly track a parent observable view model, // so we need to manually set the $rawData value to match the parent. self['$rawData'] = parentContext['$rawData']; ko.utils.extend(self, typeof(properties) == "function" ? properties() : properties); }); }; // Returns the valueAccesor function for a binding value function makeValueAccessor(value) { return function() { return value; }; } // Returns the value of a valueAccessor function function evaluateValueAccessor(valueAccessor) { return valueAccessor(); } // Given a function that returns bindings, create and return a new object that contains // binding value-accessors functions. Each accessor function calls the original function // so that it always gets the latest value and all dependencies are captured. This is used // by ko.applyBindingsToNode and getBindingsAndMakeAccessors. function makeAccessorsFromFunction(callback) { return ko.utils.objectMap(ko.dependencyDetection.ignore(callback), function(value, key) { return function() { return callback()[key]; }; }); } // Given a bindings function or object, create and return a new object that contains // binding value-accessors functions. This is used by ko.applyBindingsToNode. function makeBindingAccessors(bindings, context, node) { if (typeof bindings === 'function') { return makeAccessorsFromFunction(bindings.bind(null, context, node)); } else { return ko.utils.objectMap(bindings, makeValueAccessor); } } // This function is used if the binding provider doesn't include a getBindingAccessors function. // It must be called with 'this' set to the provider instance. function getBindingsAndMakeAccessors(node, context) { return makeAccessorsFromFunction(this['getBindings'].bind(this, node, context)); } function validateThatBindingIsAllowedForVirtualElements(bindingName) { var validator = ko.virtualElements.allowedBindings[bindingName]; if (!validator) throw new Error("The binding '" + bindingName + "' cannot be used with virtual elements") } function applyBindingsToDescendantsInternal (bindingContext, elementOrVirtualElement, bindingContextsMayDifferFromDomParentElement) { var currentChild, nextInQueue = ko.virtualElements.firstChild(elementOrVirtualElement), provider = ko.bindingProvider['instance'], preprocessNode = provider['preprocessNode']; // Preprocessing allows a binding provider to mutate a node before bindings are applied to it. For example it's // possible to insert new siblings after it, and/or replace the node with a different one. This can be used to // implement custom binding syntaxes, such as {{ value }} for string interpolation, or custom element types that // trigger insertion of <template> contents at that point in the document. if (preprocessNode) { while (currentChild = nextInQueue) { nextInQueue = ko.virtualElements.nextSibling(currentChild); preprocessNode.call(provider, currentChild); } // Reset nextInQueue for the next loop nextInQueue = ko.virtualElements.firstChild(elementOrVirtualElement); } while (currentChild = nextInQueue) { // Keep a record of the next child *before* applying bindings, in case the binding removes the current child from its position nextInQueue = ko.virtualElements.nextSibling(currentChild); applyBindingsToNodeAndDescendantsInternal(bindingContext, currentChild, bindingContextsMayDifferFromDomParentElement); } } function applyBindingsToNodeAndDescendantsInternal (bindingContext, nodeVerified, bindingContextMayDifferFromDomParentElement) { var shouldBindDescendants = true; // Perf optimisation: Apply bindings only if... // (1) We need to store the binding context on this node (because it may differ from the DOM parent node's binding context) // Note that we can't store binding contexts on non-elements (e.g., text nodes), as IE doesn't allow expando properties for those // (2) It might have bindings (e.g., it has a data-bind attribute, or it's a marker for a containerless template) var isElement = (nodeVerified.nodeType === 1); if (isElement) // Workaround IE <= 8 HTML parsing weirdness ko.virtualElements.normaliseVirtualElementDomStructure(nodeVerified); var shouldApplyBindings = (isElement && bindingContextMayDifferFromDomParentElement) // Case (1) || ko.bindingProvider['instance']['nodeHasBindings'](nodeVerified); // Case (2) if (shouldApplyBindings) shouldBindDescendants = applyBindingsToNodeInternal(nodeVerified, null, bindingContext, bindingContextMayDifferFromDomParentElement)['shouldBindDescendants']; if (shouldBindDescendants && !bindingDoesNotRecurseIntoElementTypes[ko.utils.tagNameLower(nodeVerified)]) { // We're recursing automatically into (real or virtual) child nodes without changing binding contexts. So, // * For children of a *real* element, the binding context is certainly the same as on their DOM .parentNode, // hence bindingContextsMayDifferFromDomParentElement is false // * For children of a *virtual* element, we can't be sure. Evaluating .parentNode on those children may // skip over any number of intermediate virtual elements, any of which might define a custom binding context, // hence bindingContextsMayDifferFromDomParentElement is true applyBindingsToDescendantsInternal(bindingContext, nodeVerified, /* bindingContextsMayDifferFromDomParentElement: */ !isElement); } } var boundElementDomDataKey = ko.utils.domData.nextKey(); function topologicalSortBindings(bindings) { // Depth-first sort var result = [], // The list of key/handler pairs that we will return bindingsConsidered = {}, // A temporary record of which bindings are already in 'result' cyclicDependencyStack = []; // Keeps track of a depth-search so that, if there's a cycle, we know which bindings caused it ko.utils.objectForEach(bindings, function pushBinding(bindingKey) { if (!bindingsConsidered[bindingKey]) { var binding = ko['getBindingHandler'](bindingKey); if (binding) { // First add dependencies (if any) of the current binding if (binding['after']) { cyclicDependencyStack.push(bindingKey); ko.utils.arrayForEach(binding['after'], function(bindingDependencyKey) { if (bindings[bindingDependencyKey]) { if (ko.utils.arrayIndexOf(cyclicDependencyStack, bindingDependencyKey) !== -1) { throw Error("Cannot combine the following bindings, because they have a cyclic dependency: " + cyclicDependencyStack.join(", ")); } else { pushBinding(bindingDependencyKey); } } }); cyclicDependencyStack.length--; } // Next add the current binding result.push({ key: bindingKey, handler: binding }); } bindingsConsidered[bindingKey] = true; } }); return result; } function applyBindingsToNodeInternal(node, sourceBindings, bindingContext, bindingContextMayDifferFromDomParentElement) { // Prevent multiple applyBindings calls for the same node, except when a binding value is specified var alreadyBound = ko.utils.domData.get(node, boundElementDomDataKey); if (!sourceBindings) { if (alreadyBound) { throw Error("You cannot apply bindings multiple times to the same element."); } ko.utils.domData.set(node, boundElementDomDataKey, true); } // Optimization: Don't store the binding context on this node if it's definitely the same as on node.parentNode, because // we can easily recover it just by scanning up the node's ancestors in the DOM // (note: here, parent node means "real DOM parent" not "virtual parent", as there's no O(1) way to find the virtual parent) if (!alreadyBound && bindingContextMayDifferFromDomParentElement) ko.storedBindingContextForNode(node, bindingContext); // Use bindings if given, otherwise fall back on asking the bindings provider to give us some bindings var bindings; if (sourceBindings && typeof sourceBindings !== 'function') { bindings = sourceBindings; } else { var provider = ko.bindingProvider['instance'], getBindings = provider['getBindingAccessors'] || getBindingsAndMakeAccessors; // Get the binding from the provider within a computed observable so that we can update the bindings whenever // the binding context is updated or if the binding provider accesses observables. var bindingsUpdater = ko.dependentObservable( function() { bindings = sourceBindings ? sourceBindings(bindingContext, node) : getBindings.call(provider, node, bindingContext); // Register a dependency on the binding context to support obsevable view models. if (bindings && bindingContext._subscribable) bindingContext._subscribable(); return bindings; }, null, { disposeWhenNodeIsRemoved: node } ); if (!bindings || !bindingsUpdater.isActive()) bindingsUpdater = null; } var bindingHandlerThatControlsDescendantBindings; if (bindings) { // Return the value accessor for a given binding. When bindings are static (won't be updated because of a binding // context update), just return the value accessor from the binding. Otherwise, return a function that always gets // the latest binding value and registers a dependency on the binding updater. var getValueAccessor = bindingsUpdater ? function(bindingKey) { return function() { return evaluateValueAccessor(bindingsUpdater()[bindingKey]); }; } : function(bindingKey) { return bindings[bindingKey]; }; // Use of allBindings as a function is maintained for backwards compatibility, but its use is deprecated function allBindings() { return ko.utils.objectMap(bindingsUpdater ? bindingsUpdater() : bindings, evaluateValueAccessor); } // The following is the 3.x allBindings API allBindings['get'] = function(key) { return bindings[key] && evaluateValueAccessor(getValueAccessor(key)); }; allBindings['has'] = function(key) { return key in bindings; }; // First put the bindings into the right order var orderedBindings = topologicalSortBindings(bindings); // Go through the sorted bindings, calling init and update for each ko.utils.arrayForEach(orderedBindings, function(bindingKeyAndHandler) { // Note that topologicalSortBindings has already filtered out any nonexistent binding handlers, // so bindingKeyAndHandler.handler will always be nonnull. var handlerInitFn = bindingKeyAndHandler.handler["init"], handlerUpdateFn = bindingKeyAndHandler.handler["update"], bindingKey = bindingKeyAndHandler.key; if (node.nodeType === 8) { validateThatBindingIsAllowedForVirtualElements(bindingKey); } try { // Run init, ignoring any dependencies if (typeof handlerInitFn == "function") { ko.dependencyDetection.ignore(function() { var initResult = handlerInitFn(node, getValueAccessor(bindingKey), allBindings, bindingContext['$data'], bindingContext); // If this binding handler claims to control descendant bindings, make a note of this if (initResult && initResult['controlsDescendantBindings']) { if (bindingHandlerThatControlsDescendantBindings !== undefined) throw new Error("Multiple bindings (" + bindingHandlerThatControlsDescendantBindings + " and " + bindingKey + ") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element."); bindingHandlerThatControlsDescendantBindings = bindingKey; } }); } // Run update in its own computed wrapper if (typeof handlerUpdateFn == "function") { ko.dependentObservable( function() { handlerUpdateFn(node, getValueAccessor(bindingKey), allBindings, bindingContext['$data'], bindingContext); }, null, { disposeWhenNodeIsRemoved: node } ); } } catch (ex) { ex.message = "Unable to process binding \"" + bindingKey + ": " + bindings[bindingKey] + "\"\nMessage: " + ex.message; throw ex; } }); } return { 'shouldBindDescendants': bindingHandlerThatControlsDescendantBindings === undefined }; }; var storedBindingContextDomDataKey = ko.utils.domData.nextKey(); ko.storedBindingContextForNode = function (node, bindingContext) { if (arguments.length == 2) { ko.utils.domData.set(node, storedBindingContextDomDataKey, bindingContext); if (bindingContext._subscribable) bindingContext._subscribable._addNode(node); } else { return ko.utils.domData.get(node, storedBindingContextDomDataKey); } } function getBindingContext(viewModelOrBindingContext) { return viewModelOrBindingContext && (viewModelOrBindingContext instanceof ko.bindingContext) ? viewModelOrBindingContext : new ko.bindingContext(viewModelOrBindingContext); } ko.applyBindingAccessorsToNode = function (node, bindings, viewModelOrBindingContext) { if (node.nodeType === 1) // If it's an element, workaround IE <= 8 HTML parsing weirdness ko.virtualElements.normaliseVirtualElementDomStructure(node); return applyBindingsToNodeInternal(node, bindings, getBindingContext(viewModelOrBindingContext), true); }; ko.applyBindingsToNode = function (node, bindings, viewModelOrBindingContext) { var context = getBindingContext(viewModelOrBindingContext); return ko.applyBindingAccessorsToNode(node, makeBindingAccessors(bindings, context, node), context); }; ko.applyBindingsToDescendants = function(viewModelOrBindingContext, rootNode) { if (rootNode.nodeType === 1 || rootNode.nodeType === 8) applyBindingsToDescendantsInternal(getBindingContext(viewModelOrBindingContext), rootNode, true); }; ko.applyBindings = function (viewModelOrBindingContext, rootNode) { // If jQuery is loaded after Knockout, we won't initially have access to it. So save it here. if (!jQueryInstance && window['jQuery']) { jQueryInstance = window['jQuery']; } if (rootNode && (rootNode.nodeType !== 1) && (rootNode.nodeType !== 8)) throw new Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node"); rootNode = rootNode || window.document.body; // Make "rootNode" parameter optional applyBindingsToNodeAndDescendantsInternal(getBindingContext(viewModelOrBindingContext), rootNode, true); }; // Retrieving binding context from arbitrary nodes ko.contextFor = function(node) { // We can only do something meaningful for elements and comment nodes (in particular, not text nodes, as IE can't store domdata for them) switch (node.nodeType) { case 1: case 8: var context = ko.storedBindingContextForNode(node); if (context) return context; if (node.parentNode) return ko.contextFor(node.parentNode); break; } return undefined; }; ko.dataFor = function(node) { var context = ko.contextFor(node); return context ? context['$data'] : undefined; }; ko.exportSymbol('bindingHandlers', ko.bindingHandlers); ko.exportSymbol('applyBindings', ko.applyBindings); ko.exportSymbol('applyBindingsToDescendants', ko.applyBindingsToDescendants); ko.exportSymbol('applyBindingAccessorsToNode', ko.applyBindingAccessorsToNode); ko.exportSymbol('applyBindingsToNode', ko.applyBindingsToNode); ko.exportSymbol('contextFor', ko.contextFor); ko.exportSymbol('dataFor', ko.dataFor); })(); (function(undefined) { var loadingSubscribablesCache = {}, // Tracks component loads that are currently in flight loadedDefinitionsCache = {}; // Tracks component loads that have already completed ko.components = { get: function(componentName, callback) { var cachedDefinition = getObjectOwnProperty(loadedDefinitionsCache, componentName); if (cachedDefinition) { // It's already loaded and cached. Reuse the same definition object. // Note that for API consistency, even cache hits complete asynchronously by default. // You can bypass this by putting synchronous:true on your component config. if (cachedDefinition.isSynchronousComponent) { ko.dependencyDetection.ignore(function() { // See comment in loaderRegistryBehaviors.js for reasoning callback(cachedDefinition.definition); }); } else { setTimeout(function() { callback(cachedDefinition.definition); }, 0); } } else { // Join the loading process that is already underway, or start a new one. loadComponentAndNotify(componentName, callback); } }, clearCachedDefinition: function(componentName) { delete loadedDefinitionsCache[componentName]; }, _getFirstResultFromLoaders: getFirstResultFromLoaders }; function getObjectOwnProperty(obj, propName) { return obj.hasOwnProperty(propName) ? obj[propName] : undefined; } function loadComponentAndNotify(componentName, callback) { var subscribable = getObjectOwnProperty(loadingSubscribablesCache, componentName), completedAsync; if (!subscribable) { // It's not started loading yet. Start loading, and when it's done, move it to loadedDefinitionsCache. subscribable = loadingSubscribablesCache[componentName] = new ko.subscribable(); subscribable.subscribe(callback); beginLoadingComponent(componentName, function(definition, config) { var isSynchronousComponent = !!(config && config['synchronous']); loadedDefinitionsCache[componentName] = { definition: definition, isSynchronousComponent: isSynchronousComponent }; delete loadingSubscribablesCache[componentName]; // For API consistency, all loads complete asynchronously. However we want to avoid // adding an extra setTimeout if it's unnecessary (i.e., the completion is already // async) since setTimeout(..., 0) still takes about 16ms or more on most browsers. // // You can bypass the 'always synchronous' feature by putting the synchronous:true // flag on your component configuration when you register it. if (completedAsync || isSynchronousComponent) { // Note that notifySubscribers ignores any dependencies read within the callback. // See comment in loaderRegistryBehaviors.js for reasoning subscribable['notifySubscribers'](definition); } else { setTimeout(function() { subscribable['notifySubscribers'](definition); }, 0); } }); completedAsync = true; } else { subscribable.subscribe(callback); } } function beginLoadingComponent(componentName, callback) { getFirstResultFromLoaders('getConfig', [componentName], function(config) { if (config) { // We have a config, so now load its definition getFirstResultFromLoaders('loadComponent', [componentName, config], function(definition) { callback(definition, config); }); } else { // The component has no config - it's unknown to all the loaders. // Note that this is not an error (e.g., a module loading error) - that would abort the // process and this callback would not run. For this callback to run, all loaders must // have confirmed they don't know about this component. callback(null, null); } }); } function getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders) { // On the first call in the stack, start with the full set of loaders if (!candidateLoaders) { candidateLoaders = ko.components['loaders'].slice(0); // Use a copy, because we'll be mutating this array } // Try the next candidate var currentCandidateLoader = candidateLoaders.shift(); if (currentCandidateLoader) { var methodInstance = currentCandidateLoader[methodName]; if (methodInstance) { var wasAborted = false, synchronousReturnValue = methodInstance.apply(currentCandidateLoader, argsExceptCallback.concat(function(result) { if (wasAborted) { callback(null); } else if (result !== null) { // This candidate returned a value. Use it. callback(result); } else { // Try the next candidate getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders); } })); // Currently, loaders may not return anything synchronously. This leaves open the possibility // that we'll extend the API to support synchronous return values in the future. It won't be // a breaking change, because currently no loader is allowed to return anything except undefined. if (synchronousReturnValue !== undefined) { wasAborted = true; // Method to suppress exceptions will remain undocumented. This is only to keep // KO's specs running tidily, since we can observe the loading got aborted without // having exceptions cluttering up the console too. if (!currentCandidateLoader['suppressLoaderExceptions']) { throw new Error('Component loaders must supply values by invoking the callback, not by returning values synchronously.'); } } } else { // This candidate doesn't have the relevant handler. Synchronously move on to the next one. getFirstResultFromLoaders(methodName, argsExceptCallback, callback, candidateLoaders); } } else { // No candidates returned a value callback(null); } } // Reference the loaders via string name so it's possible for developers // to replace the whole array by assigning to ko.components.loaders ko.components['loaders'] = []; ko.exportSymbol('components', ko.components); ko.exportSymbol('components.get', ko.components.get); ko.exportSymbol('components.clearCachedDefinition', ko.components.clearCachedDefinition); })(); (function(undefined) { // The default loader is responsible for two things: // 1. Maintaining the default in-memory registry of component configuration objects // (i.e., the thing you're writing to when you call ko.components.register(someName, ...)) // 2. Answering requests for components by fetching configuration objects // from that default in-memory registry and resolving them into standard // component definition objects (of the form { createViewModel: ..., template: ... }) // Custom loaders may override either of these facilities, i.e., // 1. To supply configuration objects from some other source (e.g., conventions) // 2. Or, to resolve configuration objects by loading viewmodels/templates via arbitrary logic. var defaultConfigRegistry = {}; ko.components.register = function(componentName, config) { if (!config) { throw new Error('Invalid configuration for ' + componentName); } if (ko.components.isRegistered(componentName)) { throw new Error('Component ' + componentName + ' is already registered'); } defaultConfigRegistry[componentName] = config; } ko.components.isRegistered = function(componentName) { return componentName in defaultConfigRegistry; } ko.components.unregister = function(componentName) { delete defaultConfigRegistry[componentName]; ko.components.clearCachedDefinition(componentName); } ko.components.defaultLoader = { 'getConfig': function(componentName, callback) { var result = defaultConfigRegistry.hasOwnProperty(componentName) ? defaultConfigRegistry[componentName] : null; callback(result); }, 'loadComponent': function(componentName, config, callback) { var errorCallback = makeErrorCallback(componentName); possiblyGetConfigFromAmd(errorCallback, config, function(loadedConfig) { resolveConfig(componentName, errorCallback, loadedConfig, callback); }); }, 'loadTemplate': function(componentName, templateConfig, callback) { resolveTemplate(makeErrorCallback(componentName), templateConfig, callback); }, 'loadViewModel': function(componentName, viewModelConfig, callback) { resolveViewModel(makeErrorCallback(componentName), viewModelConfig, callback); } }; var createViewModelKey = 'createViewModel'; // Takes a config object of the form { template: ..., viewModel: ... }, and asynchronously convert it // into the standard component definition format: // { template: <ArrayOfDomNodes>, createViewModel: function(params, componentInfo) { ... } }. // Since both template and viewModel may need to be resolved asynchronously, both tasks are performed // in parallel, and the results joined when both are ready. We don't depend on any promises infrastructure, // so this is implemented manually below. function resolveConfig(componentName, errorCallback, config, callback) { var result = {}, makeCallBackWhenZero = 2, tryIssueCallback = function() { if (--makeCallBackWhenZero === 0) { callback(result); } }, templateConfig = config['template'], viewModelConfig = config['viewModel']; if (templateConfig) { possiblyGetConfigFromAmd(errorCallback, templateConfig, function(loadedConfig) { ko.components._getFirstResultFromLoaders('loadTemplate', [componentName, loadedConfig], function(resolvedTemplate) { result['template'] = resolvedTemplate; tryIssueCallback(); }); }); } else { tryIssueCallback(); } if (viewModelConfig) { possiblyGetConfigFromAmd(errorCallback, viewModelConfig, function(loadedConfig) { ko.components._getFirstResultFromLoaders('loadViewModel', [componentName, loadedConfig], function(resolvedViewModel) { result[createViewModelKey] = resolvedViewModel; tryIssueCallback(); }); }); } else { tryIssueCallback(); } } function resolveTemplate(errorCallback, templateConfig, callback) { if (typeof templateConfig === 'string') { // Markup - parse it callback(ko.utils.parseHtmlFragment(templateConfig)); } else if (templateConfig instanceof Array) { // Assume already an array of DOM nodes - pass through unchanged callback(templateConfig); } else if (isDocumentFragment(templateConfig)) { // Document fragment - use its child nodes callback(ko.utils.makeArray(templateConfig.childNodes)); } else if (templateConfig['element']) { var element = templateConfig['element']; if (isDomElement(element)) { // Element instance - copy its child nodes callback(cloneNodesFromTemplateSourceElement(element)); } else if (typeof element === 'string') { // Element ID - find it, then copy its child nodes var elemInstance = document.getElementById(element); if (elemInstance) { callback(cloneNodesFromTemplateSourceElement(elemInstance)); } else { errorCallback('Cannot find element with ID ' + element); } } else { errorCallback('Unknown element type: ' + element); } } else { errorCallback('Unknown template value: ' + templateConfig); } } function resolveViewModel(errorCallback, viewModelConfig, callback) { if (typeof viewModelConfig === 'function') { // Constructor - convert to standard factory function format // By design, this does *not* supply componentInfo to the constructor, as the intent is that // componentInfo contains non-viewmodel data (e.g., the component's element) that should only // be used in factory functions, not viewmodel constructors. callback(function (params /*, componentInfo */) { return new viewModelConfig(params); }); } else if (typeof viewModelConfig[createViewModelKey] === 'function') { // Already a factory function - use it as-is callback(viewModelConfig[createViewModelKey]); } else if ('instance' in viewModelConfig) { // Fixed object instance - promote to createViewModel format for API consistency var fixedInstance = viewModelConfig['instance']; callback(function (params, componentInfo) { return fixedInstance; }); } else if ('viewModel' in viewModelConfig) { // Resolved AMD module whose value is of the form { viewModel: ... } resolveViewModel(errorCallback, viewModelConfig['viewModel'], callback); } else { errorCallback('Unknown viewModel value: ' + viewModelConfig); } } function cloneNodesFromTemplateSourceElement(elemInstance) { switch (ko.utils.tagNameLower(elemInstance)) { case 'script': return ko.utils.parseHtmlFragment(elemInstance.text); case 'textarea': return ko.utils.parseHtmlFragment(elemInstance.value); case 'template': // For browsers with proper <template> element support (i.e., where the .content property // gives a document fragment), use that document fragment. if (isDocumentFragment(elemInstance.content)) { return ko.utils.cloneNodes(elemInstance.content.childNodes); } } // Regular elements such as <div>, and <template> elements on old browsers that don't really // understand <template> and just treat it as a regular container return ko.utils.cloneNodes(elemInstance.childNodes); } function isDomElement(obj) { if (window['HTMLElement']) { return obj instanceof HTMLElement; } else { return obj && obj.tagName && obj.nodeType === 1; } } function isDocumentFragment(obj) { if (window['DocumentFragment']) { return obj instanceof DocumentFragment; } else { return obj && obj.nodeType === 11; } } function possiblyGetConfigFromAmd(errorCallback, config, callback) { if (typeof config['require'] === 'string') { // The config is the value of an AMD module if (amdRequire || window['require']) { (amdRequire || window['require'])([config['require']], callback); } else { errorCallback('Uses require, but no AMD loader is present'); } } else { callback(config); } } function makeErrorCallback(componentName) { return function (message) { throw new Error('Component \'' + componentName + '\': ' + message); }; } ko.exportSymbol('components.register', ko.components.register); ko.exportSymbol('components.isRegistered', ko.components.isRegistered); ko.exportSymbol('components.unregister', ko.components.unregister); // Expose the default loader so that developers can directly ask it for configuration // or to resolve configuration ko.exportSymbol('components.defaultLoader', ko.components.defaultLoader); // By default, the default loader is the only registered component loader ko.components['loaders'].push(ko.components.defaultLoader); // Privately expose the underlying config registry for use in old-IE shim ko.components._allRegisteredComponents = defaultConfigRegistry; })(); (function (undefined) { // Overridable API for determining which component name applies to a given node. By overriding this, // you can for example map specific tagNames to components that are not preregistered. ko.components['getComponentNameForNode'] = function(node) { var tagNameLower = ko.utils.tagNameLower(node); return ko.components.isRegistered(tagNameLower) && tagNameLower; }; ko.components.addBindingsForCustomElement = function(allBindings, node, bindingContext, valueAccessors) { // Determine if it's really a custom element matching a component if (node.nodeType === 1) { var componentName = ko.components['getComponentNameForNode'](node); if (componentName) { // It does represent a component, so add a component binding for it allBindings = allBindings || {}; if (allBindings['component']) { // Avoid silently overwriting some other 'component' binding that may already be on the element throw new Error('Cannot use the "component" binding on a custom element matching a component'); } var componentBindingValue = { 'name': componentName, 'params': getComponentParamsFromCustomElement(node, bindingContext) }; allBindings['component'] = valueAccessors ? function() { return componentBindingValue; } : componentBindingValue; } } return allBindings; } var nativeBindingProviderInstance = new ko.bindingProvider(); function getComponentParamsFromCustomElement(elem, bindingContext) { var paramsAttribute = elem.getAttribute('params'); if (paramsAttribute) { var params = nativeBindingProviderInstance['parseBindingsString'](paramsAttribute, bindingContext, elem, { 'valueAccessors': true, 'bindingParams': true }), rawParamComputedValues = ko.utils.objectMap(params, function(paramValue, paramName) { return ko.computed(paramValue, null, { disposeWhenNodeIsRemoved: elem }); }), result = ko.utils.objectMap(rawParamComputedValues, function(paramValueComputed, paramName) { var paramValue = paramValueComputed.peek(); // Does the evaluation of the parameter value unwrap any observables? if (!paramValueComputed.isActive()) { // No it doesn't, so there's no need for any computed wrapper. Just pass through the supplied value directly. // Example: "someVal: firstName, age: 123" (whether or not firstName is an observable/computed) return paramValue; } else { // Yes it does. Supply a computed property that unwraps both the outer (binding expression) // level of observability, and any inner (resulting model value) level of observability. // This means the component doesn't have to worry about multiple unwrapping. If the value is a // writable observable, the computed will also be writable and pass the value on to the observable. return ko.computed({ 'read': function() { return ko.utils.unwrapObservable(paramValueComputed()); }, 'write': ko.isWriteableObservable(paramValue) && function(value) { paramValueComputed()(value); }, disposeWhenNodeIsRemoved: elem }); } }); // Give access to the raw computeds, as long as that wouldn't overwrite any custom param also called '$raw' // This is in case the developer wants to react to outer (binding) observability separately from inner // (model value) observability, or in case the model value observable has subobservables. if (!result.hasOwnProperty('$raw')) { result['$raw'] = rawParamComputedValues; } return result; } else { // For consistency, absence of a "params" attribute is treated the same as the presence of // any empty one. Otherwise component viewmodels need special code to check whether or not // 'params' or 'params.$raw' is null/undefined before reading subproperties, which is annoying. return { '$raw': {} }; } } // -------------------------------------------------------------------------------- // Compatibility code for older (pre-HTML5) IE browsers if (ko.utils.ieVersion < 9) { // Whenever you preregister a component, enable it as a custom element in the current document ko.components['register'] = (function(originalFunction) { return function(componentName) { document.createElement(componentName); // Allows IE<9 to parse markup containing the custom element return originalFunction.apply(this, arguments); } })(ko.components['register']); // Whenever you create a document fragment, enable all preregistered component names as custom elements // This is needed to make innerShiv/jQuery HTML parsing correctly handle the custom elements document.createDocumentFragment = (function(originalFunction) { return function() { var newDocFrag = originalFunction(), allComponents = ko.components._allRegisteredComponents; for (var componentName in allComponents) { if (allComponents.hasOwnProperty(componentName)) { newDocFrag.createElement(componentName); } } return newDocFrag; }; })(document.createDocumentFragment); } })();(function(undefined) { var componentLoadingOperationUniqueId = 0; ko.bindingHandlers['component'] = { 'init': function(element, valueAccessor, ignored1, ignored2, bindingContext) { var currentViewModel, currentLoadingOperationId, disposeAssociatedComponentViewModel = function () { var currentViewModelDispose = currentViewModel && currentViewModel['dispose']; if (typeof currentViewModelDispose === 'function') { currentViewModelDispose.call(currentViewModel); } // Any in-flight loading operation is no longer relevant, so make sure we ignore its completion currentLoadingOperationId = null; }, originalChildNodes = ko.utils.makeArray(ko.virtualElements.childNodes(element)); ko.utils.domNodeDisposal.addDisposeCallback(element, disposeAssociatedComponentViewModel); ko.computed(function () { var value = ko.utils.unwrapObservable(valueAccessor()), componentName, componentParams; if (typeof value === 'string') { componentName = value; } else { componentName = ko.utils.unwrapObservable(value['name']); componentParams = ko.utils.unwrapObservable(value['params']); } if (!componentName) { throw new Error('No component name specified'); } var loadingOperationId = currentLoadingOperationId = ++componentLoadingOperationUniqueId; ko.components.get(componentName, function(componentDefinition) { // If this is not the current load operation for this element, ignore it. if (currentLoadingOperationId !== loadingOperationId) { return; } // Clean up previous state disposeAssociatedComponentViewModel(); // Instantiate and bind new component. Implicitly this cleans any old DOM nodes. if (!componentDefinition) { throw new Error('Unknown component \'' + componentName + '\''); } cloneTemplateIntoElement(componentName, componentDefinition, element); var componentViewModel = createViewModel(componentDefinition, element, originalChildNodes, componentParams), childBindingContext = bindingContext['createChildContext'](componentViewModel, /* dataItemAlias */ undefined, function(ctx) { ctx['$component'] = componentViewModel; ctx['$componentTemplateNodes'] = originalChildNodes; }); currentViewModel = componentViewModel; ko.applyBindingsToDescendants(childBindingContext, element); }); }, null, { disposeWhenNodeIsRemoved: element }); return { 'controlsDescendantBindings': true }; } }; ko.virtualElements.allowedBindings['component'] = true; function cloneTemplateIntoElement(componentName, componentDefinition, element) { var template = componentDefinition['template']; if (!template) { throw new Error('Component \'' + componentName + '\' has no template'); } var clonedNodesArray = ko.utils.cloneNodes(template); ko.virtualElements.setDomNodeChildren(element, clonedNodesArray); } function createViewModel(componentDefinition, element, originalChildNodes, componentParams) { var componentViewModelFactory = componentDefinition['createViewModel']; return componentViewModelFactory ? componentViewModelFactory.call(componentDefinition, componentParams, { 'element': element, 'templateNodes': originalChildNodes }) : componentParams; // Template-only component } })(); var attrHtmlToJavascriptMap = { 'class': 'className', 'for': 'htmlFor' }; ko.bindingHandlers['attr'] = { 'update': function(element, valueAccessor, allBindings) { var value = ko.utils.unwrapObservable(valueAccessor()) || {}; ko.utils.objectForEach(value, function(attrName, attrValue) { attrValue = ko.utils.unwrapObservable(attrValue); // To cover cases like "attr: { checked:someProp }", we want to remove the attribute entirely // when someProp is a "no value"-like value (strictly null, false, or undefined) // (because the absence of the "checked" attr is how to mark an element as not checked, etc.) var toRemove = (attrValue === false) || (attrValue === null) || (attrValue === undefined); if (toRemove) element.removeAttribute(attrName); // In IE <= 7 and IE8 Quirks Mode, you have to use the Javascript property name instead of the // HTML attribute name for certain attributes. IE8 Standards Mode supports the correct behavior, // but instead of figuring out the mode, we'll just set the attribute through the Javascript // property for IE <= 8. if (ko.utils.ieVersion <= 8 && attrName in attrHtmlToJavascriptMap) { attrName = attrHtmlToJavascriptMap[attrName]; if (toRemove) element.removeAttribute(attrName); else element[attrName] = attrValue; } else if (!toRemove) { element.setAttribute(attrName, attrValue.toString()); } // Treat "name" specially - although you can think of it as an attribute, it also needs // special handling on older versions of IE (https://github.com/SteveSanderson/knockout/pull/333) // Deliberately being case-sensitive here because XHTML would regard "Name" as a different thing // entirely, and there's no strong reason to allow for such casing in HTML. if (attrName === "name") { ko.utils.setElementName(element, toRemove ? "" : attrValue.toString()); } }); } }; (function() { ko.bindingHandlers['checked'] = { 'after': ['value', 'attr'], 'init': function (element, valueAccessor, allBindings) { var checkedValue = ko.pureComputed(function() { // Treat "value" like "checkedValue" when it is included with "checked" binding if (allBindings['has']('checkedValue')) { return ko.utils.unwrapObservable(allBindings.get('checkedValue')); } else if (allBindings['has']('value')) { return ko.utils.unwrapObservable(allBindings.get('value')); } return element.value; }); function updateModel() { // This updates the model value from the view value. // It runs in response to DOM events (click) and changes in checkedValue. var isChecked = element.checked, elemValue = useCheckedValue ? checkedValue() : isChecked; // When we're first setting up this computed, don't change any model state. if (ko.computedContext.isInitial()) { return; } // We can ignore unchecked radio buttons, because some other radio // button will be getting checked, and that one can take care of updating state. if (isRadio && !isChecked) { return; } var modelValue = ko.dependencyDetection.ignore(valueAccessor); if (isValueArray) { if (oldElemValue !== elemValue) { // When we're responding to the checkedValue changing, and the element is // currently checked, replace the old elem value with the new elem value // in the model array. if (isChecked) { ko.utils.addOrRemoveItem(modelValue, elemValue, true); ko.utils.addOrRemoveItem(modelValue, oldElemValue, false); } oldElemValue = elemValue; } else { // When we're responding to the user having checked/unchecked a checkbox, // add/remove the element value to the model array. ko.utils.addOrRemoveItem(modelValue, elemValue, isChecked); } } else { ko.expressionRewriting.writeValueToProperty(modelValue, allBindings, 'checked', elemValue, true); } }; function updateView() { // This updates the view value from the model value. // It runs in response to changes in the bound (checked) value. var modelValue = ko.utils.unwrapObservable(valueAccessor()); if (isValueArray) { // When a checkbox is bound to an array, being checked represents its value being present in that array element.checked = ko.utils.arrayIndexOf(modelValue, checkedValue()) >= 0; } else if (isCheckbox) { // When a checkbox is bound to any other value (not an array), being checked represents the value being trueish element.checked = modelValue; } else { // For radio buttons, being checked means that the radio button's value corresponds to the model value element.checked = (checkedValue() === modelValue); } }; var isCheckbox = element.type == "checkbox", isRadio = element.type == "radio"; // Only bind to check boxes and radio buttons if (!isCheckbox && !isRadio) { return; } var isValueArray = isCheckbox && (ko.utils.unwrapObservable(valueAccessor()) instanceof Array), oldElemValue = isValueArray ? checkedValue() : undefined, useCheckedValue = isRadio || isValueArray; // IE 6 won't allow radio buttons to be selected unless they have a name if (isRadio && !element.name) ko.bindingHandlers['uniqueName']['init'](element, function() { return true }); // Set up two computeds to update the binding: // The first responds to changes in the checkedValue value and to element clicks ko.computed(updateModel, null, { disposeWhenNodeIsRemoved: element }); ko.utils.registerEventHandler(element, "click", updateModel); // The second responds to changes in the model value (the one associated with the checked binding) ko.computed(updateView, null, { disposeWhenNodeIsRemoved: element }); } }; ko.expressionRewriting.twoWayBindings['checked'] = true; ko.bindingHandlers['checkedValue'] = { 'update': function (element, valueAccessor) { element.value = ko.utils.unwrapObservable(valueAccessor()); } }; })();var classesWrittenByBindingKey = '__ko__cssValue'; ko.bindingHandlers['css'] = { 'update': function (element, valueAccessor) { var value = ko.utils.unwrapObservable(valueAccessor()); if (value !== null && typeof value == "object") { ko.utils.objectForEach(value, function(className, shouldHaveClass) { shouldHaveClass = ko.utils.unwrapObservable(shouldHaveClass); ko.utils.toggleDomNodeCssClass(element, className, shouldHaveClass); }); } else { value = String(value || ''); // Make sure we don't try to store or set a non-string value ko.utils.toggleDomNodeCssClass(element, element[classesWrittenByBindingKey], false); element[classesWrittenByBindingKey] = value; ko.utils.toggleDomNodeCssClass(element, value, true); } } }; ko.bindingHandlers['enable'] = { 'update': function (element, valueAccessor) { var value = ko.utils.unwrapObservable(valueAccessor()); if (value && element.disabled) element.removeAttribute("disabled"); else if ((!value) && (!element.disabled)) element.disabled = true; } }; ko.bindingHandlers['disable'] = { 'update': function (element, valueAccessor) { ko.bindingHandlers['enable']['update'](element, function() { return !ko.utils.unwrapObservable(valueAccessor()) }); } }; // For certain common events (currently just 'click'), allow a simplified data-binding syntax // e.g. click:handler instead of the usual full-length event:{click:handler} function makeEventHandlerShortcut(eventName) { ko.bindingHandlers[eventName] = { 'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) { var newValueAccessor = function () { var result = {}; result[eventName] = valueAccessor(); return result; }; return ko.bindingHandlers['event']['init'].call(this, element, newValueAccessor, allBindings, viewModel, bindingContext); } } } ko.bindingHandlers['event'] = { 'init' : function (element, valueAccessor, allBindings, viewModel, bindingContext) { var eventsToHandle = valueAccessor() || {}; ko.utils.objectForEach(eventsToHandle, function(eventName) { if (typeof eventName == "string") { ko.utils.registerEventHandler(element, eventName, function (event) { var handlerReturnValue; var handlerFunction = valueAccessor()[eventName]; if (!handlerFunction) return; try { // Take all the event args, and prefix with the viewmodel var argsForHandler = ko.utils.makeArray(arguments); viewModel = bindingContext['$data']; argsForHandler.unshift(viewModel); handlerReturnValue = handlerFunction.apply(viewModel, argsForHandler); } finally { if (handlerReturnValue !== true) { // Normally we want to prevent default action. Developer can override this be explicitly returning true. if (event.preventDefault) event.preventDefault(); else event.returnValue = false; } } var bubble = allBindings.get(eventName + 'Bubble') !== false; if (!bubble) { event.cancelBubble = true; if (event.stopPropagation) event.stopPropagation(); } }); } }); } }; // "foreach: someExpression" is equivalent to "template: { foreach: someExpression }" // "foreach: { data: someExpression, afterAdd: myfn }" is equivalent to "template: { foreach: someExpression, afterAdd: myfn }" ko.bindingHandlers['foreach'] = { makeTemplateValueAccessor: function(valueAccessor) { return function() { var modelValue = valueAccessor(), unwrappedValue = ko.utils.peekObservable(modelValue); // Unwrap without setting a dependency here // If unwrappedValue is the array, pass in the wrapped value on its own // The value will be unwrapped and tracked within the template binding // (See https://github.com/SteveSanderson/knockout/issues/523) if ((!unwrappedValue) || typeof unwrappedValue.length == "number") return { 'foreach': modelValue, 'templateEngine': ko.nativeTemplateEngine.instance }; // If unwrappedValue.data is the array, preserve all relevant options and unwrap again value so we get updates ko.utils.unwrapObservable(modelValue); return { 'foreach': unwrappedValue['data'], 'as': unwrappedValue['as'], 'includeDestroyed': unwrappedValue['includeDestroyed'], 'afterAdd': unwrappedValue['afterAdd'], 'beforeRemove': unwrappedValue['beforeRemove'], 'afterRender': unwrappedValue['afterRender'], 'beforeMove': unwrappedValue['beforeMove'], 'afterMove': unwrappedValue['afterMove'], 'templateEngine': ko.nativeTemplateEngine.instance }; }; }, 'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) { return ko.bindingHandlers['template']['init'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor)); }, 'update': function(element, valueAccessor, allBindings, viewModel, bindingContext) { return ko.bindingHandlers['template']['update'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor), allBindings, viewModel, bindingContext); } }; ko.expressionRewriting.bindingRewriteValidators['foreach'] = false; // Can't rewrite control flow bindings ko.virtualElements.allowedBindings['foreach'] = true; var hasfocusUpdatingProperty = '__ko_hasfocusUpdating'; var hasfocusLastValue = '__ko_hasfocusLastValue'; ko.bindingHandlers['hasfocus'] = { 'init': function(element, valueAccessor, allBindings) { var handleElementFocusChange = function(isFocused) { // Where possible, ignore which event was raised and determine focus state using activeElement, // as this avoids phantom focus/blur events raised when changing tabs in modern browsers. // However, not all KO-targeted browsers (Firefox 2) support activeElement. For those browsers, // prevent a loss of focus when changing tabs/windows by setting a flag that prevents hasfocus // from calling 'blur()' on the element when it loses focus. // Discussion at https://github.com/SteveSanderson/knockout/pull/352 element[hasfocusUpdatingProperty] = true; var ownerDoc = element.ownerDocument; if ("activeElement" in ownerDoc) { var active; try { active = ownerDoc.activeElement; } catch(e) { // IE9 throws if you access activeElement during page load (see issue #703) active = ownerDoc.body; } isFocused = (active === element); } var modelValue = valueAccessor(); ko.expressionRewriting.writeValueToProperty(modelValue, allBindings, 'hasfocus', isFocused, true); //cache the latest value, so we can avoid unnecessarily calling focus/blur in the update function element[hasfocusLastValue] = isFocused; element[hasfocusUpdatingProperty] = false; }; var handleElementFocusIn = handleElementFocusChange.bind(null, true); var handleElementFocusOut = handleElementFocusChange.bind(null, false); ko.utils.registerEventHandler(element, "focus", handleElementFocusIn); ko.utils.registerEventHandler(element, "focusin", handleElementFocusIn); // For IE ko.utils.registerEventHandler(element, "blur", handleElementFocusOut); ko.utils.registerEventHandler(element, "focusout", handleElementFocusOut); // For IE }, 'update': function(element, valueAccessor) { var value = !!ko.utils.unwrapObservable(valueAccessor()); //force boolean to compare with last value if (!element[hasfocusUpdatingProperty] && element[hasfocusLastValue] !== value) { value ? element.focus() : element.blur(); ko.dependencyDetection.ignore(ko.utils.triggerEvent, null, [element, value ? "focusin" : "focusout"]); // For IE, which doesn't reliably fire "focus" or "blur" events synchronously } } }; ko.expressionRewriting.twoWayBindings['hasfocus'] = true; ko.bindingHandlers['hasFocus'] = ko.bindingHandlers['hasfocus']; // Make "hasFocus" an alias ko.expressionRewriting.twoWayBindings['hasFocus'] = true; ko.bindingHandlers['html'] = { 'init': function() { // Prevent binding on the dynamically-injected HTML (as developers are unlikely to expect that, and it has security implications) return { 'controlsDescendantBindings': true }; }, 'update': function (element, valueAccessor) { // setHtml will unwrap the value if needed ko.utils.setHtml(element, valueAccessor()); } }; // Makes a binding like with or if function makeWithIfBinding(bindingKey, isWith, isNot, makeContextCallback) { ko.bindingHandlers[bindingKey] = { 'init': function(element, valueAccessor, allBindings, viewModel, bindingContext) { var didDisplayOnLastUpdate, savedNodes; ko.computed(function() { var dataValue = ko.utils.unwrapObservable(valueAccessor()), shouldDisplay = !isNot !== !dataValue, // equivalent to isNot ? !dataValue : !!dataValue isFirstRender = !savedNodes, needsRefresh = isFirstRender || isWith || (shouldDisplay !== didDisplayOnLastUpdate); if (needsRefresh) { // Save a copy of the inner nodes on the initial update, but only if we have dependencies. if (isFirstRender && ko.computedContext.getDependenciesCount()) { savedNodes = ko.utils.cloneNodes(ko.virtualElements.childNodes(element), true /* shouldCleanNodes */); } if (shouldDisplay) { if (!isFirstRender) { ko.virtualElements.setDomNodeChildren(element, ko.utils.cloneNodes(savedNodes)); } ko.applyBindingsToDescendants(makeContextCallback ? makeContextCallback(bindingContext, dataValue) : bindingContext, element); } else { ko.virtualElements.emptyNode(element); } didDisplayOnLastUpdate = shouldDisplay; } }, null, { disposeWhenNodeIsRemoved: element }); return { 'controlsDescendantBindings': true }; } }; ko.expressionRewriting.bindingRewriteValidators[bindingKey] = false; // Can't rewrite control flow bindings ko.virtualElements.allowedBindings[bindingKey] = true; } // Construct the actual binding handlers makeWithIfBinding('if'); makeWithIfBinding('ifnot', false /* isWith */, true /* isNot */); makeWithIfBinding('with', true /* isWith */, false /* isNot */, function(bindingContext, dataValue) { return bindingContext['createChildContext'](dataValue); } ); var captionPlaceholder = {}; ko.bindingHandlers['options'] = { 'init': function(element) { if (ko.utils.tagNameLower(element) !== "select") throw new Error("options binding applies only to SELECT elements"); // Remove all existing <option>s. while (element.length > 0) { element.remove(0); } // Ensures that the binding processor doesn't try to bind the options return { 'controlsDescendantBindings': true }; }, 'update': function (element, valueAccessor, allBindings) { function selectedOptions() { return ko.utils.arrayFilter(element.options, function (node) { return node.selected; }); } var selectWasPreviouslyEmpty = element.length == 0, multiple = element.multiple, previousScrollTop = (!selectWasPreviouslyEmpty && multiple) ? element.scrollTop : null, unwrappedArray = ko.utils.unwrapObservable(valueAccessor()), valueAllowUnset = allBindings.get('valueAllowUnset') && allBindings['has']('value'), includeDestroyed = allBindings.get('optionsIncludeDestroyed'), arrayToDomNodeChildrenOptions = {}, captionValue, filteredArray, previousSelectedValues = []; if (!valueAllowUnset) { if (multiple) { previousSelectedValues = ko.utils.arrayMap(selectedOptions(), ko.selectExtensions.readValue); } else if (element.selectedIndex >= 0) { previousSelectedValues.push(ko.selectExtensions.readValue(element.options[element.selectedIndex])); } } if (unwrappedArray) { if (typeof unwrappedArray.length == "undefined") // Coerce single value into array unwrappedArray = [unwrappedArray]; // Filter out any entries marked as destroyed filteredArray = ko.utils.arrayFilter(unwrappedArray, function(item) { return includeDestroyed || item === undefined || item === null || !ko.utils.unwrapObservable(item['_destroy']); }); // If caption is included, add it to the array if (allBindings['has']('optionsCaption')) { captionValue = ko.utils.unwrapObservable(allBindings.get('optionsCaption')); // If caption value is null or undefined, don't show a caption if (captionValue !== null && captionValue !== undefined) { filteredArray.unshift(captionPlaceholder); } } } else { // If a falsy value is provided (e.g. null), we'll simply empty the select element } function applyToObject(object, predicate, defaultValue) { var predicateType = typeof predicate; if (predicateType == "function") // Given a function; run it against the data value return predicate(object); else if (predicateType == "string") // Given a string; treat it as a property name on the data value return object[predicate]; else // Given no optionsText arg; use the data value itself return defaultValue; } // The following functions can run at two different times: // The first is when the whole array is being updated directly from this binding handler. // The second is when an observable value for a specific array entry is updated. // oldOptions will be empty in the first case, but will be filled with the previously generated option in the second. var itemUpdate = false; function optionForArrayItem(arrayEntry, index, oldOptions) { if (oldOptions.length) { previousSelectedValues = !valueAllowUnset && oldOptions[0].selected ? [ ko.selectExtensions.readValue(oldOptions[0]) ] : []; itemUpdate = true; } var option = element.ownerDocument.createElement("option"); if (arrayEntry === captionPlaceholder) { ko.utils.setTextContent(option, allBindings.get('optionsCaption')); ko.selectExtensions.writeValue(option, undefined); } else { // Apply a value to the option element var optionValue = applyToObject(arrayEntry, allBindings.get('optionsValue'), arrayEntry); ko.selectExtensions.writeValue(option, ko.utils.unwrapObservable(optionValue)); // Apply some text to the option element var optionText = applyToObject(arrayEntry, allBindings.get('optionsText'), optionValue); ko.utils.setTextContent(option, optionText); } return [option]; } // By using a beforeRemove callback, we delay the removal until after new items are added. This fixes a selection // problem in IE<=8 and Firefox. See https://github.com/knockout/knockout/issues/1208 arrayToDomNodeChildrenOptions['beforeRemove'] = function (option) { element.removeChild(option); }; function setSelectionCallback(arrayEntry, newOptions) { if (itemUpdate && valueAllowUnset) { // The model value is authoritative, so make sure its value is the one selected // There is no need to use dependencyDetection.ignore since setDomNodeChildrenFromArrayMapping does so already. ko.selectExtensions.writeValue(element, ko.utils.unwrapObservable(allBindings.get('value')), true /* allowUnset */); } else if (previousSelectedValues.length) { // IE6 doesn't like us to assign selection to OPTION nodes before they're added to the document. // That's why we first added them without selection. Now it's time to set the selection. var isSelected = ko.utils.arrayIndexOf(previousSelectedValues, ko.selectExtensions.readValue(newOptions[0])) >= 0; ko.utils.setOptionNodeSelectionState(newOptions[0], isSelected); // If this option was changed from being selected during a single-item update, notify the change if (itemUpdate && !isSelected) { ko.dependencyDetection.ignore(ko.utils.triggerEvent, null, [element, "change"]); } } } var callback = setSelectionCallback; if (allBindings['has']('optionsAfterRender') && typeof allBindings.get('optionsAfterRender') == "function") { callback = function(arrayEntry, newOptions) { setSelectionCallback(arrayEntry, newOptions); ko.dependencyDetection.ignore(allBindings.get('optionsAfterRender'), null, [newOptions[0], arrayEntry !== captionPlaceholder ? arrayEntry : undefined]); } } ko.utils.setDomNodeChildrenFromArrayMapping(element, filteredArray, optionForArrayItem, arrayToDomNodeChildrenOptions, callback); ko.dependencyDetection.ignore(function () { if (valueAllowUnset) { // The model value is authoritative, so make sure its value is the one selected ko.selectExtensions.writeValue(element, ko.utils.unwrapObservable(allBindings.get('value')), true /* allowUnset */); } else { // Determine if the selection has changed as a result of updating the options list var selectionChanged; if (multiple) { // For a multiple-select box, compare the new selection count to the previous one // But if nothing was selected before, the selection can't have changed selectionChanged = previousSelectedValues.length && selectedOptions().length < previousSelectedValues.length; } else { // For a single-select box, compare the current value to the previous value // But if nothing was selected before or nothing is selected now, just look for a change in selection selectionChanged = (previousSelectedValues.length && element.selectedIndex >= 0) ? (ko.selectExtensions.readValue(element.options[element.selectedIndex]) !== previousSelectedValues[0]) : (previousSelectedValues.length || element.selectedIndex >= 0); } // Ensure consistency between model value and selected option. // If the dropdown was changed so that selection is no longer the same, // notify the value or selectedOptions binding. if (selectionChanged) { ko.utils.triggerEvent(element, "change"); } } }); // Workaround for IE bug ko.utils.ensureSelectElementIsRenderedCorrectly(element); if (previousScrollTop && Math.abs(previousScrollTop - element.scrollTop) > 20) element.scrollTop = previousScrollTop; } }; ko.bindingHandlers['options'].optionValueDomDataKey = ko.utils.domData.nextKey(); ko.bindingHandlers['selectedOptions'] = { 'after': ['options', 'foreach'], 'init': function (element, valueAccessor, allBindings) { ko.utils.registerEventHandler(element, "change", function () { var value = valueAccessor(), valueToWrite = []; ko.utils.arrayForEach(element.getElementsByTagName("option"), function(node) { if (node.selected) valueToWrite.push(ko.selectExtensions.readValue(node)); }); ko.expressionRewriting.writeValueToProperty(value, allBindings, 'selectedOptions', valueToWrite); }); }, 'update': function (element, valueAccessor) { if (ko.utils.tagNameLower(element) != "select") throw new Error("values binding applies only to SELECT elements"); var newValue = ko.utils.unwrapObservable(valueAccessor()); if (newValue && typeof newValue.length == "number") { ko.utils.arrayForEach(element.getElementsByTagName("option"), function(node) { var isSelected = ko.utils.arrayIndexOf(newValue, ko.selectExtensions.readValue(node)) >= 0; ko.utils.setOptionNodeSelectionState(node, isSelected); }); } } }; ko.expressionRewriting.twoWayBindings['selectedOptions'] = true; ko.bindingHandlers['style'] = { 'update': function (element, valueAccessor) { var value = ko.utils.unwrapObservable(valueAccessor() || {}); ko.utils.objectForEach(value, function(styleName, styleValue) { styleValue = ko.utils.unwrapObservable(styleValue); if (styleValue === null || styleValue === undefined || styleValue === false) { // Empty string removes the value, whereas null/undefined have no effect styleValue = ""; } element.style[styleName] = styleValue; }); } }; ko.bindingHandlers['submit'] = { 'init': function (element, valueAccessor, allBindings, viewModel, bindingContext) { if (typeof valueAccessor() != "function") throw new Error("The value for a submit binding must be a function"); ko.utils.registerEventHandler(element, "submit", function (event) { var handlerReturnValue; var value = valueAccessor(); try { handlerReturnValue = value.call(bindingContext['$data'], element); } finally { if (handlerReturnValue !== true) { // Normally we want to prevent default action. Developer can override this be explicitly returning true. if (event.preventDefault) event.preventDefault(); else event.returnValue = false; } } }); } }; ko.bindingHandlers['text'] = { 'init': function() { // Prevent binding on the dynamically-injected text node (as developers are unlikely to expect that, and it has security implications). // It should also make things faster, as we no longer have to consider whether the text node might be bindable. return { 'controlsDescendantBindings': true }; }, 'update': function (element, valueAccessor) { ko.utils.setTextContent(element, valueAccessor()); } }; ko.virtualElements.allowedBindings['text'] = true; (function () { if (window && window.navigator) { var parseVersion = function (matches) { if (matches) { return parseFloat(matches[1]); } }; // Detect various browser versions because some old versions don't fully support the 'input' event var operaVersion = window.opera && window.opera.version && parseInt(window.opera.version()), userAgent = window.navigator.userAgent, safariVersion = parseVersion(userAgent.match(/^(?:(?!chrome).)*version\/([^ ]*) safari/i)), firefoxVersion = parseVersion(userAgent.match(/Firefox\/([^ ]*)/)); } // IE 8 and 9 have bugs that prevent the normal events from firing when the value changes. // But it does fire the 'selectionchange' event on many of those, presumably because the // cursor is moving and that counts as the selection changing. The 'selectionchange' event is // fired at the document level only and doesn't directly indicate which element changed. We // set up just one event handler for the document and use 'activeElement' to determine which // element was changed. if (ko.utils.ieVersion < 10) { var selectionChangeRegisteredName = ko.utils.domData.nextKey(), selectionChangeHandlerName = ko.utils.domData.nextKey(); var selectionChangeHandler = function(event) { var target = this.activeElement, handler = target && ko.utils.domData.get(target, selectionChangeHandlerName); if (handler) { handler(event); } }; var registerForSelectionChangeEvent = function (element, handler) { var ownerDoc = element.ownerDocument; if (!ko.utils.domData.get(ownerDoc, selectionChangeRegisteredName)) { ko.utils.domData.set(ownerDoc, selectionChangeRegisteredName, true); ko.utils.registerEventHandler(ownerDoc, 'selectionchange', selectionChangeHandler); } ko.utils.domData.set(element, selectionChangeHandlerName, handler); }; } ko.bindingHandlers['textInput'] = { 'init': function (element, valueAccessor, allBindings) { var previousElementValue = element.value, timeoutHandle, elementValueBeforeEvent; var updateModel = function (event) { clearTimeout(timeoutHandle); elementValueBeforeEvent = timeoutHandle = undefined; var elementValue = element.value; if (previousElementValue !== elementValue) { // Provide a way for tests to know exactly which event was processed if (DEBUG && event) element['_ko_textInputProcessedEvent'] = event.type; previousElementValue = elementValue; ko.expressionRewriting.writeValueToProperty(valueAccessor(), allBindings, 'textInput', elementValue); } }; var deferUpdateModel = function (event) { if (!timeoutHandle) { // The elementValueBeforeEvent variable is set *only* during the brief gap between an // event firing and the updateModel function running. This allows us to ignore model // updates that are from the previous state of the element, usually due to techniques // such as rateLimit. Such updates, if not ignored, can cause keystrokes to be lost. elementValueBeforeEvent = element.value; var handler = DEBUG ? updateModel.bind(element, {type: event.type}) : updateModel; timeoutHandle = setTimeout(handler, 4); } }; var updateView = function () { var modelValue = ko.utils.unwrapObservable(valueAccessor()); if (modelValue === null || modelValue === undefined) { modelValue = ''; } if (elementValueBeforeEvent !== undefined && modelValue === elementValueBeforeEvent) { setTimeout(updateView, 4); return; } // Update the element only if the element and model are different. On some browsers, updating the value // will move the cursor to the end of the input, which would be bad while the user is typing. if (element.value !== modelValue) { previousElementValue = modelValue; // Make sure we ignore events (propertychange) that result from updating the value element.value = modelValue; } }; var onEvent = function (event, handler) { ko.utils.registerEventHandler(element, event, handler); }; if (DEBUG && ko.bindingHandlers['textInput']['_forceUpdateOn']) { // Provide a way for tests to specify exactly which events are bound ko.utils.arrayForEach(ko.bindingHandlers['textInput']['_forceUpdateOn'], function(eventName) { if (eventName.slice(0,5) == 'after') { onEvent(eventName.slice(5), deferUpdateModel); } else { onEvent(eventName, updateModel); } }); } else { if (ko.utils.ieVersion < 10) { // Internet Explorer <= 8 doesn't support the 'input' event, but does include 'propertychange' that fires whenever // any property of an element changes. Unlike 'input', it also fires if a property is changed from JavaScript code, // but that's an acceptable compromise for this binding. IE 9 does support 'input', but since it doesn't fire it // when using autocomplete, we'll use 'propertychange' for it also. onEvent('propertychange', function(event) { if (event.propertyName === 'value') { updateModel(event); } }); if (ko.utils.ieVersion == 8) { // IE 8 has a bug where it fails to fire 'propertychange' on the first update following a value change from // JavaScript code. It also doesn't fire if you clear the entire value. To fix this, we bind to the following // events too. onEvent('keyup', updateModel); // A single keystoke onEvent('keydown', updateModel); // The first character when a key is held down } if (ko.utils.ieVersion >= 8) { // Internet Explorer 9 doesn't fire the 'input' event when deleting text, including using // the backspace, delete, or ctrl-x keys, clicking the 'x' to clear the input, dragging text // out of the field, and cutting or deleting text using the context menu. 'selectionchange' // can detect all of those except dragging text out of the field, for which we use 'dragend'. // These are also needed in IE8 because of the bug described above. registerForSelectionChangeEvent(element, updateModel); // 'selectionchange' covers cut, paste, drop, delete, etc. onEvent('dragend', deferUpdateModel); } } else { // All other supported browsers support the 'input' event, which fires whenever the content of the element is changed // through the user interface. onEvent('input', updateModel); if (safariVersion < 5 && ko.utils.tagNameLower(element) === "textarea") { // Safari <5 doesn't fire the 'input' event for <textarea> elements (it does fire 'textInput' // but only when typing). So we'll just catch as much as we can with keydown, cut, and paste. onEvent('keydown', deferUpdateModel); onEvent('paste', deferUpdateModel); onEvent('cut', deferUpdateModel); } else if (operaVersion < 11) { // Opera 10 doesn't always fire the 'input' event for cut, paste, undo & drop operations. // We can try to catch some of those using 'keydown'. onEvent('keydown', deferUpdateModel); } else if (firefoxVersion < 4.0) { // Firefox <= 3.6 doesn't fire the 'input' event when text is filled in through autocomplete onEvent('DOMAutoComplete', updateModel); // Firefox <=3.5 doesn't fire the 'input' event when text is dropped into the input. onEvent('dragdrop', updateModel); // <3.5 onEvent('drop', updateModel); // 3.5 } } } // Bind to the change event so that we can catch programmatic updates of the value that fire this event. onEvent('change', updateModel); ko.computed(updateView, null, { disposeWhenNodeIsRemoved: element }); } }; ko.expressionRewriting.twoWayBindings['textInput'] = true; // textinput is an alias for textInput ko.bindingHandlers['textinput'] = { // preprocess is the only way to set up a full alias 'preprocess': function (value, name, addBinding) { addBinding('textInput', value); } }; })();ko.bindingHandlers['uniqueName'] = { 'init': function (element, valueAccessor) { if (valueAccessor()) { var name = "ko_unique_" + (++ko.bindingHandlers['uniqueName'].currentIndex); ko.utils.setElementName(element, name); } } }; ko.bindingHandlers['uniqueName'].currentIndex = 0; ko.bindingHandlers['value'] = { 'after': ['options', 'foreach'], 'init': function (element, valueAccessor, allBindings) { // If the value binding is placed on a radio/checkbox, then just pass through to checkedValue and quit if (element.tagName.toLowerCase() == "input" && (element.type == "checkbox" || element.type == "radio")) { ko.applyBindingAccessorsToNode(element, { 'checkedValue': valueAccessor }); return; } // Always catch "change" event; possibly other events too if asked var eventsToCatch = ["change"]; var requestedEventsToCatch = allBindings.get("valueUpdate"); var propertyChangedFired = false; var elementValueBeforeEvent = null; if (requestedEventsToCatch) { if (typeof requestedEventsToCatch == "string") // Allow both individual event names, and arrays of event names requestedEventsToCatch = [requestedEventsToCatch]; ko.utils.arrayPushAll(eventsToCatch, requestedEventsToCatch); eventsToCatch = ko.utils.arrayGetDistinctValues(eventsToCatch); } var valueUpdateHandler = function() { elementValueBeforeEvent = null; propertyChangedFired = false; var modelValue = valueAccessor(); var elementValue = ko.selectExtensions.readValue(element); ko.expressionRewriting.writeValueToProperty(modelValue, allBindings, 'value', elementValue); } // Workaround for https://github.com/SteveSanderson/knockout/issues/122 // IE doesn't fire "change" events on textboxes if the user selects a value from its autocomplete list var ieAutoCompleteHackNeeded = ko.utils.ieVersion && element.tagName.toLowerCase() == "input" && element.type == "text" && element.autocomplete != "off" && (!element.form || element.form.autocomplete != "off"); if (ieAutoCompleteHackNeeded && ko.utils.arrayIndexOf(eventsToCatch, "propertychange") == -1) { ko.utils.registerEventHandler(element, "propertychange", function () { propertyChangedFired = true }); ko.utils.registerEventHandler(element, "focus", function () { propertyChangedFired = false }); ko.utils.registerEventHandler(element, "blur", function() { if (propertyChangedFired) { valueUpdateHandler(); } }); } ko.utils.arrayForEach(eventsToCatch, function(eventName) { // The syntax "after<eventname>" means "run the handler asynchronously after the event" // This is useful, for example, to catch "keydown" events after the browser has updated the control // (otherwise, ko.selectExtensions.readValue(this) will receive the control's value *before* the key event) var handler = valueUpdateHandler; if (ko.utils.stringStartsWith(eventName, "after")) { handler = function() { // The elementValueBeforeEvent variable is non-null *only* during the brief gap between // a keyX event firing and the valueUpdateHandler running, which is scheduled to happen // at the earliest asynchronous opportunity. We store this temporary information so that // if, between keyX and valueUpdateHandler, the underlying model value changes separately, // we can overwrite that model value change with the value the user just typed. Otherwise, // techniques like rateLimit can trigger model changes at critical moments that will // override the user's inputs, causing keystrokes to be lost. elementValueBeforeEvent = ko.selectExtensions.readValue(element); setTimeout(valueUpdateHandler, 0); }; eventName = eventName.substring("after".length); } ko.utils.registerEventHandler(element, eventName, handler); }); var updateFromModel = function () { var newValue = ko.utils.unwrapObservable(valueAccessor()); var elementValue = ko.selectExtensions.readValue(element); if (elementValueBeforeEvent !== null && newValue === elementValueBeforeEvent) { setTimeout(updateFromModel, 0); return; } var valueHasChanged = (newValue !== elementValue); if (valueHasChanged) { if (ko.utils.tagNameLower(element) === "select") { var allowUnset = allBindings.get('valueAllowUnset'); var applyValueAction = function () { ko.selectExtensions.writeValue(element, newValue, allowUnset); }; applyValueAction(); if (!allowUnset && newValue !== ko.selectExtensions.readValue(element)) { // If you try to set a model value that can't be represented in an already-populated dropdown, reject that change, // because you're not allowed to have a model value that disagrees with a visible UI selection. ko.dependencyDetection.ignore(ko.utils.triggerEvent, null, [element, "change"]); } else { // Workaround for IE6 bug: It won't reliably apply values to SELECT nodes during the same execution thread // right after you've changed the set of OPTION nodes on it. So for that node type, we'll schedule a second thread // to apply the value as well. setTimeout(applyValueAction, 0); } } else { ko.selectExtensions.writeValue(element, newValue); } } }; ko.computed(updateFromModel, null, { disposeWhenNodeIsRemoved: element }); }, 'update': function() {} // Keep for backwards compatibility with code that may have wrapped value binding }; ko.expressionRewriting.twoWayBindings['value'] = true; ko.bindingHandlers['visible'] = { 'update': function (element, valueAccessor) { var value = ko.utils.unwrapObservable(valueAccessor()); var isCurrentlyVisible = !(element.style.display == "none"); if (value && !isCurrentlyVisible) element.style.display = ""; else if ((!value) && isCurrentlyVisible) element.style.display = "none"; } }; // 'click' is just a shorthand for the usual full-length event:{click:handler} makeEventHandlerShortcut('click'); // If you want to make a custom template engine, // // [1] Inherit from this class (like ko.nativeTemplateEngine does) // [2] Override 'renderTemplateSource', supplying a function with this signature: // // function (templateSource, bindingContext, options) { // // - templateSource.text() is the text of the template you should render // // - bindingContext.$data is the data you should pass into the template // // - you might also want to make bindingContext.$parent, bindingContext.$parents, // // and bindingContext.$root available in the template too // // - options gives you access to any other properties set on "data-bind: { template: options }" // // - templateDocument is the document object of the template // // // // Return value: an array of DOM nodes // } // // [3] Override 'createJavaScriptEvaluatorBlock', supplying a function with this signature: // // function (script) { // // Return value: Whatever syntax means "Evaluate the JavaScript statement 'script' and output the result" // // For example, the jquery.tmpl template engine converts 'someScript' to '${ someScript }' // } // // This is only necessary if you want to allow data-bind attributes to reference arbitrary template variables. // If you don't want to allow that, you can set the property 'allowTemplateRewriting' to false (like ko.nativeTemplateEngine does) // and then you don't need to override 'createJavaScriptEvaluatorBlock'. ko.templateEngine = function () { }; ko.templateEngine.prototype['renderTemplateSource'] = function (templateSource, bindingContext, options, templateDocument) { throw new Error("Override renderTemplateSource"); }; ko.templateEngine.prototype['createJavaScriptEvaluatorBlock'] = function (script) { throw new Error("Override createJavaScriptEvaluatorBlock"); }; ko.templateEngine.prototype['makeTemplateSource'] = function(template, templateDocument) { // Named template if (typeof template == "string") { templateDocument = templateDocument || document; var elem = templateDocument.getElementById(template); if (!elem) throw new Error("Cannot find template with ID " + template); return new ko.templateSources.domElement(elem); } else if ((template.nodeType == 1) || (template.nodeType == 8)) { // Anonymous template return new ko.templateSources.anonymousTemplate(template); } else throw new Error("Unknown template type: " + template); }; ko.templateEngine.prototype['renderTemplate'] = function (template, bindingContext, options, templateDocument) { var templateSource = this['makeTemplateSource'](template, templateDocument); return this['renderTemplateSource'](templateSource, bindingContext, options, templateDocument); }; ko.templateEngine.prototype['isTemplateRewritten'] = function (template, templateDocument) { // Skip rewriting if requested if (this['allowTemplateRewriting'] === false) return true; return this['makeTemplateSource'](template, templateDocument)['data']("isRewritten"); }; ko.templateEngine.prototype['rewriteTemplate'] = function (template, rewriterCallback, templateDocument) { var templateSource = this['makeTemplateSource'](template, templateDocument); var rewritten = rewriterCallback(templateSource['text']()); templateSource['text'](rewritten); templateSource['data']("isRewritten", true); }; ko.exportSymbol('templateEngine', ko.templateEngine); ko.templateRewriting = (function () { var memoizeDataBindingAttributeSyntaxRegex = /(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi; var memoizeVirtualContainerBindingSyntaxRegex = /<!--\s*ko\b\s*([\s\S]*?)\s*-->/g; function validateDataBindValuesForRewriting(keyValueArray) { var allValidators = ko.expressionRewriting.bindingRewriteValidators; for (var i = 0; i < keyValueArray.length; i++) { var key = keyValueArray[i]['key']; if (allValidators.hasOwnProperty(key)) { var validator = allValidators[key]; if (typeof validator === "function") { var possibleErrorMessage = validator(keyValueArray[i]['value']); if (possibleErrorMessage) throw new Error(possibleErrorMessage); } else if (!validator) { throw new Error("This template engine does not support the '" + key + "' binding within its templates"); } } } } function constructMemoizedTagReplacement(dataBindAttributeValue, tagToRetain, nodeName, templateEngine) { var dataBindKeyValueArray = ko.expressionRewriting.parseObjectLiteral(dataBindAttributeValue); validateDataBindValuesForRewriting(dataBindKeyValueArray); var rewrittenDataBindAttributeValue = ko.expressionRewriting.preProcessBindings(dataBindKeyValueArray, {'valueAccessors':true}); // For no obvious reason, Opera fails to evaluate rewrittenDataBindAttributeValue unless it's wrapped in an additional // anonymous function, even though Opera's built-in debugger can evaluate it anyway. No other browser requires this // extra indirection. var applyBindingsToNextSiblingScript = "ko.__tr_ambtns(function($context,$element){return(function(){return{ " + rewrittenDataBindAttributeValue + " } })()},'" + nodeName.toLowerCase() + "')"; return templateEngine['createJavaScriptEvaluatorBlock'](applyBindingsToNextSiblingScript) + tagToRetain; } return { ensureTemplateIsRewritten: function (template, templateEngine, templateDocument) { if (!templateEngine['isTemplateRewritten'](template, templateDocument)) templateEngine['rewriteTemplate'](template, function (htmlString) { return ko.templateRewriting.memoizeBindingAttributeSyntax(htmlString, templateEngine); }, templateDocument); }, memoizeBindingAttributeSyntax: function (htmlString, templateEngine) { return htmlString.replace(memoizeDataBindingAttributeSyntaxRegex, function () { return constructMemoizedTagReplacement(/* dataBindAttributeValue: */ arguments[4], /* tagToRetain: */ arguments[1], /* nodeName: */ arguments[2], templateEngine); }).replace(memoizeVirtualContainerBindingSyntaxRegex, function() { return constructMemoizedTagReplacement(/* dataBindAttributeValue: */ arguments[1], /* tagToRetain: */ "<!-- ko -->", /* nodeName: */ "#comment", templateEngine); }); }, applyMemoizedBindingsToNextSibling: function (bindings, nodeName) { return ko.memoization.memoize(function (domNode, bindingContext) { var nodeToBind = domNode.nextSibling; if (nodeToBind && nodeToBind.nodeName.toLowerCase() === nodeName) { ko.applyBindingAccessorsToNode(nodeToBind, bindings, bindingContext); } }); } } })(); // Exported only because it has to be referenced by string lookup from within rewritten template ko.exportSymbol('__tr_ambtns', ko.templateRewriting.applyMemoizedBindingsToNextSibling); (function() { // A template source represents a read/write way of accessing a template. This is to eliminate the need for template loading/saving // logic to be duplicated in every template engine (and means they can all work with anonymous templates, etc.) // // Two are provided by default: // 1. ko.templateSources.domElement - reads/writes the text content of an arbitrary DOM element // 2. ko.templateSources.anonymousElement - uses ko.utils.domData to read/write text *associated* with the DOM element, but // without reading/writing the actual element text content, since it will be overwritten // with the rendered template output. // You can implement your own template source if you want to fetch/store templates somewhere other than in DOM elements. // Template sources need to have the following functions: // text() - returns the template text from your storage location // text(value) - writes the supplied template text to your storage location // data(key) - reads values stored using data(key, value) - see below // data(key, value) - associates "value" with this template and the key "key". Is used to store information like "isRewritten". // // Optionally, template sources can also have the following functions: // nodes() - returns a DOM element containing the nodes of this template, where available // nodes(value) - writes the given DOM element to your storage location // If a DOM element is available for a given template source, template engines are encouraged to use it in preference over text() // for improved speed. However, all templateSources must supply text() even if they don't supply nodes(). // // Once you've implemented a templateSource, make your template engine use it by subclassing whatever template engine you were // using and overriding "makeTemplateSource" to return an instance of your custom template source. ko.templateSources = {}; // ---- ko.templateSources.domElement ----- ko.templateSources.domElement = function(element) { this.domElement = element; } ko.templateSources.domElement.prototype['text'] = function(/* valueToWrite */) { var tagNameLower = ko.utils.tagNameLower(this.domElement), elemContentsProperty = tagNameLower === "script" ? "text" : tagNameLower === "textarea" ? "value" : "innerHTML"; if (arguments.length == 0) { return this.domElement[elemContentsProperty]; } else { var valueToWrite = arguments[0]; if (elemContentsProperty === "innerHTML") ko.utils.setHtml(this.domElement, valueToWrite); else this.domElement[elemContentsProperty] = valueToWrite; } }; var dataDomDataPrefix = ko.utils.domData.nextKey() + "_"; ko.templateSources.domElement.prototype['data'] = function(key /*, valueToWrite */) { if (arguments.length === 1) { return ko.utils.domData.get(this.domElement, dataDomDataPrefix + key); } else { ko.utils.domData.set(this.domElement, dataDomDataPrefix + key, arguments[1]); } }; // ---- ko.templateSources.anonymousTemplate ----- // Anonymous templates are normally saved/retrieved as DOM nodes through "nodes". // For compatibility, you can also read "text"; it will be serialized from the nodes on demand. // Writing to "text" is still supported, but then the template data will not be available as DOM nodes. var anonymousTemplatesDomDataKey = ko.utils.domData.nextKey(); ko.templateSources.anonymousTemplate = function(element) { this.domElement = element; } ko.templateSources.anonymousTemplate.prototype = new ko.templateSources.domElement(); ko.templateSources.anonymousTemplate.prototype.constructor = ko.templateSources.anonymousTemplate; ko.templateSources.anonymousTemplate.prototype['text'] = function(/* valueToWrite */) { if (arguments.length == 0) { var templateData = ko.utils.domData.get(this.domElement, anonymousTemplatesDomDataKey) || {}; if (templateData.textData === undefined && templateData.containerData) templateData.textData = templateData.containerData.innerHTML; return templateData.textData; } else { var valueToWrite = arguments[0]; ko.utils.domData.set(this.domElement, anonymousTemplatesDomDataKey, {textData: valueToWrite}); } }; ko.templateSources.domElement.prototype['nodes'] = function(/* valueToWrite */) { if (arguments.length == 0) { var templateData = ko.utils.domData.get(this.domElement, anonymousTemplatesDomDataKey) || {}; return templateData.containerData; } else { var valueToWrite = arguments[0]; ko.utils.domData.set(this.domElement, anonymousTemplatesDomDataKey, {containerData: valueToWrite}); } }; ko.exportSymbol('templateSources', ko.templateSources); ko.exportSymbol('templateSources.domElement', ko.templateSources.domElement); ko.exportSymbol('templateSources.anonymousTemplate', ko.templateSources.anonymousTemplate); })(); (function () { var _templateEngine; ko.setTemplateEngine = function (templateEngine) { if ((templateEngine != undefined) && !(templateEngine instanceof ko.templateEngine)) throw new Error("templateEngine must inherit from ko.templateEngine"); _templateEngine = templateEngine; } function invokeForEachNodeInContinuousRange(firstNode, lastNode, action) { var node, nextInQueue = firstNode, firstOutOfRangeNode = ko.virtualElements.nextSibling(lastNode); while (nextInQueue && ((node = nextInQueue) !== firstOutOfRangeNode)) { nextInQueue = ko.virtualElements.nextSibling(node); action(node, nextInQueue); } } function activateBindingsOnContinuousNodeArray(continuousNodeArray, bindingContext) { // To be used on any nodes that have been rendered by a template and have been inserted into some parent element // Walks through continuousNodeArray (which *must* be continuous, i.e., an uninterrupted sequence of sibling nodes, because // the algorithm for walking them relies on this), and for each top-level item in the virtual-element sense, // (1) Does a regular "applyBindings" to associate bindingContext with this node and to activate any non-memoized bindings // (2) Unmemoizes any memos in the DOM subtree (e.g., to activate bindings that had been memoized during template rewriting) if (continuousNodeArray.length) { var firstNode = continuousNodeArray[0], lastNode = continuousNodeArray[continuousNodeArray.length - 1], parentNode = firstNode.parentNode, provider = ko.bindingProvider['instance'], preprocessNode = provider['preprocessNode']; if (preprocessNode) { invokeForEachNodeInContinuousRange(firstNode, lastNode, function(node, nextNodeInRange) { var nodePreviousSibling = node.previousSibling; var newNodes = preprocessNode.call(provider, node); if (newNodes) { if (node === firstNode) firstNode = newNodes[0] || nextNodeInRange; if (node === lastNode) lastNode = newNodes[newNodes.length - 1] || nodePreviousSibling; } }); // Because preprocessNode can change the nodes, including the first and last nodes, update continuousNodeArray to match. // We need the full set, including inner nodes, because the unmemoize step might remove the first node (and so the real // first node needs to be in the array). continuousNodeArray.length = 0; if (!firstNode) { // preprocessNode might have removed all the nodes, in which case there's nothing left to do return; } if (firstNode === lastNode) { continuousNodeArray.push(firstNode); } else { continuousNodeArray.push(firstNode, lastNode); ko.utils.fixUpContinuousNodeArray(continuousNodeArray, parentNode); } } // Need to applyBindings *before* unmemoziation, because unmemoization might introduce extra nodes (that we don't want to re-bind) // whereas a regular applyBindings won't introduce new memoized nodes invokeForEachNodeInContinuousRange(firstNode, lastNode, function(node) { if (node.nodeType === 1 || node.nodeType === 8) ko.applyBindings(bindingContext, node); }); invokeForEachNodeInContinuousRange(firstNode, lastNode, function(node) { if (node.nodeType === 1 || node.nodeType === 8) ko.memoization.unmemoizeDomNodeAndDescendants(node, [bindingContext]); }); // Make sure any changes done by applyBindings or unmemoize are reflected in the array ko.utils.fixUpContinuousNodeArray(continuousNodeArray, parentNode); } } function getFirstNodeFromPossibleArray(nodeOrNodeArray) { return nodeOrNodeArray.nodeType ? nodeOrNodeArray : nodeOrNodeArray.length > 0 ? nodeOrNodeArray[0] : null; } function executeTemplate(targetNodeOrNodeArray, renderMode, template, bindingContext, options) { options = options || {}; var firstTargetNode = targetNodeOrNodeArray && getFirstNodeFromPossibleArray(targetNodeOrNodeArray); var templateDocument = (firstTargetNode || template || {}).ownerDocument; var templateEngineToUse = (options['templateEngine'] || _templateEngine); ko.templateRewriting.ensureTemplateIsRewritten(template, templateEngineToUse, templateDocument); var renderedNodesArray = templateEngineToUse['renderTemplate'](template, bindingContext, options, templateDocument); // Loosely check result is an array of DOM nodes if ((typeof renderedNodesArray.length != "number") || (renderedNodesArray.length > 0 && typeof renderedNodesArray[0].nodeType != "number")) throw new Error("Template engine must return an array of DOM nodes"); var haveAddedNodesToParent = false; switch (renderMode) { case "replaceChildren": ko.virtualElements.setDomNodeChildren(targetNodeOrNodeArray, renderedNodesArray); haveAddedNodesToParent = true; break; case "replaceNode": ko.utils.replaceDomNodes(targetNodeOrNodeArray, renderedNodesArray); haveAddedNodesToParent = true; break; case "ignoreTargetNode": break; default: throw new Error("Unknown renderMode: " + renderMode); } if (haveAddedNodesToParent) { activateBindingsOnContinuousNodeArray(renderedNodesArray, bindingContext); if (options['afterRender']) ko.dependencyDetection.ignore(options['afterRender'], null, [renderedNodesArray, bindingContext['$data']]); } return renderedNodesArray; } function resolveTemplateName(template, data, context) { // The template can be specified as: if (ko.isObservable(template)) { // 1. An observable, with string value return template(); } else if (typeof template === 'function') { // 2. A function of (data, context) returning a string return template(data, context); } else { // 3. A string return template; } } ko.renderTemplate = function (template, dataOrBindingContext, options, targetNodeOrNodeArray, renderMode) { options = options || {}; if ((options['templateEngine'] || _templateEngine) == undefined) throw new Error("Set a template engine before calling renderTemplate"); renderMode = renderMode || "replaceChildren"; if (targetNodeOrNodeArray) { var firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray); var whenToDispose = function () { return (!firstTargetNode) || !ko.utils.domNodeIsAttachedToDocument(firstTargetNode); }; // Passive disposal (on next evaluation) var activelyDisposeWhenNodeIsRemoved = (firstTargetNode && renderMode == "replaceNode") ? firstTargetNode.parentNode : firstTargetNode; return ko.dependentObservable( // So the DOM is automatically updated when any dependency changes function () { // Ensure we've got a proper binding context to work with var bindingContext = (dataOrBindingContext && (dataOrBindingContext instanceof ko.bindingContext)) ? dataOrBindingContext : new ko.bindingContext(ko.utils.unwrapObservable(dataOrBindingContext)); var templateName = resolveTemplateName(template, bindingContext['$data'], bindingContext), renderedNodesArray = executeTemplate(targetNodeOrNodeArray, renderMode, templateName, bindingContext, options); if (renderMode == "replaceNode") { targetNodeOrNodeArray = renderedNodesArray; firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray); } }, null, { disposeWhen: whenToDispose, disposeWhenNodeIsRemoved: activelyDisposeWhenNodeIsRemoved } ); } else { // We don't yet have a DOM node to evaluate, so use a memo and render the template later when there is a DOM node return ko.memoization.memoize(function (domNode) { ko.renderTemplate(template, dataOrBindingContext, options, domNode, "replaceNode"); }); } }; ko.renderTemplateForEach = function (template, arrayOrObservableArray, options, targetNode, parentBindingContext) { // Since setDomNodeChildrenFromArrayMapping always calls executeTemplateForArrayItem and then // activateBindingsCallback for added items, we can store the binding context in the former to use in the latter. var arrayItemContext; // This will be called by setDomNodeChildrenFromArrayMapping to get the nodes to add to targetNode var executeTemplateForArrayItem = function (arrayValue, index) { // Support selecting template as a function of the data being rendered arrayItemContext = parentBindingContext['createChildContext'](arrayValue, options['as'], function(context) { context['$index'] = index; }); var templateName = resolveTemplateName(template, arrayValue, arrayItemContext); return executeTemplate(null, "ignoreTargetNode", templateName, arrayItemContext, options); } // This will be called whenever setDomNodeChildrenFromArrayMapping has added nodes to targetNode var activateBindingsCallback = function(arrayValue, addedNodesArray, index) { activateBindingsOnContinuousNodeArray(addedNodesArray, arrayItemContext); if (options['afterRender']) options['afterRender'](addedNodesArray, arrayValue); // release the "cache" variable, so that it can be collected by // the GC when its value isn't used from within the bindings anymore. arrayItemContext = null; }; return ko.dependentObservable(function () { var unwrappedArray = ko.utils.unwrapObservable(arrayOrObservableArray) || []; if (typeof unwrappedArray.length == "undefined") // Coerce single value into array unwrappedArray = [unwrappedArray]; // Filter out any entries marked as destroyed var filteredArray = ko.utils.arrayFilter(unwrappedArray, function(item) { return options['includeDestroyed'] || item === undefined || item === null || !ko.utils.unwrapObservable(item['_destroy']); }); // Call setDomNodeChildrenFromArrayMapping, ignoring any observables unwrapped within (most likely from a callback function). // If the array items are observables, though, they will be unwrapped in executeTemplateForArrayItem and managed within setDomNodeChildrenFromArrayMapping. ko.dependencyDetection.ignore(ko.utils.setDomNodeChildrenFromArrayMapping, null, [targetNode, filteredArray, executeTemplateForArrayItem, options, activateBindingsCallback]); }, null, { disposeWhenNodeIsRemoved: targetNode }); }; var templateComputedDomDataKey = ko.utils.domData.nextKey(); function disposeOldComputedAndStoreNewOne(element, newComputed) { var oldComputed = ko.utils.domData.get(element, templateComputedDomDataKey); if (oldComputed && (typeof(oldComputed.dispose) == 'function')) oldComputed.dispose(); ko.utils.domData.set(element, templateComputedDomDataKey, (newComputed && newComputed.isActive()) ? newComputed : undefined); } ko.bindingHandlers['template'] = { 'init': function(element, valueAccessor) { // Support anonymous templates var bindingValue = ko.utils.unwrapObservable(valueAccessor()); if (typeof bindingValue == "string" || bindingValue['name']) { // It's a named template - clear the element ko.virtualElements.emptyNode(element); } else if ('nodes' in bindingValue) { // We've been given an array of DOM nodes. Save them as the template source. // There is no known use case for the node array being an observable array (if the output // varies, put that behavior *into* your template - that's what templates are for), and // the implementation would be a mess, so assert that it's not observable. var nodes = bindingValue['nodes'] || []; if (ko.isObservable(nodes)) { throw new Error('The "nodes" option must be a plain, non-observable array.'); } var container = ko.utils.moveCleanedNodesToContainerElement(nodes); // This also removes the nodes from their current parent new ko.templateSources.anonymousTemplate(element)['nodes'](container); } else { // It's an anonymous template - store the element contents, then clear the element var templateNodes = ko.virtualElements.childNodes(element), container = ko.utils.moveCleanedNodesToContainerElement(templateNodes); // This also removes the nodes from their current parent new ko.templateSources.anonymousTemplate(element)['nodes'](container); } return { 'controlsDescendantBindings': true }; }, 'update': function (element, valueAccessor, allBindings, viewModel, bindingContext) { var value = valueAccessor(), dataValue, options = ko.utils.unwrapObservable(value), shouldDisplay = true, templateComputed = null, templateName; if (typeof options == "string") { templateName = value; options = {}; } else { templateName = options['name']; // Support "if"/"ifnot" conditions if ('if' in options) shouldDisplay = ko.utils.unwrapObservable(options['if']); if (shouldDisplay && 'ifnot' in options) shouldDisplay = !ko.utils.unwrapObservable(options['ifnot']); dataValue = ko.utils.unwrapObservable(options['data']); } if ('foreach' in options) { // Render once for each data point (treating data set as empty if shouldDisplay==false) var dataArray = (shouldDisplay && options['foreach']) || []; templateComputed = ko.renderTemplateForEach(templateName || element, dataArray, options, element, bindingContext); } else if (!shouldDisplay) { ko.virtualElements.emptyNode(element); } else { // Render once for this single data point (or use the viewModel if no data was provided) var innerBindingContext = ('data' in options) ? bindingContext['createChildContext'](dataValue, options['as']) : // Given an explitit 'data' value, we create a child binding context for it bindingContext; // Given no explicit 'data' value, we retain the same binding context templateComputed = ko.renderTemplate(templateName || element, innerBindingContext, options, element); } // It only makes sense to have a single template computed per element (otherwise which one should have its output displayed?) disposeOldComputedAndStoreNewOne(element, templateComputed); } }; // Anonymous templates can't be rewritten. Give a nice error message if you try to do it. ko.expressionRewriting.bindingRewriteValidators['template'] = function(bindingValue) { var parsedBindingValue = ko.expressionRewriting.parseObjectLiteral(bindingValue); if ((parsedBindingValue.length == 1) && parsedBindingValue[0]['unknown']) return null; // It looks like a string literal, not an object literal, so treat it as a named template (which is allowed for rewriting) if (ko.expressionRewriting.keyValueArrayContainsKey(parsedBindingValue, "name")) return null; // Named templates can be rewritten, so return "no error" return "This template engine does not support anonymous templates nested within its templates"; }; ko.virtualElements.allowedBindings['template'] = true; })(); ko.exportSymbol('setTemplateEngine', ko.setTemplateEngine); ko.exportSymbol('renderTemplate', ko.renderTemplate); // Go through the items that have been added and deleted and try to find matches between them. ko.utils.findMovesInArrayComparison = function (left, right, limitFailedCompares) { if (left.length && right.length) { var failedCompares, l, r, leftItem, rightItem; for (failedCompares = l = 0; (!limitFailedCompares || failedCompares < limitFailedCompares) && (leftItem = left[l]); ++l) { for (r = 0; rightItem = right[r]; ++r) { if (leftItem['value'] === rightItem['value']) { leftItem['moved'] = rightItem['index']; rightItem['moved'] = leftItem['index']; right.splice(r, 1); // This item is marked as moved; so remove it from right list failedCompares = r = 0; // Reset failed compares count because we're checking for consecutive failures break; } } failedCompares += r; } } }; ko.utils.compareArrays = (function () { var statusNotInOld = 'added', statusNotInNew = 'deleted'; // Simple calculation based on Levenshtein distance. function compareArrays(oldArray, newArray, options) { // For backward compatibility, if the third arg is actually a bool, interpret // it as the old parameter 'dontLimitMoves'. Newer code should use { dontLimitMoves: true }. options = (typeof options === 'boolean') ? { 'dontLimitMoves': options } : (options || {}); oldArray = oldArray || []; newArray = newArray || []; if (oldArray.length <= newArray.length) return compareSmallArrayToBigArray(oldArray, newArray, statusNotInOld, statusNotInNew, options); else return compareSmallArrayToBigArray(newArray, oldArray, statusNotInNew, statusNotInOld, options); } function compareSmallArrayToBigArray(smlArray, bigArray, statusNotInSml, statusNotInBig, options) { var myMin = Math.min, myMax = Math.max, editDistanceMatrix = [], smlIndex, smlIndexMax = smlArray.length, bigIndex, bigIndexMax = bigArray.length, compareRange = (bigIndexMax - smlIndexMax) || 1, maxDistance = smlIndexMax + bigIndexMax + 1, thisRow, lastRow, bigIndexMaxForRow, bigIndexMinForRow; for (smlIndex = 0; smlIndex <= smlIndexMax; smlIndex++) { lastRow = thisRow; editDistanceMatrix.push(thisRow = []); bigIndexMaxForRow = myMin(bigIndexMax, smlIndex + compareRange); bigIndexMinForRow = myMax(0, smlIndex - 1); for (bigIndex = bigIndexMinForRow; bigIndex <= bigIndexMaxForRow; bigIndex++) { if (!bigIndex) thisRow[bigIndex] = smlIndex + 1; else if (!smlIndex) // Top row - transform empty array into new array via additions thisRow[bigIndex] = bigIndex + 1; else if (smlArray[smlIndex - 1] === bigArray[bigIndex - 1]) thisRow[bigIndex] = lastRow[bigIndex - 1]; // copy value (no edit) else { var northDistance = lastRow[bigIndex] || maxDistance; // not in big (deletion) var westDistance = thisRow[bigIndex - 1] || maxDistance; // not in small (addition) thisRow[bigIndex] = myMin(northDistance, westDistance) + 1; } } } var editScript = [], meMinusOne, notInSml = [], notInBig = []; for (smlIndex = smlIndexMax, bigIndex = bigIndexMax; smlIndex || bigIndex;) { meMinusOne = editDistanceMatrix[smlIndex][bigIndex] - 1; if (bigIndex && meMinusOne === editDistanceMatrix[smlIndex][bigIndex-1]) { notInSml.push(editScript[editScript.length] = { // added 'status': statusNotInSml, 'value': bigArray[--bigIndex], 'index': bigIndex }); } else if (smlIndex && meMinusOne === editDistanceMatrix[smlIndex - 1][bigIndex]) { notInBig.push(editScript[editScript.length] = { // deleted 'status': statusNotInBig, 'value': smlArray[--smlIndex], 'index': smlIndex }); } else { --bigIndex; --smlIndex; if (!options['sparse']) { editScript.push({ 'status': "retained", 'value': bigArray[bigIndex] }); } } } // Set a limit on the number of consecutive non-matching comparisons; having it a multiple of // smlIndexMax keeps the time complexity of this algorithm linear. ko.utils.findMovesInArrayComparison(notInSml, notInBig, smlIndexMax * 10); return editScript.reverse(); } return compareArrays; })(); ko.exportSymbol('utils.compareArrays', ko.utils.compareArrays); (function () { // Objective: // * Given an input array, a container DOM node, and a function from array elements to arrays of DOM nodes, // map the array elements to arrays of DOM nodes, concatenate together all these arrays, and use them to populate the container DOM node // * Next time we're given the same combination of things (with the array possibly having mutated), update the container DOM node // so that its children is again the concatenation of the mappings of the array elements, but don't re-map any array elements that we // previously mapped - retain those nodes, and just insert/delete other ones // "callbackAfterAddingNodes" will be invoked after any "mapping"-generated nodes are inserted into the container node // You can use this, for example, to activate bindings on those nodes. function mapNodeAndRefreshWhenChanged(containerNode, mapping, valueToMap, callbackAfterAddingNodes, index) { // Map this array value inside a dependentObservable so we re-map when any dependency changes var mappedNodes = []; var dependentObservable = ko.dependentObservable(function() { var newMappedNodes = mapping(valueToMap, index, ko.utils.fixUpContinuousNodeArray(mappedNodes, containerNode)) || []; // On subsequent evaluations, just replace the previously-inserted DOM nodes if (mappedNodes.length > 0) { ko.utils.replaceDomNodes(mappedNodes, newMappedNodes); if (callbackAfterAddingNodes) ko.dependencyDetection.ignore(callbackAfterAddingNodes, null, [valueToMap, newMappedNodes, index]); } // Replace the contents of the mappedNodes array, thereby updating the record // of which nodes would be deleted if valueToMap was itself later removed mappedNodes.length = 0; ko.utils.arrayPushAll(mappedNodes, newMappedNodes); }, null, { disposeWhenNodeIsRemoved: containerNode, disposeWhen: function() { return !ko.utils.anyDomNodeIsAttachedToDocument(mappedNodes); } }); return { mappedNodes : mappedNodes, dependentObservable : (dependentObservable.isActive() ? dependentObservable : undefined) }; } var lastMappingResultDomDataKey = ko.utils.domData.nextKey(); ko.utils.setDomNodeChildrenFromArrayMapping = function (domNode, array, mapping, options, callbackAfterAddingNodes) { // Compare the provided array against the previous one array = array || []; options = options || {}; var isFirstExecution = ko.utils.domData.get(domNode, lastMappingResultDomDataKey) === undefined; var lastMappingResult = ko.utils.domData.get(domNode, lastMappingResultDomDataKey) || []; var lastArray = ko.utils.arrayMap(lastMappingResult, function (x) { return x.arrayEntry; }); var editScript = ko.utils.compareArrays(lastArray, array, options['dontLimitMoves']); // Build the new mapping result var newMappingResult = []; var lastMappingResultIndex = 0; var newMappingResultIndex = 0; var nodesToDelete = []; var itemsToProcess = []; var itemsForBeforeRemoveCallbacks = []; var itemsForMoveCallbacks = []; var itemsForAfterAddCallbacks = []; var mapData; function itemMovedOrRetained(editScriptIndex, oldPosition) { mapData = lastMappingResult[oldPosition]; if (newMappingResultIndex !== oldPosition) itemsForMoveCallbacks[editScriptIndex] = mapData; // Since updating the index might change the nodes, do so before calling fixUpContinuousNodeArray mapData.indexObservable(newMappingResultIndex++); ko.utils.fixUpContinuousNodeArray(mapData.mappedNodes, domNode); newMappingResult.push(mapData); itemsToProcess.push(mapData); } function callCallback(callback, items) { if (callback) { for (var i = 0, n = items.length; i < n; i++) { if (items[i]) { ko.utils.arrayForEach(items[i].mappedNodes, function(node) { callback(node, i, items[i].arrayEntry); }); } } } } for (var i = 0, editScriptItem, movedIndex; editScriptItem = editScript[i]; i++) { movedIndex = editScriptItem['moved']; switch (editScriptItem['status']) { case "deleted": if (movedIndex === undefined) { mapData = lastMappingResult[lastMappingResultIndex]; // Stop tracking changes to the mapping for these nodes if (mapData.dependentObservable) mapData.dependentObservable.dispose(); // Queue these nodes for later removal nodesToDelete.push.apply(nodesToDelete, ko.utils.fixUpContinuousNodeArray(mapData.mappedNodes, domNode)); if (options['beforeRemove']) { itemsForBeforeRemoveCallbacks[i] = mapData; itemsToProcess.push(mapData); } } lastMappingResultIndex++; break; case "retained": itemMovedOrRetained(i, lastMappingResultIndex++); break; case "added": if (movedIndex !== undefined) { itemMovedOrRetained(i, movedIndex); } else { mapData = { arrayEntry: editScriptItem['value'], indexObservable: ko.observable(newMappingResultIndex++) }; newMappingResult.push(mapData); itemsToProcess.push(mapData); if (!isFirstExecution) itemsForAfterAddCallbacks[i] = mapData; } break; } } // Call beforeMove first before any changes have been made to the DOM callCallback(options['beforeMove'], itemsForMoveCallbacks); // Next remove nodes for deleted items (or just clean if there's a beforeRemove callback) ko.utils.arrayForEach(nodesToDelete, options['beforeRemove'] ? ko.cleanNode : ko.removeNode); // Next add/reorder the remaining items (will include deleted items if there's a beforeRemove callback) for (var i = 0, nextNode = ko.virtualElements.firstChild(domNode), lastNode, node; mapData = itemsToProcess[i]; i++) { // Get nodes for newly added items if (!mapData.mappedNodes) ko.utils.extend(mapData, mapNodeAndRefreshWhenChanged(domNode, mapping, mapData.arrayEntry, callbackAfterAddingNodes, mapData.indexObservable)); // Put nodes in the right place if they aren't there already for (var j = 0; node = mapData.mappedNodes[j]; nextNode = node.nextSibling, lastNode = node, j++) { if (node !== nextNode) ko.virtualElements.insertAfter(domNode, node, lastNode); } // Run the callbacks for newly added nodes (for example, to apply bindings, etc.) if (!mapData.initialized && callbackAfterAddingNodes) { callbackAfterAddingNodes(mapData.arrayEntry, mapData.mappedNodes, mapData.indexObservable); mapData.initialized = true; } } // If there's a beforeRemove callback, call it after reordering. // Note that we assume that the beforeRemove callback will usually be used to remove the nodes using // some sort of animation, which is why we first reorder the nodes that will be removed. If the // callback instead removes the nodes right away, it would be more efficient to skip reordering them. // Perhaps we'll make that change in the future if this scenario becomes more common. callCallback(options['beforeRemove'], itemsForBeforeRemoveCallbacks); // Finally call afterMove and afterAdd callbacks callCallback(options['afterMove'], itemsForMoveCallbacks); callCallback(options['afterAdd'], itemsForAfterAddCallbacks); // Store a copy of the array items we just considered so we can difference it next time ko.utils.domData.set(domNode, lastMappingResultDomDataKey, newMappingResult); } })(); ko.exportSymbol('utils.setDomNodeChildrenFromArrayMapping', ko.utils.setDomNodeChildrenFromArrayMapping); ko.nativeTemplateEngine = function () { this['allowTemplateRewriting'] = false; } ko.nativeTemplateEngine.prototype = new ko.templateEngine(); ko.nativeTemplateEngine.prototype.constructor = ko.nativeTemplateEngine; ko.nativeTemplateEngine.prototype['renderTemplateSource'] = function (templateSource, bindingContext, options, templateDocument) { var useNodesIfAvailable = !(ko.utils.ieVersion < 9), // IE<9 cloneNode doesn't work properly templateNodesFunc = useNodesIfAvailable ? templateSource['nodes'] : null, templateNodes = templateNodesFunc ? templateSource['nodes']() : null; if (templateNodes) { return ko.utils.makeArray(templateNodes.cloneNode(true).childNodes); } else { var templateText = templateSource['text'](); return ko.utils.parseHtmlFragment(templateText, templateDocument); } }; ko.nativeTemplateEngine.instance = new ko.nativeTemplateEngine(); ko.setTemplateEngine(ko.nativeTemplateEngine.instance); ko.exportSymbol('nativeTemplateEngine', ko.nativeTemplateEngine); (function() { ko.jqueryTmplTemplateEngine = function () { // Detect which version of jquery-tmpl you're using. Unfortunately jquery-tmpl // doesn't expose a version number, so we have to infer it. // Note that as of Knockout 1.3, we only support jQuery.tmpl 1.0.0pre and later, // which KO internally refers to as version "2", so older versions are no longer detected. var jQueryTmplVersion = this.jQueryTmplVersion = (function() { if (!jQueryInstance || !(jQueryInstance['tmpl'])) return 0; // Since it exposes no official version number, we use our own numbering system. To be updated as jquery-tmpl evolves. try { if (jQueryInstance['tmpl']['tag']['tmpl']['open'].toString().indexOf('__') >= 0) { // Since 1.0.0pre, custom tags should append markup to an array called "__" return 2; // Final version of jquery.tmpl } } catch(ex) { /* Apparently not the version we were looking for */ } return 1; // Any older version that we don't support })(); function ensureHasReferencedJQueryTemplates() { if (jQueryTmplVersion < 2) throw new Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later."); } function executeTemplate(compiledTemplate, data, jQueryTemplateOptions) { return jQueryInstance['tmpl'](compiledTemplate, data, jQueryTemplateOptions); } this['renderTemplateSource'] = function(templateSource, bindingContext, options, templateDocument) { templateDocument = templateDocument || document; options = options || {}; ensureHasReferencedJQueryTemplates(); // Ensure we have stored a precompiled version of this template (don't want to reparse on every render) var precompiled = templateSource['data']('precompiled'); if (!precompiled) { var templateText = templateSource['text']() || ""; // Wrap in "with($whatever.koBindingContext) { ... }" templateText = "{{ko_with $item.koBindingContext}}" + templateText + "{{/ko_with}}"; precompiled = jQueryInstance['template'](null, templateText); templateSource['data']('precompiled', precompiled); } var data = [bindingContext['$data']]; // Prewrap the data in an array to stop jquery.tmpl from trying to unwrap any arrays var jQueryTemplateOptions = jQueryInstance['extend']({ 'koBindingContext': bindingContext }, options['templateOptions']); var resultNodes = executeTemplate(precompiled, data, jQueryTemplateOptions); resultNodes['appendTo'](templateDocument.createElement("div")); // Using "appendTo" forces jQuery/jQuery.tmpl to perform necessary cleanup work jQueryInstance['fragments'] = {}; // Clear jQuery's fragment cache to avoid a memory leak after a large number of template renders return resultNodes; }; this['createJavaScriptEvaluatorBlock'] = function(script) { return "{{ko_code ((function() { return " + script + " })()) }}"; }; this['addTemplate'] = function(templateName, templateMarkup) { document.write("<script type='text/html' id='" + templateName + "'>" + templateMarkup + "<" + "/script>"); }; if (jQueryTmplVersion > 0) { jQueryInstance['tmpl']['tag']['ko_code'] = { open: "__.push($1 || '');" }; jQueryInstance['tmpl']['tag']['ko_with'] = { open: "with($1) {", close: "} " }; } }; ko.jqueryTmplTemplateEngine.prototype = new ko.templateEngine(); ko.jqueryTmplTemplateEngine.prototype.constructor = ko.jqueryTmplTemplateEngine; // Use this one by default *only if jquery.tmpl is referenced* var jqueryTmplTemplateEngineInstance = new ko.jqueryTmplTemplateEngine(); if (jqueryTmplTemplateEngineInstance.jQueryTmplVersion > 0) ko.setTemplateEngine(jqueryTmplTemplateEngineInstance); ko.exportSymbol('jqueryTmplTemplateEngine', ko.jqueryTmplTemplateEngine); })(); })); }()); })();
269,933
knockout
js
en
javascript
code
{"qsc_code_num_words": 24320, "qsc_code_num_chars": 269933.0, "qsc_code_mean_word_length": 6.80020559, "qsc_code_frac_words_unique": 0.10859375, "qsc_code_frac_chars_top_2grams": 0.01345983, "qsc_code_frac_chars_top_3grams": 0.00667549, "qsc_code_frac_chars_top_4grams": 0.00159631, "qsc_code_frac_chars_dupe_5grams": 0.14018539, "qsc_code_frac_chars_dupe_6grams": 0.09609931, "qsc_code_frac_chars_dupe_7grams": 0.07372673, "qsc_code_frac_chars_dupe_8grams": 0.05306535, "qsc_code_frac_chars_dupe_9grams": 0.04160696, "qsc_code_frac_chars_dupe_10grams": 0.03329887, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.0034897, "qsc_code_frac_chars_whitespace": 0.28979784, "qsc_code_size_file_byte": 269933.0, "qsc_code_num_lines": 5475.0, "qsc_code_num_chars_line_max": 275.0, "qsc_code_num_chars_line_mean": 49.30283105, "qsc_code_frac_chars_alphabet": 0.85918615, "qsc_code_frac_chars_comments": 0.2545891, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.20506455, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.00397219, "qsc_code_frac_chars_string_length": 0.06124417, "qsc_code_frac_chars_long_word_length": 0.0109338, "qsc_code_frac_lines_string_concat": 0.00024826, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 5.467e-05, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codejavascript_cate_ast": 1.0, "qsc_codejavascript_cate_var_zero": 0.0, "qsc_codejavascript_frac_lines_func_ratio": 0.03003972, "qsc_codejavascript_num_statement_line": 0.00024826, "qsc_codejavascript_score_lines_no_logic": 0.10402185, "qsc_codejavascript_frac_words_legal_var_name": 0.98248408, "qsc_codejavascript_frac_words_legal_func_name": 1.0, "qsc_codejavascript_frac_words_legal_class_name": null, "qsc_codejavascript_frac_lines_print": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codejavascript_cate_ast": 0, "qsc_codejavascript_cate_var_zero": 0, "qsc_codejavascript_frac_lines_func_ratio": 0, "qsc_codejavascript_score_lines_no_logic": 0, "qsc_codejavascript_frac_lines_print": 0}
00jacs/sveltekit-ultrafast
src/lib/components/common/dialog/dialog.svelte
<script lang="ts"> import { Button } from '$lib/components'; import { fade, fly } from 'svelte/transition'; import { createEventDispatcher } from 'svelte'; import { Icon, InformationCircle, ExclamationCircle, Check } from 'svelte-hero-icons'; export let type: 'danger' | 'warning' | 'info' | 'success' = 'info'; export let title: string; export let message: string; export let submitText: string; export let cancelText: string = 'Cancel'; const dispatch = createEventDispatcher(); $: btnClass = type == 'danger' ? 'btn-error' : type == 'warning' ? 'btn-warning' : type == 'info' ? 'btn-info' : type == 'success' ? 'btn-success' : 'btn-primary'; $: typeColorClass = type == 'danger' ? 'bg-red-100' : type == 'warning' ? 'bg-yellow-100' : type == 'info' ? 'bg-blue-100' : type == 'success' ? 'bg-green-100' : 'bg-gray-100'; </script> <div class="relative" style="z-index: 60;"> <div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity" transition:fade={{ duration: 200 }}> </div> <div class="fixed inset-0 z-10 w-screen overflow-y-auto"> <div class="flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0"> <div class="relative transform overflow-hidden rounded-lg bg-base-100 px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-lg sm:p-6" transition:fly> <div class="sm:flex sm:items-start"> <div class={`${typeColorClass} mx-auto flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-full sm:mx-0 sm:h-10 sm:w-10`}> {#if type == 'danger'} <Icon src={ExclamationCircle} class="h-7 w-7 text-red-600" /> {:else if type == 'warning'} <Icon src={ExclamationCircle} class="h-7 w-7 text-yellow-600" /> {:else if type == 'info'} <Icon src={InformationCircle} class="h-7 w-7 text-blue-600" /> {:else if type == 'success'} <Icon src={Check} class="h-7 w-7 text-green-600" /> {/if} </div> <div class="mt-3 text-center sm:ml-4 sm:mt-0 sm:text-left"> <h3 class="text-base font-semibold leading-6">{title}</h3> {#if message} <p class="text-base-content-secondary mt-2 text-sm"> {message} </p> {/if} </div> </div> <div class="mt-5 flex justify-center gap-2 sm:mt-4 sm:justify-end"> <Button class="btn-outline border-base-200" on:click={() => dispatch('cancel')}> {cancelText} </Button> <Button class={`btn ${btnClass} sm:w-auto`} on:click={() => dispatch('submit')}> {submitText} </Button> </div> </div> </div> </div> </div>
2,731
dialog
svelte
en
svelte
code
{"qsc_code_num_words": 378, "qsc_code_num_chars": 2731.0, "qsc_code_mean_word_length": 4.26719577, "qsc_code_frac_words_unique": 0.32010582, "qsc_code_frac_chars_top_2grams": 0.04463732, "qsc_code_frac_chars_top_3grams": 0.01735896, "qsc_code_frac_chars_top_4grams": 0.01983881, "qsc_code_frac_chars_dupe_5grams": 0.08555487, "qsc_code_frac_chars_dupe_6grams": 0.06199628, "qsc_code_frac_chars_dupe_7grams": 0.04587725, "qsc_code_frac_chars_dupe_8grams": 0.04587725, "qsc_code_frac_chars_dupe_9grams": 0.04587725, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.03893637, "qsc_code_frac_chars_whitespace": 0.2288539, "qsc_code_size_file_byte": 2731.0, "qsc_code_num_lines": 88.0, "qsc_code_num_chars_line_max": 93.0, "qsc_code_num_chars_line_mean": 31.03409091, "qsc_code_frac_chars_alphabet": 0.72697056, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.3164557, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.05063291, "qsc_code_frac_chars_string_length": 0.288539, "qsc_code_frac_chars_long_word_length": 0.00988649, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_ll.h
/** * @file lv_ll.c * Handle linked lists. The nodes are dynamically allocated by the 'lv_mem' module. */ #ifndef LV_LL_H #define LV_LL_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #include "lv_mem.h" #include <stdint.h> #include <stddef.h> #include <stdbool.h> /********************* * DEFINES *********************/ /********************** * TYPEDEFS **********************/ /** Dummy type to make handling easier*/ typedef uint8_t lv_ll_node_t; /** Description of a linked list*/ typedef struct { uint32_t n_size; lv_ll_node_t * head; lv_ll_node_t * tail; } lv_ll_t; /********************** * GLOBAL PROTOTYPES **********************/ /** * Initialize linked list * @param ll_dsc pointer to ll_dsc variable * @param node_size the size of 1 node in bytes */ void _lv_ll_init(lv_ll_t * ll_p, uint32_t node_size); /** * Add a new head to a linked list * @param ll_p pointer to linked list * @return pointer to the new head */ void * _lv_ll_ins_head(lv_ll_t * ll_p); /** * Insert a new node in front of the n_act node * @param ll_p pointer to linked list * @param n_act pointer a node * @return pointer to the new head */ void * _lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act); /** * Add a new tail to a linked list * @param ll_p pointer to linked list * @return pointer to the new tail */ void * _lv_ll_ins_tail(lv_ll_t * ll_p); /** * Remove the node 'node_p' from 'll_p' linked list. * It does not free the the memory of node. * @param ll_p pointer to the linked list of 'node_p' * @param node_p pointer to node in 'll_p' linked list */ void _lv_ll_remove(lv_ll_t * ll_p, void * node_p); /** * Remove and free all elements from a linked list. The list remain valid but become empty. * @param ll_p pointer to linked list */ void _lv_ll_clear(lv_ll_t * ll_p); /** * Move a node to a new linked list * @param ll_ori_p pointer to the original (old) linked list * @param ll_new_p pointer to the new linked list * @param node pointer to a node * @param head true: be the head in the new list * false be the head in the new list */ void _lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool head); /** * Return with head node of the linked list * @param ll_p pointer to linked list * @return pointer to the head of 'll_p' */ void * _lv_ll_get_head(const lv_ll_t * ll_p); /** * Return with tail node of the linked list * @param ll_p pointer to linked list * @return pointer to the head of 'll_p' */ void * _lv_ll_get_tail(const lv_ll_t * ll_p); /** * Return with the pointer of the next node after 'n_act' * @param ll_p pointer to linked list * @param n_act pointer a node * @return pointer to the next node */ void * _lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act); /** * Return with the pointer of the previous node after 'n_act' * @param ll_p pointer to linked list * @param n_act pointer a node * @return pointer to the previous node */ void * _lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act); /** * Return the length of the linked list. * @param ll_p pointer to linked list * @return length of the linked list */ uint32_t _lv_ll_get_len(const lv_ll_t * ll_p); /** * TODO * @param ll_p * @param n1_p * @param n2_p void lv_ll_swap(lv_ll_t * ll_p, void * n1_p, void * n2_p); */ /** * Move a node before an other node in the same linked list * @param ll_p pointer to a linked list * @param n_act pointer to node to move * @param n_after pointer to a node which should be after `n_act` */ void _lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after); /** * Check if a linked list is empty * @param ll_p pointer to a linked list * @return true: the linked list is empty; false: not empty */ bool _lv_ll_is_empty(lv_ll_t * ll_p); /********************** * MACROS **********************/ #define _LV_LL_READ(list, i) for(i = _lv_ll_get_head(&list); i != NULL; i = _lv_ll_get_next(&list, i)) #define _LV_LL_READ_BACK(list, i) for(i = _lv_ll_get_tail(&list); i != NULL; i = _lv_ll_get_prev(&list, i)) #ifdef __cplusplus } /* extern "C" */ #endif #endif
4,193
lv_ll
h
en
c
code
{"qsc_code_num_words": 742, "qsc_code_num_chars": 4193.0, "qsc_code_mean_word_length": 3.41778976, "qsc_code_frac_words_unique": 0.16442049, "qsc_code_frac_chars_top_2grams": 0.06940063, "qsc_code_frac_chars_top_3grams": 0.03351735, "qsc_code_frac_chars_top_4grams": 0.04416404, "qsc_code_frac_chars_dupe_5grams": 0.48698738, "qsc_code_frac_chars_dupe_6grams": 0.41798107, "qsc_code_frac_chars_dupe_7grams": 0.36987382, "qsc_code_frac_chars_dupe_8grams": 0.31269716, "qsc_code_frac_chars_dupe_9grams": 0.25985804, "qsc_code_frac_chars_dupe_10grams": 0.25985804, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00357782, "qsc_code_frac_chars_whitespace": 0.2000954, "qsc_code_size_file_byte": 4193.0, "qsc_code_num_lines": 168.0, "qsc_code_num_chars_line_max": 108.0, "qsc_code_num_chars_line_mean": 24.95833333, "qsc_code_frac_chars_alphabet": 0.75253429, "qsc_code_frac_chars_comments": 0.68542809, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.14285714, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00682335, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.00595238, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.45714286, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.57142857, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 1, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 1, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_math.c
/** * @file lv_math.c * */ /********************* * INCLUDES *********************/ #include "lv_math.h" #include <stdbool.h> #include <stdlib.h> #include <string.h> /********************* * DEFINES *********************/ /********************** * TYPEDEFS **********************/ /********************** * STATIC PROTOTYPES **********************/ /********************** * STATIC VARIABLES **********************/ static const int16_t sin0_90_table[] = { 0, 572, 1144, 1715, 2286, 2856, 3425, 3993, 4560, 5126, 5690, 6252, 6813, 7371, 7927, 8481, 9032, 9580, 10126, 10668, 11207, 11743, 12275, 12803, 13328, 13848, 14364, 14876, 15383, 15886, 16383, 16876, 17364, 17846, 18323, 18794, 19260, 19720, 20173, 20621, 21062, 21497, 21925, 22347, 22762, 23170, 23571, 23964, 24351, 24730, 25101, 25465, 25821, 26169, 26509, 26841, 27165, 27481, 27788, 28087, 28377, 28659, 28932, 29196, 29451, 29697, 29934, 30162, 30381, 30591, 30791, 30982, 31163, 31335, 31498, 31650, 31794, 31927, 32051, 32165, 32269, 32364, 32448, 32523, 32587, 32642, 32687, 32722, 32747, 32762, 32767 }; /********************** * MACROS **********************/ /********************** * GLOBAL FUNCTIONS **********************/ /** * Return with sinus of an angle * @param angle * @return sinus of 'angle'. sin(-90) = -32767, sin(90) = 32767 */ LV_ATTRIBUTE_FAST_MEM int16_t _lv_trigo_sin(int16_t angle) { int16_t ret = 0; angle = angle % 360; if(angle < 0) angle = 360 + angle; if(angle < 90) { ret = sin0_90_table[angle]; } else if(angle >= 90 && angle < 180) { angle = 180 - angle; ret = sin0_90_table[angle]; } else if(angle >= 180 && angle < 270) { angle = angle - 180; ret = -sin0_90_table[angle]; } else { /*angle >=270*/ angle = 360 - angle; ret = -sin0_90_table[angle]; } return ret; } /** * Calculate a value of a Cubic Bezier function. * @param t time in range of [0..LV_BEZIER_VAL_MAX] * @param u0 start values in range of [0..LV_BEZIER_VAL_MAX] * @param u1 control value 1 values in range of [0..LV_BEZIER_VAL_MAX] * @param u2 control value 2 in range of [0..LV_BEZIER_VAL_MAX] * @param u3 end values in range of [0..LV_BEZIER_VAL_MAX] * @return the value calculated from the given parameters in range of [0..LV_BEZIER_VAL_MAX] */ int32_t _lv_bezier3(uint32_t t, int32_t u0, int32_t u1, int32_t u2, int32_t u3) { uint32_t t_rem = 1024 - t; uint32_t t_rem2 = (t_rem * t_rem) >> 10; uint32_t t_rem3 = (t_rem2 * t_rem) >> 10; uint32_t t2 = (t * t) >> 10; uint32_t t3 = (t2 * t) >> 10; uint32_t v1 = ((uint32_t)t_rem3 * u0) >> 10; uint32_t v2 = ((uint32_t)3 * t_rem2 * t * u1) >> 20; uint32_t v3 = ((uint32_t)3 * t_rem * t2 * u2) >> 20; uint32_t v4 = ((uint32_t)t3 * u3) >> 10; return v1 + v2 + v3 + v4; } /** * Get the square root of a number * @param x integer which square root should be calculated * @param q store the result here. q->i: integer part, q->f: fractional part in 1/256 unit * @param mask: optional to skip some iterations if the magnitude of the root is known. * Set to 0x8000 by default. * If root < 16: mask = 0x80 * If root < 256: mask = 0x800 * Else: mask = 0x8000 */ LV_ATTRIBUTE_FAST_MEM void _lv_sqrt(uint32_t x, lv_sqrt_res_t * q, uint32_t mask) { x = x << 8; /*To get 4 bit precision. (sqrt(256) = 16 = 4 bit)*/ uint32_t root = 0; uint32_t trial; // http://ww1.microchip.com/...en/AppNotes/91040a.pdf do { trial = root + mask; if((uint32_t)trial * trial <= x) root = trial; mask = mask >> 1; } while(mask); q->i = (uint32_t) root >> 4; q->f = (uint32_t)(root & 0xf) << 4; } /** * Calculate the atan2 of a vector. * @param x * @param y * @return the angle in degree calculated from the given parameters in range of [0..360] */ uint16_t _lv_atan2(int x, int y) { // Fast XY vector to integer degree algorithm - Jan 2011 www.RomanBlack.com // Converts any XY values including 0 to a degree value that should be // within +/- 1 degree of the accurate value without needing // large slow trig functions like ArcTan() or ArcCos(). // NOTE! at least one of the X or Y values must be non-zero! // This is the full version, for all 4 quadrants and will generate // the angle in integer degrees from 0-360. // Any values of X and Y are usable including negative values provided // they are between -1456 and 1456 so the 16bit multiply does not overflow. unsigned char negflag; unsigned char tempdegree; unsigned char comp; unsigned int degree; // this will hold the result //signed int x; // these hold the XY vector at the start //signed int y; // (and they will be destroyed) unsigned int ux; unsigned int uy; // Save the sign flags then remove signs and get XY as unsigned ints negflag = 0; if(x < 0) { negflag += 0x01; // x flag bit x = (0 - x); // is now + } ux = x; // copy to unsigned var before multiply if(y < 0) { negflag += 0x02; // y flag bit y = (0 - y); // is now + } uy = y; // copy to unsigned var before multiply // 1. Calc the scaled "degrees" if(ux > uy) { degree = (uy * 45) / ux; // degree result will be 0-45 range negflag += 0x10; // octant flag bit } else { degree = (ux * 45) / uy; // degree result will be 0-45 range } // 2. Compensate for the 4 degree error curve comp = 0; tempdegree = degree; // use an unsigned char for speed! if(tempdegree > 22) { // if top half of range if(tempdegree <= 44) comp++; if(tempdegree <= 41) comp++; if(tempdegree <= 37) comp++; if(tempdegree <= 32) comp++; // max is 4 degrees compensated } else { // else is lower half of range if(tempdegree >= 2) comp++; if(tempdegree >= 6) comp++; if(tempdegree >= 10) comp++; if(tempdegree >= 15) comp++; // max is 4 degrees compensated } degree += comp; // degree is now accurate to +/- 1 degree! // Invert degree if it was X>Y octant, makes 0-45 into 90-45 if(negflag & 0x10) degree = (90 - degree); // 3. Degree is now 0-90 range for this quadrant, // need to invert it for whichever quadrant it was in if(negflag & 0x02) { // if -Y if(negflag & 0x01) // if -Y -X degree = (180 + degree); else // else is -Y +X degree = (180 - degree); } else { // else is +Y if(negflag & 0x01) // if +Y -X degree = (360 - degree); } return degree; } /** * Calculate the integer exponents. * @param base * @param power * @return base raised to the power exponent */ int64_t _lv_pow(int64_t base, int8_t exp) { int64_t result = 1; while(exp) { if(exp & 1) result *= base; exp >>= 1; base *= base; } return result; } /********************** * STATIC FUNCTIONS **********************/
7,266
lv_math
c
en
c
code
{"qsc_code_num_words": 1019, "qsc_code_num_chars": 7266.0, "qsc_code_mean_word_length": 3.87634936, "qsc_code_frac_words_unique": 0.34347399, "qsc_code_frac_chars_top_2grams": 0.03721519, "qsc_code_frac_chars_top_3grams": 0.01594937, "qsc_code_frac_chars_top_4grams": 0.01772152, "qsc_code_frac_chars_dupe_5grams": 0.17822785, "qsc_code_frac_chars_dupe_6grams": 0.16, "qsc_code_frac_chars_dupe_7grams": 0.11696203, "qsc_code_frac_chars_dupe_8grams": 0.10379747, "qsc_code_frac_chars_dupe_9grams": 0.07518987, "qsc_code_frac_chars_dupe_10grams": 0.01772152, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.14924517, "qsc_code_frac_chars_whitespace": 0.27979631, "qsc_code_size_file_byte": 7266.0, "qsc_code_num_lines": 237.0, "qsc_code_num_chars_line_max": 116.0, "qsc_code_num_chars_line_mean": 30.65822785, "qsc_code_frac_chars_alphabet": 0.60557997, "qsc_code_frac_chars_comments": 0.47619048, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.05660377, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00236469, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00814503, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.06603774, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.17924528, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": 0.03773585}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_KeyPad.cpp
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #include "ESP32Berry_KeyPad.h" static KeyPad *instance = NULL; constexpr char KeyPad::kPad[5][11]; constexpr char KeyPad::kSymbol[11]; KeyPad::KeyPad(FuncPtrChar callback) { instance = this; padTimer = 0; isReady = true; isShift = false; isCapsLock = false; released_cb = callback; } KeyPad::~KeyPad() { } int KeyPad::getKeyRow(int adc) { switch (adc) { case kMinValue[0]... kMaxValue[0]: return 0; break; case kMinValue[1]... kMaxValue[1]: return 1; break; case kMinValue[2]... kMaxValue[2]: return 2; break; case kMinValue[3]... kMaxValue[3]: return 3; break; case kMinValue[4]... kMaxValue[4]: return 4; break; case kMinValue[5]... kMaxValue[5]: return 5; break; case kMinValue[6]... kMaxValue[6]: return 6; break; case kMinValue[7]... kMaxValue[7]: return 7; break; case kMinValue[8]... kMaxValue[8]: return 8; break; case kMinValue[9]... kMaxValue[9]: return 9; break; case kMinValue[10]... kMaxValue[10]: return 10; break; default: return -1; break; } } void KeyPad::checkKeyInput() { if (isReady) { int sensorValue0 = analogRead(32); int sensorValue1 = analogRead(33); int sensorValue2 = analogRead(35); int sensorValue3 = analogRead(36); int sensorValue4 = analogRead(39); isShift = false; if (sensorValue4 != 4095) { int keyRowIdx = getKeyRow(sensorValue4); if (keyRowIdx != -1) { char key = KeyPad::kPad[4][keyRowIdx]; if (key == 16) { isShift = true; } else { blockInput(); released_cb(key); } } } if (sensorValue0 != 4095) { int keyRowIdx = getKeyRow(sensorValue0); if (keyRowIdx != -1) { blockInput(); char key = KeyPad::kPad[0][keyRowIdx]; if (key == 27) { released_cb(key); } else { if (isShift) { char symbol = KeyPad::kSymbol[keyRowIdx]; released_cb(symbol); } else { released_cb(key); } } } } if (sensorValue1 != 4095) { int keyRowIdx = getKeyRow(sensorValue1); if (keyRowIdx != -1) { blockInput(); char key = KeyPad::kPad[1][keyRowIdx]; if (key == 9) { released_cb(key); } else { if (isShift || isCapsLock) { released_cb(char(key - 32)); } else { released_cb(key); } } } } if (sensorValue2 != 4095) { int keyRowIdx = getKeyRow(sensorValue2); if (keyRowIdx != -1) { blockInput(); char key = KeyPad::kPad[2][keyRowIdx]; //Special Key if (key == 20) { isCapsLock = !isCapsLock; } else if (key == 8) { released_cb(key); } else { if (isShift || isCapsLock) { released_cb(char(key - 32)); } else { released_cb(key); } } } } if (sensorValue3 != 4095) { int keyRowIdx = getKeyRow(sensorValue3); if (keyRowIdx != -1) { blockInput(); char key = KeyPad::kPad[3][keyRowIdx]; if (key == 44 || key == 46 || key == 13) { released_cb(key); } else { if (isShift || isCapsLock) { released_cb(char(key - 32)); } else { released_cb(key); } } } } } if (!isReady && millis() - padTimer >= 200) { isReady = true; } } void KeyPad::blockInput() { isReady = false; padTimer = millis(); }
3,964
ESP32Berry_KeyPad
cpp
en
cpp
code
{"qsc_code_num_words": 382, "qsc_code_num_chars": 3964.0, "qsc_code_mean_word_length": 5.10994764, "qsc_code_frac_words_unique": 0.23560209, "qsc_code_frac_chars_top_2grams": 0.07172131, "qsc_code_frac_chars_top_3grams": 0.09221311, "qsc_code_frac_chars_top_4grams": 0.06403689, "qsc_code_frac_chars_dupe_5grams": 0.21670082, "qsc_code_frac_chars_dupe_6grams": 0.20696721, "qsc_code_frac_chars_dupe_7grams": 0.19364754, "qsc_code_frac_chars_dupe_8grams": 0.19364754, "qsc_code_frac_chars_dupe_9grams": 0.11372951, "qsc_code_frac_chars_dupe_10grams": 0.11372951, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.04874334, "qsc_code_frac_chars_whitespace": 0.33753784, "qsc_code_size_file_byte": 3964.0, "qsc_code_num_lines": 177.0, "qsc_code_num_chars_line_max": 66.0, "qsc_code_num_chars_line_mean": 22.39548023, "qsc_code_frac_chars_alphabet": 0.69459254, "qsc_code_frac_chars_comments": 0.0716448, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.33333333, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00516164, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codecpp_frac_lines_preprocessor_directives": 0.00666667, "qsc_codecpp_frac_lines_func_ratio": 0.0, "qsc_codecpp_cate_bitsstdc": 0.0, "qsc_codecpp_nums_lines_main": 0.0, "qsc_codecpp_frac_lines_goto": 0.0, "qsc_codecpp_cate_var_zero": 0.0, "qsc_codecpp_score_lines_no_logic": 0.08, "qsc_codecpp_frac_lines_print": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codecpp_frac_lines_func_ratio": 0, "qsc_codecpp_nums_lines_main": 0, "qsc_codecpp_score_lines_no_logic": 0, "qsc_codecpp_frac_lines_preprocessor_directives": 0, "qsc_codecpp_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_System.h
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #pragma once #include <vector> #include "ESP32Berry_Config.h" #include "esp32-hal.h" #include "lwip/apps/sntp.h" #include "esp_netif.h" #include "FS.h" #include "SD.h" #include "SPI.h" typedef enum { SYS_TIME, SYS_BATTERY, } System_Event_t; class System { private: long fetchTimer; long batteryTimer; String currentTime; bool requestedTimeUpdate; bool isSDCardAvailable; typedef void (*FuncPtrString)(System_Event_t, String); public: fs::FS &storage = SD; FuncPtrString system_event_cb; System(FuncPtrString callback); ~System(); void set_config_tz_time(); void update_local_time(); String get_local_time_for_msg(); bool init_SDCard(); bool is_SDcard_available(); std::vector<String> list_dir(const char *dirname); bool create_dir(const char *path); bool write_file(const char *path, const char *message); int read_file_size(const char *path); String read_file(const char *path); void sdcard_info(unsigned long *totalBytes, unsigned long *usedBytes); void read_battery(); void update(); void restart(); };
1,333
ESP32Berry_System
h
en
c
code
{"qsc_code_num_words": 166, "qsc_code_num_chars": 1333.0, "qsc_code_mean_word_length": 5.10843373, "qsc_code_frac_words_unique": 0.53012048, "qsc_code_frac_chars_top_2grams": 0.05660377, "qsc_code_frac_chars_top_3grams": 0.06132075, "qsc_code_frac_chars_top_4grams": 0.04009434, "qsc_code_frac_chars_dupe_5grams": 0.0, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.0078125, "qsc_code_frac_chars_whitespace": 0.13578395, "qsc_code_size_file_byte": 1333.0, "qsc_code_num_lines": 53.0, "qsc_code_num_chars_line_max": 73.0, "qsc_code_num_chars_line_mean": 25.1509434, "qsc_code_frac_chars_alphabet": 0.72829861, "qsc_code_frac_chars_comments": 0.20255064, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.06578947, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.31707317, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.58536585, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 1, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 1, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_AppESPNow.h
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #pragma once #include "ESP32Berry_Config.h" #include "ESP32Berry_AppBase.h" #include <esp_now.h> #include <esp_wifi.h> class AppESPNow : public AppBase { private: lv_obj_t *_bodyScreen; lv_obj_t *bottomPart; lv_obj_t *textField; lv_obj_t *sendBtn; lv_obj_t *msgList; lv_obj_t *myMacLabel; lv_obj_t *mboxConnect; lv_obj_t *mboxInput; lv_obj_t *mboxConnectBtn; lv_style_t msgStyle; esp_now_peer_info_t peerInfo; uint8_t peerMacAddr[6]; typedef struct struct_message { String id; String msg; } struct_message; struct_message received_message, send_message; void draw_ui(); void add_msg(bool isMine, String msg); void init_espnow(); void ui_espnow_conenct_box(); String get_string_mac(uint8_t addr[]); public: AppESPNow(Display *display, System *system, Network *network, const char *title); ~AppESPNow(); void esp_event_handler(lv_event_t *e); void esp_on_data_sent(const uint8_t *macAddr, esp_now_send_status_t status); void esp_on_data_receive(const uint8_t *macAddr, const uint8_t *incomingData, int len); void close_app(); };
1,359
ESP32Berry_AppESPNow
h
en
c
code
{"qsc_code_num_words": 187, "qsc_code_num_chars": 1359.0, "qsc_code_mean_word_length": 4.59358289, "qsc_code_frac_words_unique": 0.48663102, "qsc_code_frac_chars_top_2grams": 0.0523865, "qsc_code_frac_chars_top_3grams": 0.0628638, "qsc_code_frac_chars_top_4grams": 0.03026775, "qsc_code_frac_chars_dupe_5grams": 0.0, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01278772, "qsc_code_frac_chars_whitespace": 0.13686534, "qsc_code_size_file_byte": 1359.0, "qsc_code_num_lines": 46.0, "qsc_code_num_chars_line_max": 90.0, "qsc_code_num_chars_line_mean": 29.54347826, "qsc_code_frac_chars_alphabet": 0.71952259, "qsc_code_frac_chars_comments": 0.1986755, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.03577982, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.24324324, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.37837838, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 1, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_color.h
/** * @file lv_color.h * */ #ifndef LV_COLOR_H #define LV_COLOR_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #include "../lv_conf_internal.h" #include "lv_math.h" /*Error checking*/ #if LV_COLOR_DEPTH == 24 #error "LV_COLOR_DEPTH 24 is deprecated. Use LV_COLOR_DEPTH 32 instead (lv_conf.h)" #endif #if LV_COLOR_DEPTH != 32 && LV_COLOR_SCREEN_TRANSP != 0 #error "LV_COLOR_SCREEN_TRANSP requires LV_COLOR_DEPTH == 32. Set it in lv_conf.h" #endif #if LV_COLOR_DEPTH != 16 && LV_COLOR_16_SWAP != 0 #error "LV_COLOR_16_SWAP requires LV_COLOR_DEPTH == 16. Set it in lv_conf.h" #endif #include <stdint.h> /********************* * DEFINES *********************/ #define LV_COLOR_WHITE LV_COLOR_MAKE(0xFF, 0xFF, 0xFF) #define LV_COLOR_SILVER LV_COLOR_MAKE(0xC0, 0xC0, 0xC0) #define LV_COLOR_GRAY LV_COLOR_MAKE(0x80, 0x80, 0x80) #define LV_COLOR_BLACK LV_COLOR_MAKE(0x00, 0x00, 0x00) #define LV_COLOR_RED LV_COLOR_MAKE(0xFF, 0x00, 0x00) #define LV_COLOR_MAROON LV_COLOR_MAKE(0x80, 0x00, 0x00) #define LV_COLOR_YELLOW LV_COLOR_MAKE(0xFF, 0xFF, 0x00) #define LV_COLOR_OLIVE LV_COLOR_MAKE(0x80, 0x80, 0x00) #define LV_COLOR_LIME LV_COLOR_MAKE(0x00, 0xFF, 0x00) #define LV_COLOR_GREEN LV_COLOR_MAKE(0x00, 0x80, 0x00) #define LV_COLOR_CYAN LV_COLOR_MAKE(0x00, 0xFF, 0xFF) #define LV_COLOR_AQUA LV_COLOR_CYAN #define LV_COLOR_TEAL LV_COLOR_MAKE(0x00, 0x80, 0x80) #define LV_COLOR_BLUE LV_COLOR_MAKE(0x00, 0x00, 0xFF) #define LV_COLOR_NAVY LV_COLOR_MAKE(0x00, 0x00, 0x80) #define LV_COLOR_MAGENTA LV_COLOR_MAKE(0xFF, 0x00, 0xFF) #define LV_COLOR_PURPLE LV_COLOR_MAKE(0x80, 0x00, 0x80) #define LV_COLOR_ORANGE LV_COLOR_MAKE(0xFF, 0xA5, 0x00) /** * Opacity percentages. */ enum { LV_OPA_TRANSP = 0, LV_OPA_0 = 0, LV_OPA_10 = 25, LV_OPA_20 = 51, LV_OPA_30 = 76, LV_OPA_40 = 102, LV_OPA_50 = 127, LV_OPA_60 = 153, LV_OPA_70 = 178, LV_OPA_80 = 204, LV_OPA_90 = 229, LV_OPA_100 = 255, LV_OPA_COVER = 255, }; #define LV_OPA_MIN 2 /*Opacities below this will be transparent*/ #define LV_OPA_MAX 253 /*Opacities above this will fully cover*/ #if LV_COLOR_DEPTH == 1 #define LV_COLOR_SIZE 8 #elif LV_COLOR_DEPTH == 8 #define LV_COLOR_SIZE 8 #elif LV_COLOR_DEPTH == 16 #define LV_COLOR_SIZE 16 #elif LV_COLOR_DEPTH == 32 #define LV_COLOR_SIZE 32 #else #error "Invalid LV_COLOR_DEPTH in lv_conf.h! Set it to 1, 8, 16 or 32!" #endif /* Adjust color mix functions rounding. * GPUs might calculate color mix (blending) differently. * Should be in range of 0..254 * 0: no adjustment, get the integer part of the result (round down) * 64: round up from x.75 * 128: round up from half * 192: round up from x.25 * 254: round up */ #ifndef LV_COLOR_MIX_ROUND_OFS #if LV_COLOR_DEPTH == 32 #define LV_COLOR_MIX_ROUND_OFS 0 #else #define LV_COLOR_MIX_ROUND_OFS 128 #endif #endif /*--------------------------------------- * Macros for all existing color depths * to set/get values of the color channels *------------------------------------------*/ # define LV_COLOR_SET_R1(c, v) (c).ch.red = (uint8_t)((v) & 0x1); # define LV_COLOR_SET_G1(c, v) (c).ch.green = (uint8_t)((v) & 0x1); # define LV_COLOR_SET_B1(c, v) (c).ch.blue = (uint8_t)((v) & 0x1); # define LV_COLOR_SET_A1(c, v) # define LV_COLOR_GET_R1(c) (c).ch.red # define LV_COLOR_GET_G1(c) (c).ch.green # define LV_COLOR_GET_B1(c) (c).ch.blue # define LV_COLOR_GET_A1(c) 1 # define LV_COLOR_SET_R8(c, v) (c).ch.red = (uint8_t)(v) & 0x7U; # define LV_COLOR_SET_G8(c, v) (c).ch.green = (uint8_t)(v) & 0x7U; # define LV_COLOR_SET_B8(c, v) (c).ch.blue = (uint8_t)(v) & 0x3U; # define LV_COLOR_SET_A8(c, v) do {} while(0) # define LV_COLOR_GET_R8(c) (c).ch.red # define LV_COLOR_GET_G8(c) (c).ch.green # define LV_COLOR_GET_B8(c) (c).ch.blue # define LV_COLOR_GET_A8(c) 0xFF # define LV_COLOR_SET_R16(c, v) (c).ch.red = (uint8_t)(v) & 0x1FU; # define LV_COLOR_SET_G16(c, v) (c).ch.green = (uint8_t)(v) & 0x3FU; # define LV_COLOR_SET_G16_SWAP(c, v) {(c).ch.green_h = (uint8_t)(((v) >> 3) & 0x7); (c).ch.green_l = (uint8_t)((v) & 0x7);} # define LV_COLOR_SET_B16(c, v) (c).ch.blue = (uint8_t)(v) & 0x1FU; # define LV_COLOR_SET_A16(c, v) do {} while(0) # define LV_COLOR_GET_R16(c) (c).ch.red # define LV_COLOR_GET_G16(c) (c).ch.green # define LV_COLOR_GET_G16_SWAP(c) (((c).ch.green_h << 3) + (c).ch.green_l) # define LV_COLOR_GET_B16(c) (c).ch.blue # define LV_COLOR_GET_A16(c) 0xFF # define LV_COLOR_SET_R32(c, v) (c).ch.red = (uint32_t)((v) & 0xFF); # define LV_COLOR_SET_G32(c, v) (c).ch.green = (uint32_t)((v) & 0xFF); # define LV_COLOR_SET_B32(c, v) (c).ch.blue = (uint32_t)((v) & 0xFF); # define LV_COLOR_SET_A32(c, v) (c).ch.alpha = (uint32_t)((v) & 0xFF); # define LV_COLOR_GET_R32(c) (c).ch.red # define LV_COLOR_GET_G32(c) (c).ch.green # define LV_COLOR_GET_B32(c) (c).ch.blue # define LV_COLOR_GET_A32(c) (c).ch.alpha /*--------------------------------------- * Macros for the current color depth * to set/get values of the color channels *------------------------------------------*/ #if LV_COLOR_DEPTH == 1 # define LV_COLOR_SET_R(c, v) LV_COLOR_SET_R1(c,v) # define LV_COLOR_SET_G(c, v) LV_COLOR_SET_G1(c,v) # define LV_COLOR_SET_B(c, v) LV_COLOR_SET_B1(c,v) # define LV_COLOR_SET_A(c, v) LV_COLOR_SET_A1(c,v) # define LV_COLOR_GET_R(c) LV_COLOR_GET_R1(c) # define LV_COLOR_GET_G(c) LV_COLOR_GET_G1(c) # define LV_COLOR_GET_B(c) LV_COLOR_GET_B1(c) # define LV_COLOR_GET_A(c) LV_COLOR_GET_A1(c) #elif LV_COLOR_DEPTH == 8 # define LV_COLOR_SET_R(c, v) LV_COLOR_SET_R8(c,v) # define LV_COLOR_SET_G(c, v) LV_COLOR_SET_G8(c,v) # define LV_COLOR_SET_B(c, v) LV_COLOR_SET_B8(c,v) # define LV_COLOR_SET_A(c, v) LV_COLOR_SET_A8(c,v) # define LV_COLOR_GET_R(c) LV_COLOR_GET_R8(c) # define LV_COLOR_GET_G(c) LV_COLOR_GET_G8(c) # define LV_COLOR_GET_B(c) LV_COLOR_GET_B8(c) # define LV_COLOR_GET_A(c) LV_COLOR_GET_A8(c) #elif LV_COLOR_DEPTH == 16 # define LV_COLOR_SET_R(c, v) LV_COLOR_SET_R16(c,v) # if LV_COLOR_16_SWAP == 0 # define LV_COLOR_SET_G(c, v) LV_COLOR_SET_G16(c,v) # else # define LV_COLOR_SET_G(c, v) LV_COLOR_SET_G16_SWAP(c,v) # endif # define LV_COLOR_SET_B(c, v) LV_COLOR_SET_B16(c,v) # define LV_COLOR_SET_A(c, v) LV_COLOR_SET_A16(c,v) # define LV_COLOR_GET_R(c) LV_COLOR_GET_R16(c) # if LV_COLOR_16_SWAP == 0 # define LV_COLOR_GET_G(c) LV_COLOR_GET_G16(c) # else # define LV_COLOR_GET_G(c) LV_COLOR_GET_G16_SWAP(c) # endif # define LV_COLOR_GET_B(c) LV_COLOR_GET_B16(c) # define LV_COLOR_GET_A(c) LV_COLOR_GET_A16(c) #elif LV_COLOR_DEPTH == 32 # define LV_COLOR_SET_R(c, v) LV_COLOR_SET_R32(c,v) # define LV_COLOR_SET_G(c, v) LV_COLOR_SET_G32(c,v) # define LV_COLOR_SET_B(c, v) LV_COLOR_SET_B32(c,v) # define LV_COLOR_SET_A(c, v) LV_COLOR_SET_A32(c,v) # define LV_COLOR_GET_R(c) LV_COLOR_GET_R32(c) # define LV_COLOR_GET_G(c) LV_COLOR_GET_G32(c) # define LV_COLOR_GET_B(c) LV_COLOR_GET_B32(c) # define LV_COLOR_GET_A(c) LV_COLOR_GET_A32(c) #endif /********************** * TYPEDEFS **********************/ typedef union { union { uint8_t blue : 1; uint8_t green : 1; uint8_t red : 1; } ch; uint8_t full; } lv_color1_t; typedef union { struct { uint8_t blue : 2; uint8_t green : 3; uint8_t red : 3; } ch; uint8_t full; } lv_color8_t; typedef union { struct { #if LV_COLOR_16_SWAP == 0 uint16_t blue : 5; uint16_t green : 6; uint16_t red : 5; #else uint16_t green_h : 3; uint16_t red : 5; uint16_t blue : 5; uint16_t green_l : 3; #endif } ch; uint16_t full; } lv_color16_t; typedef union { struct { uint8_t blue; uint8_t green; uint8_t red; uint8_t alpha; } ch; uint32_t full; } lv_color32_t; #if LV_COLOR_DEPTH == 1 typedef uint8_t lv_color_int_t; typedef lv_color1_t lv_color_t; #elif LV_COLOR_DEPTH == 8 typedef uint8_t lv_color_int_t; typedef lv_color8_t lv_color_t; #elif LV_COLOR_DEPTH == 16 typedef uint16_t lv_color_int_t; typedef lv_color16_t lv_color_t; #elif LV_COLOR_DEPTH == 32 typedef uint32_t lv_color_int_t; typedef lv_color32_t lv_color_t; #else #error "Invalid LV_COLOR_DEPTH in lv_conf.h! Set it to 1, 8, 16 or 32!" #endif typedef struct { uint16_t h; uint8_t s; uint8_t v; } lv_color_hsv_t; //! @cond Doxygen_Suppress /*No idea where the guard is required but else throws warnings in the docs*/ typedef uint8_t lv_opa_t; //! @endcond /********************** * GLOBAL PROTOTYPES **********************/ /*In color conversations: * - When converting to bigger color type the LSB weight of 1 LSB is calculated * E.g. 16 bit Red has 5 bits * 8 bit Red has 2 bits * ---------------------- * 8 bit red LSB = (2^5 - 1) / (2^2 - 1) = 31 / 3 = 10 * * - When calculating to smaller color type simply shift out the LSBs * E.g. 8 bit Red has 2 bits * 16 bit Red has 5 bits * ---------------------- * Shift right with 5 - 3 = 2 */ static inline uint8_t lv_color_to1(lv_color_t color) { #if LV_COLOR_DEPTH == 1 return color.full; #elif LV_COLOR_DEPTH == 8 if((LV_COLOR_GET_R(color) & 0x4) || (LV_COLOR_GET_G(color) & 0x4) || (LV_COLOR_GET_B(color) & 0x2)) { return 1; } else { return 0; } #elif LV_COLOR_DEPTH == 16 if((LV_COLOR_GET_R(color) & 0x10) || (LV_COLOR_GET_G(color) & 0x20) || (LV_COLOR_GET_B(color) & 0x10)) { return 1; } else { return 0; } #elif LV_COLOR_DEPTH == 32 if((LV_COLOR_GET_R(color) & 0x80) || (LV_COLOR_GET_G(color) & 0x80) || (LV_COLOR_GET_B(color) & 0x80)) { return 1; } else { return 0; } #endif } static inline uint8_t lv_color_to8(lv_color_t color) { #if LV_COLOR_DEPTH == 1 if(color.full == 0) return 0; else return 0xFF; #elif LV_COLOR_DEPTH == 8 return color.full; #elif LV_COLOR_DEPTH == 16 lv_color8_t ret; LV_COLOR_SET_R8(ret, LV_COLOR_GET_R(color) >> 2); /* 5 - 3 = 2*/ LV_COLOR_SET_G8(ret, LV_COLOR_GET_G(color) >> 3); /* 6 - 3 = 3*/ LV_COLOR_SET_B8(ret, LV_COLOR_GET_B(color) >> 3); /* 5 - 2 = 3*/ return ret.full; #elif LV_COLOR_DEPTH == 32 lv_color8_t ret; LV_COLOR_SET_R8(ret, LV_COLOR_GET_R(color) >> 5); /* 8 - 3 = 5*/ LV_COLOR_SET_G8(ret, LV_COLOR_GET_G(color) >> 5); /* 8 - 3 = 5*/ LV_COLOR_SET_B8(ret, LV_COLOR_GET_B(color) >> 6); /* 8 - 2 = 6*/ return ret.full; #endif } static inline uint16_t lv_color_to16(lv_color_t color) { #if LV_COLOR_DEPTH == 1 if(color.full == 0) return 0; else return 0xFFFF; #elif LV_COLOR_DEPTH == 8 lv_color16_t ret; LV_COLOR_SET_R16(ret, LV_COLOR_GET_R(color) * 4); /*(2^5 - 1)/(2^3 - 1) = 31/7 = 4*/ #if LV_COLOR_16_SWAP == 0 LV_COLOR_SET_G16(ret, LV_COLOR_GET_G(color) * 9); /*(2^6 - 1)/(2^3 - 1) = 63/7 = 9*/ #else LV_COLOR_SET_G16_SWAP(ret, (LV_COLOR_GET_G(color) * 9)); /*(2^6 - 1)/(2^3 - 1) = 63/7 = 9*/ #endif LV_COLOR_SET_B16(ret, LV_COLOR_GET_B(color) * 10); /*(2^5 - 1)/(2^2 - 1) = 31/3 = 10*/ return ret.full; #elif LV_COLOR_DEPTH == 16 return color.full; #elif LV_COLOR_DEPTH == 32 lv_color16_t ret; LV_COLOR_SET_R16(ret, LV_COLOR_GET_R(color) >> 3); /* 8 - 5 = 3*/ #if LV_COLOR_16_SWAP == 0 LV_COLOR_SET_G16(ret, LV_COLOR_GET_G(color) >> 2); /* 8 - 6 = 2*/ #else LV_COLOR_SET_G16_SWAP(ret, ret.ch.green_h = (LV_COLOR_GET_G(color) >> 2); /*(2^6 - 1)/(2^3 - 1) = 63/7 = 9*/ #endif LV_COLOR_SET_B16(ret, LV_COLOR_GET_B(color) >> 3); /* 8 - 5 = 3*/ return ret.full; #endif } static inline uint32_t lv_color_to32(lv_color_t color) { #if LV_COLOR_DEPTH == 1 if(color.full == 0) return 0xFF000000; else return 0xFFFFFFFF; #elif LV_COLOR_DEPTH == 8 lv_color32_t ret; LV_COLOR_SET_R32(ret, LV_COLOR_GET_R(color) * 36); /*(2^8 - 1)/(2^3 - 1) = 255/7 = 36*/ LV_COLOR_SET_G32(ret, LV_COLOR_GET_G(color) * 36); /*(2^8 - 1)/(2^3 - 1) = 255/7 = 36*/ LV_COLOR_SET_B32(ret, LV_COLOR_GET_B(color) * 85); /*(2^8 - 1)/(2^2 - 1) = 255/3 = 85*/ LV_COLOR_SET_A32(ret, 0xFF); return ret.full; #elif LV_COLOR_DEPTH == 16 /** * The floating point math for conversion is: * valueto = valuefrom * ( (2^bitsto - 1) / (float)(2^bitsfrom - 1) ) * The faster integer math for conversion is: * valueto = ( valuefrom * multiplier + adder ) >> divisor * multiplier = FLOOR( ( (2^bitsto - 1) << divisor ) / (float)(2^bitsfrom - 1) ) * * Find the first divisor where ( adder >> divisor ) <= 0 * * 5-bit to 8-bit: ( 31 * multiplier + adder ) >> divisor = 255 * divisor multiplier adder min (0) max (31) * 0 8 7 7 255 * 1 16 14 7 255 * 2 32 28 7 255 * 3 65 25 3 255 * 4 131 19 1 255 * 5 263 7 0 255 * * 6-bit to 8-bit: 255 = ( 63 * multiplier + adder ) >> divisor * divisor multiplier adder min (0) max (63) * 0 4 3 3 255 * 1 8 6 3 255 * 2 16 12 3 255 * 3 32 24 3 255 * 4 64 48 3 255 * 5 129 33 1 255 * 6 259 3 0 255 */ lv_color32_t ret; LV_COLOR_SET_R32(ret, (LV_COLOR_GET_R(color) * 263 + 7) >> 5); LV_COLOR_SET_G32(ret, (LV_COLOR_GET_G(color) * 259 + 3) >> 6); LV_COLOR_SET_B32(ret, (LV_COLOR_GET_B(color) * 263 + 7) >> 5); LV_COLOR_SET_A32(ret, 0xFF); return ret.full; #elif LV_COLOR_DEPTH == 32 return color.full; #endif } //! @cond Doxygen_Suppress /** * Mix two colors with a given ratio. * @param c1 the first color to mix (usually the foreground) * @param c2 the second color to mix (usually the background) * @param mix The ratio of the colors. 0: full `c2`, 255: full `c1`, 127: half `c1` and half`c2` * @return the mixed color */ LV_ATTRIBUTE_FAST_MEM static inline lv_color_t lv_color_mix(lv_color_t c1, lv_color_t c2, uint8_t mix) { lv_color_t ret; #if LV_COLOR_DEPTH != 1 /*LV_COLOR_DEPTH == 8, 16 or 32*/ LV_COLOR_SET_R(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_R(c1) * mix + LV_COLOR_GET_R(c2) * (255 - mix) + LV_COLOR_MIX_ROUND_OFS)); LV_COLOR_SET_G(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_G(c1) * mix + LV_COLOR_GET_G(c2) * (255 - mix) + LV_COLOR_MIX_ROUND_OFS)); LV_COLOR_SET_B(ret, LV_MATH_UDIV255((uint16_t) LV_COLOR_GET_B(c1) * mix + LV_COLOR_GET_B(c2) * (255 - mix) + LV_COLOR_MIX_ROUND_OFS)); LV_COLOR_SET_A(ret, 0xFF); #else /*LV_COLOR_DEPTH == 1*/ ret.full = mix > LV_OPA_50 ? c1.full : c2.full; #endif return ret; } LV_ATTRIBUTE_FAST_MEM static inline void lv_color_premult(lv_color_t c, uint8_t mix, uint16_t * out) { #if LV_COLOR_DEPTH != 1 out[0] = (uint16_t) LV_COLOR_GET_R(c) * mix; out[1] = (uint16_t) LV_COLOR_GET_G(c) * mix; out[2] = (uint16_t) LV_COLOR_GET_B(c) * mix; #else (void) mix; /*Pre-multiplication can't be used with 1 bpp*/ out[0] = LV_COLOR_GET_R(c); out[1] = LV_COLOR_GET_G(c); out[2] = LV_COLOR_GET_B(c); #endif } /** * Mix two colors with a given ratio. It runs faster then `lv_color_mix` but requires some pre computation. * @param c1 The first color. Should be preprocessed with `lv_color_premult(c1)` * @param c2 The second color. As it is no pre computation required on it * @param mix The ratio of the colors. 0: full `c2`, 255: full `c1`, 127: half `c1` and half `c2`. * Should be modified like mix = `255 - mix` * @return the mixed color * @note 255 won't give clearly `c1`. */ LV_ATTRIBUTE_FAST_MEM static inline lv_color_t lv_color_mix_premult(uint16_t * premult_c1, lv_color_t c2, uint8_t mix) { lv_color_t ret; #if LV_COLOR_DEPTH != 1 /*LV_COLOR_DEPTH == 8, 16 or 32*/ LV_COLOR_SET_R(ret, LV_MATH_UDIV255((uint16_t) premult_c1[0] + LV_COLOR_GET_R(c2) * mix + LV_COLOR_MIX_ROUND_OFS)); LV_COLOR_SET_G(ret, LV_MATH_UDIV255((uint16_t) premult_c1[1] + LV_COLOR_GET_G(c2) * mix + LV_COLOR_MIX_ROUND_OFS)); LV_COLOR_SET_B(ret, LV_MATH_UDIV255((uint16_t) premult_c1[2] + LV_COLOR_GET_B(c2) * mix + LV_COLOR_MIX_ROUND_OFS)); LV_COLOR_SET_A(ret, 0xFF); #else /*LV_COLOR_DEPTH == 1*/ /*Restore color1*/ lv_color_t c1; LV_COLOR_SET_R(c1, premult_c1[0]); LV_COLOR_SET_G(c1, premult_c1[1]); LV_COLOR_SET_B(c1, premult_c1[2]); ret.full = mix > LV_OPA_50 ? c1.full : c2.full; #endif return ret; } /** * Mix two colors. Both color can have alpha value. It requires ARGB888 colors. * @param bg_color background color * @param bg_opa alpha of the background color * @param fg_color foreground color * @param fg_opa alpha of the foreground color * @param res_color the result color * @param res_opa the result opacity */ LV_ATTRIBUTE_FAST_MEM static inline void lv_color_mix_with_alpha(lv_color_t bg_color, lv_opa_t bg_opa, lv_color_t fg_color, lv_opa_t fg_opa, lv_color_t * res_color, lv_opa_t * res_opa) { /* Pick the foreground if it's fully opaque or the Background is fully transparent*/ if(fg_opa >= LV_OPA_MAX || bg_opa <= LV_OPA_MIN) { res_color->full = fg_color.full; *res_opa = fg_opa; } /*Transparent foreground: use the Background*/ else if(fg_opa <= LV_OPA_MIN) { res_color->full = bg_color.full; *res_opa = bg_opa; } /*Opaque background: use simple mix*/ else if(bg_opa >= LV_OPA_MAX) { *res_color = lv_color_mix(fg_color, bg_color, fg_opa); *res_opa = LV_OPA_COVER; } /*Both colors have alpha. Expensive calculation need to be applied*/ else { /*Save the parameters and the result. If they will be asked again don't compute again*/ static lv_opa_t fg_opa_save = 0; static lv_opa_t bg_opa_save = 0; static lv_color_t fg_color_save = {.full = 0}; static lv_color_t bg_color_save = {.full = 0}; static lv_color_t res_color_saved = {.full = 0}; static lv_opa_t res_opa_saved = 0; if(fg_opa != fg_opa_save || bg_opa != bg_opa_save || fg_color.full != fg_color_save.full || bg_color.full != bg_color_save.full) { fg_opa_save = fg_opa; bg_opa_save = bg_opa; fg_color_save.full = fg_color.full; bg_color_save.full = bg_color.full; /*Info: * https://en.wikipedia.org/wiki/Alpha_compositing#Analytical_derivation_of_the_over_operator*/ res_opa_saved = 255 - ((uint16_t)((uint16_t)(255 - fg_opa) * (255 - bg_opa)) >> 8); if(res_opa_saved == 0) { while(1) ; } lv_opa_t ratio = (uint16_t)((uint16_t)fg_opa * 255) / res_opa_saved; res_color_saved = lv_color_mix(fg_color, bg_color, ratio); } res_color->full = res_color_saved.full; *res_opa = res_opa_saved; } } //! @endcond /** * Get the brightness of a color * @param color a color * @return the brightness [0..255] */ static inline uint8_t lv_color_brightness(lv_color_t color) { lv_color32_t c32; c32.full = lv_color_to32(color); uint16_t bright = (uint16_t)(3u * LV_COLOR_GET_R32(c32) + LV_COLOR_GET_B32(c32) + 4u * LV_COLOR_GET_G32(c32)); return (uint8_t)(bright >> 3); } #ifdef __cplusplus /* Fix of msvc 2019 compiler error C4576 inside C++ code */ #define _LV_COLOR_MAKE_TYPE_HELPER lv_color_t #else #define _LV_COLOR_MAKE_TYPE_HELPER (lv_color_t) #endif /* The most simple macro to create a color from R,G and B values */ #if LV_COLOR_DEPTH == 1 #define LV_COLOR_MAKE(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{.full = (uint8_t)((b8 >> 7) | (g8 >> 7) | (r8 >> 7))}) #elif LV_COLOR_DEPTH == 8 #define LV_COLOR_MAKE(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{(uint8_t)((b8 >> 6) & 0x3U), (uint8_t)((g8 >> 5) & 0x7U), (uint8_t)((r8 >> 5) & 0x7U)}}) #elif LV_COLOR_DEPTH == 16 #if LV_COLOR_16_SWAP == 0 #define LV_COLOR_MAKE(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{(uint16_t)((b8 >> 3) & 0x1FU), (uint16_t)((g8 >> 2) & 0x3FU), (uint16_t)((r8 >> 3) & 0x1FU)}}) #else #define LV_COLOR_MAKE(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{(uint16_t)((g8 >> 5) & 0x7U), (uint16_t)((r8 >> 3) & 0x1FU), (uint16_t)((b8 >> 3) & 0x1FU), (uint16_t)((g8 >> 2) & 0x7U)}}) #endif #elif LV_COLOR_DEPTH == 32 #define LV_COLOR_MAKE(r8, g8, b8) (_LV_COLOR_MAKE_TYPE_HELPER{{b8, g8, r8, 0xff}}) /*Fix 0xff alpha*/ #endif static inline lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b) { return LV_COLOR_MAKE(r, g, b); } static inline lv_color_t lv_color_hex(uint32_t c) { return lv_color_make((uint8_t)((c >> 16) & 0xFF), (uint8_t)((c >> 8) & 0xFF), (uint8_t)(c & 0xFF)); } static inline lv_color_t lv_color_hex3(uint32_t c) { return lv_color_make((uint8_t)(((c >> 4) & 0xF0) | ((c >> 8) & 0xF)), (uint8_t)((c & 0xF0) | ((c & 0xF0) >> 4)), (uint8_t)((c & 0xF) | ((c & 0xF) << 4))); } //! @cond Doxygen_Suppress //! LV_ATTRIBUTE_FAST_MEM void lv_color_fill(lv_color_t * buf, lv_color_t color, uint32_t px_num); //! @endcond lv_color_t lv_color_lighten(lv_color_t c, lv_opa_t lvl); lv_color_t lv_color_darken(lv_color_t c, lv_opa_t lvl); /** * Convert a HSV color to RGB * @param h hue [0..359] * @param s saturation [0..100] * @param v value [0..100] * @return the given RGB color in RGB (with LV_COLOR_DEPTH depth) */ lv_color_t lv_color_hsv_to_rgb(uint16_t h, uint8_t s, uint8_t v); /** * Convert a 32-bit RGB color to HSV * @param r8 8-bit red * @param g8 8-bit green * @param b8 8-bit blue * @return the given RGB color in HSV */ lv_color_hsv_t lv_color_rgb_to_hsv(uint8_t r8, uint8_t g8, uint8_t b8); /** * Convert a color to HSV * @param color color * @return the given color in HSV */ lv_color_hsv_t lv_color_to_hsv(lv_color_t color); /********************** * MACROS **********************/ #ifdef __cplusplus } /* extern "C" */ #endif #endif /*USE_COLOR*/
22,585
lv_color
h
en
c
code
{"qsc_code_num_words": 3931, "qsc_code_num_chars": 22585.0, "qsc_code_mean_word_length": 3.28847621, "qsc_code_frac_words_unique": 0.0969219, "qsc_code_frac_chars_top_2grams": 0.20360486, "qsc_code_frac_chars_top_3grams": 0.10056471, "qsc_code_frac_chars_top_4grams": 0.04208246, "qsc_code_frac_chars_dupe_5grams": 0.64036513, "qsc_code_frac_chars_dupe_6grams": 0.52169877, "qsc_code_frac_chars_dupe_7grams": 0.45579021, "qsc_code_frac_chars_dupe_8grams": 0.40690029, "qsc_code_frac_chars_dupe_9grams": 0.31113174, "qsc_code_frac_chars_dupe_10grams": 0.25659472, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.0759291, "qsc_code_frac_chars_whitespace": 0.22559221, "qsc_code_size_file_byte": 22585.0, "qsc_code_num_lines": 681.0, "qsc_code_num_chars_line_max": 187.0, "qsc_code_num_chars_line_mean": 33.16446402, "qsc_code_frac_chars_alphabet": 0.66317896, "qsc_code_frac_chars_comments": 0.26526456, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.33924612, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.02235748, "qsc_code_frac_chars_long_word_length": 0.0025913, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.02163433, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.2594235, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.29711752, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 1, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 1, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_utils.c
/** * @file lv_utils.c * */ /********************* * INCLUDES *********************/ #include <stdbool.h> #include "lv_utils.h" #include "lv_math.h" #include "lv_printf.h" #include "lv_txt.h" /********************* * DEFINES *********************/ /********************** * TYPEDEFS **********************/ /********************** * STATIC PROTOTYPES **********************/ /********************** * STATIC VARIABLES **********************/ /********************** * MACROS **********************/ /********************** * GLOBAL FUNCTIONS **********************/ /** * Convert a number to string * @param num a number * @param buf pointer to a `char` buffer. The result will be stored here (max 10 elements) * @return same as `buf` (just for convenience) */ char * _lv_utils_num_to_str(int32_t num, char * buf) { if(num == 0) { buf[0] = '0'; buf[1] = '\0'; return buf; } int8_t digitCount = 0; int8_t i = 0; if(num < 0) { buf[digitCount++] = '-'; num = LV_MATH_ABS(num); ++i; } while(num) { char digit = num % 10; buf[digitCount++] = digit + 48; num /= 10; } buf[digitCount] = '\0'; digitCount--; while(digitCount > i) { char temp = buf[i]; buf[i] = buf[digitCount]; buf[digitCount] = temp; digitCount--; i++; } return buf; } /** Searches base[0] to base[n - 1] for an item that matches *key. * * @note The function cmp must return negative if its first * argument (the search key) is less that its second (a table entry), * zero if equal, and positive if greater. * * @note Items in the array must be in ascending order. * * @param key Pointer to item being searched for * @param base Pointer to first element to search * @param n Number of elements * @param size Size of each element * @param cmp Pointer to comparison function (see #lv_font_codeCompare as a comparison function * example) * * @return a pointer to a matching item, or NULL if none exists. */ void * _lv_utils_bsearch(const void * key, const void * base, uint32_t n, uint32_t size, int32_t (*cmp)(const void * pRef, const void * pElement)) { const char * middle; int32_t c; for(middle = base; n != 0;) { middle += (n / 2) * size; if((c = (*cmp)(key, middle)) > 0) { n = (n / 2) - ((n & 1) == 0); base = (middle += size); } else if(c < 0) { n /= 2; middle = base; } else { return (char *)middle; } } return NULL; } /********************** * STATIC FUNCTIONS **********************/
2,821
lv_utils
c
en
c
code
{"qsc_code_num_words": 317, "qsc_code_num_chars": 2821.0, "qsc_code_mean_word_length": 4.04731861, "qsc_code_frac_words_unique": 0.3659306, "qsc_code_frac_chars_top_2grams": 0.03507405, "qsc_code_frac_chars_top_3grams": 0.03117693, "qsc_code_frac_chars_top_4grams": 0.01402962, "qsc_code_frac_chars_dupe_5grams": 0.0, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01979695, "qsc_code_frac_chars_whitespace": 0.30166608, "qsc_code_size_file_byte": 2821.0, "qsc_code_num_lines": 119.0, "qsc_code_num_chars_line_max": 99.0, "qsc_code_num_chars_line_mean": 23.70588235, "qsc_code_frac_chars_alphabet": 0.63147208, "qsc_code_frac_chars_comments": 0.50655796, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.07142857, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0316092, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.05357143, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.19642857, "qsc_codec_frac_lines_print": 0.01785714, "qsc_codec_frac_lines_preprocessor_directives": 0.08928571}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
00jacs/sveltekit-ultrafast
src/routes/docs/components/input-number/+page.svelte
<script lang="ts"> import { InputNumber } from '$lib/components'; import { DocsPage, DocsCode, DocsNote, DocsPreview } from '$lib/components/page/docs'; </script> <DocsPage title="InputNumber"> <p class="mb-6">To use the Number Input component, import it from '$lib/components'.</p> <DocsCode class="mb-8" language="typescript" code={`import { InputNumber } from '$lib/components';`} /> <p class="mb-4">Then, use it in your Svelte template:</p> <DocsCode class="mb-8" language="html" code={` <InputNumber id="number1" name="exampleNumber" placeholder="Enter a number" value={10} label="Number Input" labelHint="Hint text" min={0} max={100} /> <InputNumber id="number2" name="exampleNumber2" placeholder="Another number" value={20} label="Another Input" labelHint="Another hint" disabled={true} /> `} /> <DocsPreview class="mb-8"> <div class="flex flex-col gap-4"> <InputNumber id="number1" name="exampleNumber" placeholder="Enter a number" value={10} label="Number Input" labelHint="Hint text" min={0} max={100} /> <InputNumber id="number2" name="exampleNumber2" placeholder="Another number" value={20} label="Another Input" labelHint="Another hint" disabled={true} /> </div> </DocsPreview> <p class="mb-8"> The Number Input component is a simple Svelte component that accepts several props: </p> <DocsCode class="mb-8" language="typescript" code={` id: string | undefined = undefined; name: string | undefined = undefined; placeholder: string | undefined = undefined; value: number = 0; disabled: boolean = false; required: boolean = true; min: number = 0; max: number = 10000; label: string | undefined = undefined; labelHint: string | undefined = undefined; containerClass: string = ''; labelContainerClass: string = ''; labelClass: string = ''; labelHintClass: string = ''; inputClass: string = ''; `} /> <p class="mb-8"> The Number Input component is based on <a href="https://daisyui.com/components/input/" class="link link-primary" target="_blank"> DaisyUI input </a> so for more customization options, you can refer to their documentation. </p> </DocsPage>
2,260
+page
svelte
en
svelte
code
{"qsc_code_num_words": 270, "qsc_code_num_chars": 2260.0, "qsc_code_mean_word_length": 5.51851852, "qsc_code_frac_words_unique": 0.37407407, "qsc_code_frac_chars_top_2grams": 0.03758389, "qsc_code_frac_chars_top_3grams": 0.03221477, "qsc_code_frac_chars_top_4grams": 0.04630872, "qsc_code_frac_chars_dupe_5grams": 0.46644295, "qsc_code_frac_chars_dupe_6grams": 0.42080537, "qsc_code_frac_chars_dupe_7grams": 0.40402685, "qsc_code_frac_chars_dupe_8grams": 0.40402685, "qsc_code_frac_chars_dupe_9grams": 0.35167785, "qsc_code_frac_chars_dupe_10grams": 0.30604027, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.02078775, "qsc_code_frac_chars_whitespace": 0.19115044, "qsc_code_size_file_byte": 2260.0, "qsc_code_num_lines": 102.0, "qsc_code_num_chars_line_max": 90.0, "qsc_code_num_chars_line_mean": 22.15686275, "qsc_code_frac_chars_alphabet": 0.79431072, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.53333333, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.19823009, "qsc_code_frac_chars_long_word_length": 0.01106195, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
00jacs/sveltekit-ultrafast
src/routes/docs/components/dialog/+page.svelte
<script lang="ts"> import { Button, Dialog } from '$lib/components'; import { DocsPage, DocsCode, DocsPreview } from '$lib/components/page/docs'; let showDangerDialog = false; let showSuccessDialog = false; </script> <DocsPage title="Dialog"> <p class="mb-6"> In order to use <code>Dialog</code> (or any other of the 'common' components), you can import it from '$lib/components'. </p> <DocsCode class="mb-8" language="typescript" code={`import { Dialog } from '$lib/components';`} /> <p class="mb-4">And then use it in your Svelte template:</p> <DocsCode class="mb-8" language="svelte" code={` {#if showDialog} <Dialog type="danger" title="Danger" message="This is a danger dialog" submitText="Proceed" cancelText="Cancel" on:submit={() => { console.log('Proceed'); }} on:cancel={() => { console.log('Cancelled'); }} /> {/if} `} /> <DocsPreview class="mb-8"> <div class="flex flex-wrap gap-2"> <Button class="btn-outline border-base-200" on:click={() => (showDangerDialog = !showDangerDialog)}> Show "danger" dialog </Button> <Button class="btn-outline border-base-200" on:click={() => (showSuccessDialog = !showSuccessDialog)}> Show "success" dialog </Button> {#if showDangerDialog} <Dialog type="danger" title="Danger dialog..." message="This is a danger dialog. You're trying to remove something very important. Are you sure about this? This cannot be undone." submitText="Proceed" cancelText="Cancel" on:submit={() => { console.log('Proceed'); showDangerDialog = false; }} on:cancel={() => { console.log('Cancelled'); showDangerDialog = false; }} /> {/if} {#if showSuccessDialog} <Dialog type="success" title="Success" message="This is a success dialog. Congratulations that you've managed to get there! Would you be willing to proceed?" submitText="Proceed" cancelText="Cancel" on:submit={() => { console.log('Proceed'); showSuccessDialog = false; }} on:cancel={() => { console.log('Cancelled'); showSuccessDialog = false; }} /> {/if} </div> </DocsPreview> <p class="mb-8"> The Dialog component is a simple Svelte component that accepts the following props: </p> <DocsCode class="mb-8" language="typescript" code={` type: 'danger' | 'warning' | 'info' | 'success' = 'info'; title: string; message: string; submitText: string; cancelText: string = 'Cancel'; `} /> </DocsPage>
2,638
+page
svelte
en
svelte
code
{"qsc_code_num_words": 294, "qsc_code_num_chars": 2638.0, "qsc_code_mean_word_length": 5.43877551, "qsc_code_frac_words_unique": 0.3537415, "qsc_code_frac_chars_top_2grams": 0.03064415, "qsc_code_frac_chars_top_3grams": 0.02501563, "qsc_code_frac_chars_top_4grams": 0.03001876, "qsc_code_frac_chars_dupe_5grams": 0.34771732, "qsc_code_frac_chars_dupe_6grams": 0.29706066, "qsc_code_frac_chars_dupe_7grams": 0.20888055, "qsc_code_frac_chars_dupe_8grams": 0.20888055, "qsc_code_frac_chars_dupe_9grams": 0.16010006, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00693756, "qsc_code_frac_chars_whitespace": 0.23502654, "qsc_code_size_file_byte": 2638.0, "qsc_code_num_lines": 106.0, "qsc_code_num_chars_line_max": 89.0, "qsc_code_num_chars_line_mean": 24.88679245, "qsc_code_frac_chars_alphabet": 0.78543112, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.53763441, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.1580743, "qsc_code_frac_chars_long_word_length": 0.00947688, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_VNC_Client/LovyanGFX_VNCDriver.cpp
///////////////////////////////////////////////////////////////// /* ESP32 VNC Viewer For More Information: https://youtu.be/WuPIX3qxg4k Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #include "LovyanGFX_VNCDriver.h" VNCDriver::VNCDriver(LGFX *lgfx) { _lcd = lgfx; _lcd->setRotation(3); _lcd->setBrightness(255); _lcd->fillScreen(TFT_BLACK); uint16_t calData[] = { 239, 3926, 233, 265, 3856, 3896, 3714, 308 }; _lcd->setTouchCalibrate(calData); } VNCDriver::~VNCDriver() { delete _lcd; } bool VNCDriver::hasCopyRect(void) { return false; } uint32_t VNCDriver::getHeight(void) { return _lcd->height(); } uint32_t VNCDriver::getWidth(void) { return _lcd->width(); } void VNCDriver::draw_area(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint8_t *data) { _lcd->pushImage(x, y, w, h, (uint16_t *)data); } void VNCDriver::draw_rect(uint32_t x, uint32_t y, uint32_t w, uint32_t h, uint16_t color) { _lcd->fillRect(x, y, w, h, ((((color)&0xff) << 8) | (((color) >> 8)))); } void VNCDriver::copy_rect(uint32_t src_x, uint32_t src_y, uint32_t dest_x, uint32_t dest_y, uint32_t w, uint32_t h) { } void VNCDriver::area_update_start(uint32_t x, uint32_t y, uint32_t w, uint32_t h) { _lcd->setAddrWindow(x, y, w, h); } void VNCDriver::area_update_data(char *data, uint32_t pixel) { _lcd->pushPixels((uint16_t *)data, pixel); } void VNCDriver::area_update_end(void) { _lcd->endWrite(); } void VNCDriver::vnc_options_override(dfb_vnc_options *opt) { opt->client.bigendian = 1; } void VNCDriver::print_screen(String title, String msg, int color) { _lcd->fillScreen(TFT_BLACK); _lcd->setCursor(0, _lcd->height() / 3); _lcd->setTextColor(color); _lcd->setTextSize(5); _lcd->println(title); _lcd->setTextSize(3); _lcd->println(msg); } void VNCDriver::print(String text) { _lcd->print(text); }
1,900
LovyanGFX_VNCDriver
cpp
en
cpp
code
{"qsc_code_num_words": 262, "qsc_code_num_chars": 1900.0, "qsc_code_mean_word_length": 4.43129771, "qsc_code_frac_words_unique": 0.36259542, "qsc_code_frac_chars_top_2grams": 0.12661499, "qsc_code_frac_chars_top_3grams": 0.03445306, "qsc_code_frac_chars_top_4grams": 0.03100775, "qsc_code_frac_chars_dupe_5grams": 0.13781223, "qsc_code_frac_chars_dupe_6grams": 0.09732989, "qsc_code_frac_chars_dupe_7grams": 0.09732989, "qsc_code_frac_chars_dupe_8grams": 0.08268734, "qsc_code_frac_chars_dupe_9grams": 0.08268734, "qsc_code_frac_chars_dupe_10grams": 0.08268734, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.05771567, "qsc_code_frac_chars_whitespace": 0.13368421, "qsc_code_size_file_byte": 1900.0, "qsc_code_num_lines": 75.0, "qsc_code_num_chars_line_max": 118.0, "qsc_code_num_chars_line_mean": 25.33333333, "qsc_code_frac_chars_alphabet": 0.64763062, "qsc_code_frac_chars_comments": 0.12842105, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.03773585, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01267351, "qsc_code_frac_chars_long_word_length": 0.01267351, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.002414, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codecpp_frac_lines_preprocessor_directives": 0.01886792, "qsc_codecpp_frac_lines_func_ratio": 0.0, "qsc_codecpp_cate_bitsstdc": 0.0, "qsc_codecpp_nums_lines_main": 0.0, "qsc_codecpp_frac_lines_goto": 0.0, "qsc_codecpp_cate_var_zero": 0.0, "qsc_codecpp_score_lines_no_logic": 0.03773585, "qsc_codecpp_frac_lines_print": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codecpp_frac_lines_func_ratio": 0, "qsc_codecpp_nums_lines_main": 0, "qsc_codecpp_score_lines_no_logic": 0, "qsc_codecpp_frac_lines_preprocessor_directives": 0, "qsc_codecpp_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_VNC_Client/ESP32Berry_KeyPad.cpp
///////////////////////////////////////////////////////////////// /* ESP32 VNC Viewer For More Information: https://youtu.be/WuPIX3qxg4k Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #include "ESP32Berry_KeyPad.h" static KeyPad *instance = NULL; constexpr char KeyPad::kPad[5][11]; constexpr char KeyPad::kSymbol[11]; KeyPad::KeyPad(FuncPtrChar callback) { instance = this; padTimer = 0; isReady = true; isShift = false; isCapsLock = false; released_cb = callback; } KeyPad::~KeyPad() { } int KeyPad::getKeyRow(int adc) { switch (adc) { case kMinValue[0]... kMaxValue[0]: return 0; break; case kMinValue[1]... kMaxValue[1]: return 1; break; case kMinValue[2]... kMaxValue[2]: return 2; break; case kMinValue[3]... kMaxValue[3]: return 3; break; case kMinValue[4]... kMaxValue[4]: return 4; break; case kMinValue[5]... kMaxValue[5]: return 5; break; case kMinValue[6]... kMaxValue[6]: return 6; break; case kMinValue[7]... kMaxValue[7]: return 7; break; case kMinValue[8]... kMaxValue[8]: return 8; break; case kMinValue[9]... kMaxValue[9]: return 9; break; case kMinValue[10]... kMaxValue[10]: return 10; break; default: return -1; break; } } void KeyPad::checkKeyInput() { if (isReady) { int sensorValue0 = analogRead(32); int sensorValue1 = analogRead(33); int sensorValue2 = analogRead(35); int sensorValue3 = analogRead(36); int sensorValue4 = analogRead(39); isShift = false; if (sensorValue4 != 4095) { int keyRowIdx = getKeyRow(sensorValue4); if (keyRowIdx != -1) { char key = KeyPad::kPad[4][keyRowIdx]; if (key == 16) { isShift = true; } else { blockInput(); released_cb(key); } } } if (sensorValue0 != 4095) { int keyRowIdx = getKeyRow(sensorValue0); if (keyRowIdx != -1) { blockInput(); char key = KeyPad::kPad[0][keyRowIdx]; if (key == 27) { released_cb(key); } else { if (isShift) { char symbol = KeyPad::kSymbol[keyRowIdx]; released_cb(symbol); } else { released_cb(key); } } } } if (sensorValue1 != 4095) { int keyRowIdx = getKeyRow(sensorValue1); if (keyRowIdx != -1) { blockInput(); char key = KeyPad::kPad[1][keyRowIdx]; if (key == 9) { released_cb(key); } else { if (isShift || isCapsLock) { released_cb(char(key - 32)); } else { released_cb(key); } } } } if (sensorValue2 != 4095) { int keyRowIdx = getKeyRow(sensorValue2); if (keyRowIdx != -1) { blockInput(); char key = KeyPad::kPad[2][keyRowIdx]; //Special Key if (key == 20) { isCapsLock = !isCapsLock; } else if (key == 8) { released_cb(key); } else { if (isShift || isCapsLock) { released_cb(char(key - 32)); } else { released_cb(key); } } } } if (sensorValue3 != 4095) { int keyRowIdx = getKeyRow(sensorValue3); if (keyRowIdx != -1) { blockInput(); char key = KeyPad::kPad[3][keyRowIdx]; if (key == 44 || key == 46 || key == 13) { released_cb(key); } else { if (isShift || isCapsLock) { released_cb(char(key - 32)); } else { released_cb(key); } } } } } if (!isReady && millis() - padTimer >= 200) { isReady = true; } } void KeyPad::blockInput() { isReady = false; padTimer = millis(); }
3,939
ESP32Berry_KeyPad
cpp
en
cpp
code
{"qsc_code_num_words": 377, "qsc_code_num_chars": 3939.0, "qsc_code_mean_word_length": 5.12997347, "qsc_code_frac_words_unique": 0.23342175, "qsc_code_frac_chars_top_2grams": 0.07238883, "qsc_code_frac_chars_top_3grams": 0.09307135, "qsc_code_frac_chars_top_4grams": 0.06463289, "qsc_code_frac_chars_dupe_5grams": 0.21871768, "qsc_code_frac_chars_dupe_6grams": 0.20889349, "qsc_code_frac_chars_dupe_7grams": 0.19544984, "qsc_code_frac_chars_dupe_8grams": 0.19544984, "qsc_code_frac_chars_dupe_9grams": 0.114788, "qsc_code_frac_chars_dupe_10grams": 0.114788, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.04878986, "qsc_code_frac_chars_whitespace": 0.33917238, "qsc_code_size_file_byte": 3939.0, "qsc_code_num_lines": 178.0, "qsc_code_num_chars_line_max": 66.0, "qsc_code_num_chars_line_mean": 22.12921348, "qsc_code_frac_chars_alphabet": 0.694199, "qsc_code_frac_chars_comments": 0.06549886, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.33333333, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00516024, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codecpp_frac_lines_preprocessor_directives": 0.00666667, "qsc_codecpp_frac_lines_func_ratio": 0.0, "qsc_codecpp_cate_bitsstdc": 0.0, "qsc_codecpp_nums_lines_main": 0.0, "qsc_codecpp_frac_lines_goto": 0.0, "qsc_codecpp_cate_var_zero": 0.0, "qsc_codecpp_score_lines_no_logic": 0.08, "qsc_codecpp_frac_lines_print": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codecpp_frac_lines_func_ratio": 0, "qsc_codecpp_nums_lines_main": 0, "qsc_codecpp_score_lines_no_logic": 0, "qsc_codecpp_frac_lines_preprocessor_directives": 0, "qsc_codecpp_frac_lines_print": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_utils.h
/** * @file lv_utils.h * */ #ifndef LV_UTILS_H #define LV_UTILS_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #include <stdint.h> #include <stddef.h> /********************* * DEFINES *********************/ /********************** * TYPEDEFS **********************/ /********************** * GLOBAL PROTOTYPES **********************/ /** * Convert a number to string * @param num a number * @param buf pointer to a `char` buffer. The result will be stored here (max 10 elements) * @return same as `buf` (just for convenience) */ char * _lv_utils_num_to_str(int32_t num, char * buf); /** Searches base[0] to base[n - 1] for an item that matches *key. * * @note The function cmp must return negative if its first * argument (the search key) is less that its second (a table entry), * zero if equal, and positive if greater. * * @note Items in the array must be in ascending order. * * @param key Pointer to item being searched for * @param base Pointer to first element to search * @param n Number of elements * @param size Size of each element * @param cmp Pointer to comparison function (see #lv_font_codeCompare as a comparison function * example) * * @return a pointer to a matching item, or NULL if none exists. */ void * _lv_utils_bsearch(const void * key, const void * base, uint32_t n, uint32_t size, int32_t (*cmp)(const void * pRef, const void * pElement)); /********************** * MACROS **********************/ #ifdef __cplusplus } /* extern "C" */ #endif #endif
1,633
lv_utils
h
en
c
code
{"qsc_code_num_words": 209, "qsc_code_num_chars": 1633.0, "qsc_code_mean_word_length": 4.33971292, "qsc_code_frac_words_unique": 0.50717703, "qsc_code_frac_chars_top_2grams": 0.03858875, "qsc_code_frac_chars_top_3grams": 0.02646086, "qsc_code_frac_chars_top_4grams": 0.0463065, "qsc_code_frac_chars_dupe_5grams": 0.05733186, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00931677, "qsc_code_frac_chars_whitespace": 0.21126761, "qsc_code_size_file_byte": 1633.0, "qsc_code_num_lines": 66.0, "qsc_code_num_chars_line_max": 99.0, "qsc_code_num_chars_line_mean": 24.74242424, "qsc_code_frac_chars_alphabet": 0.69487578, "qsc_code_frac_chars_comments": 0.75627679, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.35714286, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00251256, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.14285714, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 1.0, "qsc_codec_score_lines_no_logic": 0.28571429, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_anim.c
/** * @file anim.c * */ /********************* * INCLUDES *********************/ #include "lv_anim.h" #if LV_USE_ANIMATION #include <stddef.h> #include <string.h> #include "../lv_misc/lv_debug.h" #include "../lv_hal/lv_hal_tick.h" #include "lv_task.h" #include "lv_math.h" #include "lv_gc.h" #if defined(LV_GC_INCLUDE) #include LV_GC_INCLUDE #endif /* LV_ENABLE_GC */ /********************* * DEFINES *********************/ #define LV_ANIM_RESOLUTION 1024 #define LV_ANIM_RES_SHIFT 10 #define LV_ANIM_TASK_PRIO LV_TASK_PRIO_HIGH /********************** * TYPEDEFS **********************/ /********************** * STATIC PROTOTYPES **********************/ static void anim_task(lv_task_t * param); static void anim_mark_list_change(void); static bool anim_ready_handler(lv_anim_t * a); /********************** * STATIC VARIABLES **********************/ static uint32_t last_task_run; static bool anim_list_changed; static lv_task_t * _lv_anim_task; const lv_anim_path_t lv_anim_path_def = {.cb = lv_anim_path_linear}; /********************** * MACROS **********************/ /********************** * GLOBAL FUNCTIONS **********************/ /** * Init. the animation module */ void _lv_anim_core_init(void) { _lv_ll_init(&LV_GC_ROOT(_lv_anim_ll), sizeof(lv_anim_t)); last_task_run = lv_tick_get(); _lv_anim_task = lv_task_create(anim_task, LV_DISP_DEF_REFR_PERIOD, LV_ANIM_TASK_PRIO, NULL); anim_mark_list_change(); /*Turn off the animation task*/ anim_list_changed = false; /*The list has not actually changed*/ } /** * Initialize an animation variable. * E.g.: * lv_anim_t a; * lv_anim_init(&a); * lv_anim_set_...(&a); * @param a pointer to an `lv_anim_t` variable to initialize */ void lv_anim_init(lv_anim_t * a) { _lv_memset_00(a, sizeof(lv_anim_t)); a->time = 500; a->start = 0; a->end = 100; _lv_memcpy_small(&a->path, &lv_anim_path_def, sizeof(lv_anim_path_cb_t)); a->repeat_cnt = 1; a->early_apply = 1; } /** * Create an animation * @param a an initialized 'anim_t' variable. Not required after call. */ void lv_anim_start(lv_anim_t * a) { LV_LOG_TRACE("animation create started") /* Do not let two animations for the same 'var' with the same 'fp'*/ if(a->exec_cb != NULL) lv_anim_del(a->var, a->exec_cb); /*fp == NULL would delete all animations of var*/ /*If the list is empty the anim task was suspended and it's last run measure is invalid*/ if(_lv_ll_is_empty(&LV_GC_ROOT(_lv_anim_ll))) { last_task_run = lv_tick_get() - 1; } /*Add the new animation to the animation linked list*/ lv_anim_t * new_anim = _lv_ll_ins_head(&LV_GC_ROOT(_lv_anim_ll)); LV_ASSERT_MEM(new_anim); if(new_anim == NULL) return; /*Initialize the animation descriptor*/ a->time_orig = a->time; _lv_memcpy(new_anim, a, sizeof(lv_anim_t)); /*Set the start value*/ if(new_anim->early_apply) { if(new_anim->exec_cb && new_anim->var) new_anim->exec_cb(new_anim->var, new_anim->start); } /* Creating an animation changed the linked list. * It's important if it happens in a ready callback. (see `anim_task`)*/ anim_mark_list_change(); LV_LOG_TRACE("animation created") } /** * Delete an animation of a variable with a given animator function * @param var pointer to variable * @param exec_cb a function pointer which is animating 'var', * or NULL to delete all the animations of 'var' * @return true: at least 1 animation is deleted, false: no animation is deleted */ bool lv_anim_del(void * var, lv_anim_exec_xcb_t exec_cb) { lv_anim_t * a; lv_anim_t * a_next; bool del = false; a = _lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll)); while(a != NULL) { /*'a' might be deleted, so get the next object while 'a' is valid*/ a_next = _lv_ll_get_next(&LV_GC_ROOT(_lv_anim_ll), a); if(a->var == var && (a->exec_cb == exec_cb || exec_cb == NULL)) { _lv_ll_remove(&LV_GC_ROOT(_lv_anim_ll), a); lv_mem_free(a); anim_mark_list_change(); /*Read by `anim_task`. It need to know if a delete occurred in the linked list*/ del = true; } a = a_next; } return del; } /** * Get the animation of a variable and its `exec_cb`. * @param var pointer to variable * @param exec_cb a function pointer which is animating 'var', * or NULL to delete all the animations of 'var' * @return pointer to the animation. */ lv_anim_t * lv_anim_get(void * var, lv_anim_exec_xcb_t exec_cb) { lv_anim_t * a; _LV_LL_READ(LV_GC_ROOT(_lv_anim_ll), a) { if(a->var == var && a->exec_cb == exec_cb) { return a; } } return NULL; } /** * Get the number of currently running animations * @return the number of running animations */ uint16_t lv_anim_count_running(void) { uint16_t cnt = 0; lv_anim_t * a; _LV_LL_READ(LV_GC_ROOT(_lv_anim_ll), a) cnt++; return cnt; } /** * Calculate the time of an animation with a given speed and the start and end values * @param speed speed of animation in unit/sec * @param start start value of the animation * @param end end value of the animation * @return the required time [ms] for the animation with the given parameters */ uint16_t lv_anim_speed_to_time(uint16_t speed, lv_anim_value_t start, lv_anim_value_t end) { int32_t d = LV_MATH_ABS((int32_t)start - end); uint32_t time = (int32_t)((int32_t)(d * 1000) / speed); if(time > UINT16_MAX) time = UINT16_MAX; if(time == 0) { time++; } return time; } /** * Manually refresh the state of the animations. * Useful to make the animations running in a blocking process where * `lv_task_handler` can't run for a while. * Shouldn't be used directly because it is called in `lv_refr_now()`. */ void lv_anim_refr_now(void) { anim_task(NULL); } /** * Calculate the current value of an animation applying linear characteristic * @param a pointer to an animation * @return the current value to set */ lv_anim_value_t lv_anim_path_linear(const lv_anim_path_t * path, const lv_anim_t * a) { LV_UNUSED(path); /*Calculate the current step*/ uint32_t step; if(a->time == a->act_time) { step = LV_ANIM_RESOLUTION; /*Use the last value if the time fully elapsed*/ } else { step = ((int32_t)a->act_time * LV_ANIM_RESOLUTION) / a->time; } /* Get the new value which will be proportional to `step` * and the `start` and `end` values*/ int32_t new_value; new_value = (int32_t)step * (a->end - a->start); new_value = new_value >> LV_ANIM_RES_SHIFT; new_value += a->start; return (lv_anim_value_t)new_value; } /** * Calculate the current value of an animation slowing down the start phase * @param a pointer to an animation * @return the current value to set */ lv_anim_value_t lv_anim_path_ease_in(const lv_anim_path_t * path, const lv_anim_t * a) { LV_UNUSED(path); /*Calculate the current step*/ uint32_t t; if(a->time == a->act_time) t = 1024; else t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time; int32_t step = _lv_bezier3(t, 0, 1, 1, 1024); int32_t new_value; new_value = (int32_t)step * (a->end - a->start); new_value = new_value >> 10; new_value += a->start; return (lv_anim_value_t)new_value; } /** * Calculate the current value of an animation slowing down the end phase * @param a pointer to an animation * @return the current value to set */ lv_anim_value_t lv_anim_path_ease_out(const lv_anim_path_t * path, const lv_anim_t * a) { LV_UNUSED(path); /*Calculate the current step*/ uint32_t t; if(a->time == a->act_time) t = 1024; else t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time; int32_t step = _lv_bezier3(t, 0, 1023, 1023, 1024); int32_t new_value; new_value = (int32_t)step * (a->end - a->start); new_value = new_value >> 10; new_value += a->start; return (lv_anim_value_t)new_value; } /** * Calculate the current value of an animation applying an "S" characteristic (cosine) * @param a pointer to an animation * @return the current value to set */ lv_anim_value_t lv_anim_path_ease_in_out(const lv_anim_path_t * path, const lv_anim_t * a) { LV_UNUSED(path); /*Calculate the current step*/ uint32_t t; if(a->time == a->act_time) t = 1024; else t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time; int32_t step = _lv_bezier3(t, 0, 100, 924, 1024); int32_t new_value; new_value = (int32_t)step * (a->end - a->start); new_value = new_value >> 10; new_value += a->start; return (lv_anim_value_t)new_value; } /** * Calculate the current value of an animation with overshoot at the end * @param a pointer to an animation * @return the current value to set */ lv_anim_value_t lv_anim_path_overshoot(const lv_anim_path_t * path, const lv_anim_t * a) { LV_UNUSED(path); /*Calculate the current step*/ uint32_t t; if(a->time == a->act_time) t = 1024; else t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time; int32_t step = _lv_bezier3(t, 0, 1000, 2000, 1024); int32_t new_value; new_value = (int32_t)step * (a->end - a->start); new_value = new_value >> 10; new_value += a->start; return (lv_anim_value_t)new_value; } /** * Calculate the current value of an animation with 3 bounces * @param a pointer to an animation * @return the current value to set */ lv_anim_value_t lv_anim_path_bounce(const lv_anim_path_t * path, const lv_anim_t * a) { LV_UNUSED(path); /*Calculate the current step*/ uint32_t t; if(a->time == a->act_time) t = 1024; else t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time; int32_t diff = (a->end - a->start); /*3 bounces has 5 parts: 3 down and 2 up. One part is t / 5 long*/ if(t < 408) { /*Go down*/ t = (t * 2500) >> 10; /*[0..1024] range*/ } else if(t >= 408 && t < 614) { /*First bounce back*/ t -= 408; t = t * 5; /*to [0..1024] range*/ t = 1024 - t; diff = diff / 6; } else if(t >= 614 && t < 819) { /*Fall back*/ t -= 614; t = t * 5; /*to [0..1024] range*/ diff = diff / 6; } else if(t >= 819 && t < 921) { /*Second bounce back*/ t -= 819; t = t * 10; /*to [0..1024] range*/ t = 1024 - t; diff = diff / 16; } else if(t >= 921 && t <= 1024) { /*Fall back*/ t -= 921; t = t * 10; /*to [0..1024] range*/ diff = diff / 16; } if(t > 1024) t = 1024; int32_t step = _lv_bezier3(t, 1024, 1024, 800, 0); int32_t new_value; new_value = (int32_t)step * diff; new_value = new_value >> 10; new_value = a->end - new_value; return (lv_anim_value_t)new_value; } /** * Calculate the current value of an animation applying step characteristic. * (Set end value on the end of the animation) * @param a pointer to an animation * @return the current value to set */ lv_anim_value_t lv_anim_path_step(const lv_anim_path_t * path, const lv_anim_t * a) { LV_UNUSED(path); if(a->act_time >= a->time) return a->end; else return a->start; } /********************** * STATIC FUNCTIONS **********************/ /** * Periodically handle the animations. * @param param unused */ static void anim_task(lv_task_t * param) { (void)param; lv_anim_t * a; _LV_LL_READ(LV_GC_ROOT(_lv_anim_ll), a) { a->has_run = 0; } uint32_t elaps = lv_tick_elaps(last_task_run); a = _lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll)); while(a != NULL) { /*It can be set by `lv_anim_del()` typically in `end_cb`. If set then an animation delete * happened in `anim_ready_handler` which could make this linked list reading corrupt * because the list is changed meanwhile */ anim_list_changed = false; if(!a->has_run) { a->has_run = 1; /*The list readying might be reseted so need to know which anim has run already*/ /*The animation will run now for the first time. Call `start_cb`*/ int32_t new_act_time = a->act_time + elaps; if(a->act_time <= 0 && new_act_time >= 0) { if(a->start_cb) a->start_cb(a); } a->act_time += elaps; if(a->act_time >= 0) { if(a->act_time > a->time) a->act_time = a->time; int32_t new_value; if(a->path.cb) new_value = a->path.cb(&a->path, a); else new_value = lv_anim_path_linear(&a->path, a); /*Apply the calculated value*/ if(a->exec_cb) a->exec_cb(a->var, new_value); /*If the time is elapsed the animation is ready*/ if(a->act_time >= a->time) { anim_ready_handler(a); } } } /* If the linked list changed due to anim. delete then it's not safe to continue * the reading of the list from here -> start from the head*/ if(anim_list_changed) a = _lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll)); else a = _lv_ll_get_next(&LV_GC_ROOT(_lv_anim_ll), a); } last_task_run = lv_tick_get(); } /** * Called when an animation is ready to do the necessary thinks * e.g. repeat, play back, delete etc. * @param a pointer to an animation descriptor * @return true: animation delete occurred and the `LV_GC_ROOT(_lv_anim_ll)` has changed * */ static bool anim_ready_handler(lv_anim_t * a) { /*In the end of a forward anim decrement repeat cnt.*/ if(a->playback_now == 0 && a->repeat_cnt > 0 && a->repeat_cnt != LV_ANIM_REPEAT_INFINITE) { a->repeat_cnt--; } /*Delete the animation if * - no repeat left and no play back (simple one shot animation) * - no repeat, play back is enabled and play back is ready */ if(a->repeat_cnt == 0 && ((a->playback_time == 0) || (a->playback_time && a->playback_now == 1))) { /*Create copy from the animation and delete the animation from the list. * This way the `ready_cb` will see the animations like it's animation is ready deleted*/ lv_anim_t a_tmp; _lv_memcpy(&a_tmp, a, sizeof(lv_anim_t)); _lv_ll_remove(&LV_GC_ROOT(_lv_anim_ll), a); lv_mem_free(a); /*Flag that the list has changed */ anim_mark_list_change(); /* Call the callback function at the end*/ if(a_tmp.ready_cb != NULL) a_tmp.ready_cb(&a_tmp); } /*If the animation is not deleted then restart it*/ else { a->act_time = -(int32_t)(a->repeat_delay); /*Restart the animation*/ /*Swap the start and end values in play back mode*/ if(a->playback_time != 0) { /*If now turning back use the 'playback_pause*/ if(a->playback_now == 0) a->act_time = -(int32_t)(a->playback_delay); /*Toggle the play back state*/ a->playback_now = a->playback_now == 0 ? 1 : 0; /*Swap the start and end values*/ int32_t tmp; tmp = a->start; a->start = a->end; a->end = tmp; a->time = a->playback_now == 0 ? a->time_orig : a->playback_time; } } return anim_list_changed; } static void anim_mark_list_change(void) { anim_list_changed = true; if(_lv_ll_get_head(&LV_GC_ROOT(_lv_anim_ll)) == NULL) lv_task_set_prio(_lv_anim_task, LV_TASK_PRIO_OFF); else lv_task_set_prio(_lv_anim_task, LV_ANIM_TASK_PRIO); } #endif
15,934
lv_anim
c
en
c
code
{"qsc_code_num_words": 2476, "qsc_code_num_chars": 15934.0, "qsc_code_mean_word_length": 3.63772213, "qsc_code_frac_words_unique": 0.12156704, "qsc_code_frac_chars_top_2grams": 0.0686133, "qsc_code_frac_chars_top_3grams": 0.01942933, "qsc_code_frac_chars_top_4grams": 0.01687576, "qsc_code_frac_chars_dupe_5grams": 0.45342511, "qsc_code_frac_chars_dupe_6grams": 0.43388476, "qsc_code_frac_chars_dupe_7grams": 0.39180637, "qsc_code_frac_chars_dupe_8grams": 0.37315421, "qsc_code_frac_chars_dupe_9grams": 0.35294771, "qsc_code_frac_chars_dupe_10grams": 0.32485844, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.03050164, "qsc_code_frac_chars_whitespace": 0.25310656, "qsc_code_size_file_byte": 15934.0, "qsc_code_num_lines": 559.0, "qsc_code_num_chars_line_max": 110.0, "qsc_code_num_chars_line_mean": 28.50447227, "qsc_code_frac_chars_alphabet": 0.72632552, "qsc_code_frac_chars_comments": 0.3858416, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.32786885, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01216023, "qsc_code_frac_chars_long_word_length": 0.00449622, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.00327869, "qsc_codec_frac_lines_func_ratio": 0.08852459, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.13442623, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": 0.05245902}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_mem.c
/** * @file lv_mem.c * General and portable implementation of malloc and free. * The dynamic memory monitoring is also supported. */ /********************* * INCLUDES *********************/ #include "lv_mem.h" #include "lv_math.h" #include "lv_gc.h" #include <string.h> #if LV_MEM_CUSTOM != 0 #include LV_MEM_CUSTOM_INCLUDE #endif #if defined(LV_GC_INCLUDE) #include LV_GC_INCLUDE #endif /* LV_ENABLE_GC */ /********************* * DEFINES *********************/ /*Add memory junk on alloc (0xaa) and free(0xbb) (just for testing purposes)*/ #ifndef LV_MEM_ADD_JUNK #define LV_MEM_ADD_JUNK 0 #endif #ifndef LV_MEM_FULL_DEFRAG_CNT #define LV_MEM_FULL_DEFRAG_CNT 16 #endif #ifdef LV_ARCH_64 #define MEM_UNIT uint64_t #else #define MEM_UNIT uint32_t #endif /********************** * TYPEDEFS **********************/ #if LV_ENABLE_GC == 0 /*gc custom allocations must not include header*/ /*The size of this union must be 4 bytes (uint32_t)*/ typedef union { struct { MEM_UNIT used : 1; /* 1: if the entry is used*/ MEM_UNIT d_size : 31; /* Size off the data (1 means 4 bytes)*/ } s; MEM_UNIT header; /* The header (used + d_size)*/ } lv_mem_header_t; typedef struct { lv_mem_header_t header; uint8_t first_data; /*First data byte in the allocated data (Just for easily create a pointer)*/ } lv_mem_ent_t; #endif /* LV_ENABLE_GC */ #ifdef LV_ARCH_64 #define ALIGN_MASK 0x7 #else #define ALIGN_MASK 0x3 #endif #define MEM_BUF_SMALL_SIZE 16 /********************** * STATIC PROTOTYPES **********************/ #if LV_MEM_CUSTOM == 0 static lv_mem_ent_t * ent_get_next(lv_mem_ent_t * act_e); static void * ent_alloc(lv_mem_ent_t * e, size_t size); static void ent_trunc(lv_mem_ent_t * e, size_t size); #endif /********************** * STATIC VARIABLES **********************/ #if LV_MEM_CUSTOM == 0 static uint8_t * work_mem; #endif static uint32_t zero_mem; /*Give the address of this variable if 0 byte should be allocated*/ #if LV_MEM_CUSTOM == 0 static uint32_t mem_max_size; /*Tracks the maximum total size of memory ever used from the internal heap*/ #endif static uint8_t mem_buf1_32[MEM_BUF_SMALL_SIZE]; static uint8_t mem_buf2_32[MEM_BUF_SMALL_SIZE]; static lv_mem_buf_t mem_buf_small[] = {{.p = mem_buf1_32, .size = MEM_BUF_SMALL_SIZE, .used = 0}, {.p = mem_buf2_32, .size = MEM_BUF_SMALL_SIZE, .used = 0} }; /********************** * MACROS **********************/ #define COPY32 *d32 = *s32; d32++; s32++; #define COPY8 *d8 = *s8; d8++; s8++; #define SET32(x) *d32 = x; d32++; #define REPEAT8(expr) expr expr expr expr expr expr expr expr /********************** * GLOBAL FUNCTIONS **********************/ /** * Initialize the dyn_mem module (work memory and other variables) */ void _lv_mem_init(void) { #if LV_MEM_CUSTOM == 0 #if LV_MEM_ADR == 0 /*Allocate a large array to store the dynamically allocated data*/ static LV_MEM_ATTR MEM_UNIT work_mem_int[LV_MEM_SIZE / sizeof(MEM_UNIT)]; work_mem = (uint8_t *)work_mem_int; mem_max_size = 0; #else work_mem = (uint8_t *)LV_MEM_ADR; #endif lv_mem_ent_t * full = (lv_mem_ent_t *)work_mem; full->header.s.used = 0; /*The total mem size id reduced by the first header and the close patterns */ full->header.s.d_size = LV_MEM_SIZE - sizeof(lv_mem_header_t); #endif } /** * Clean up the memory buffer which frees all the allocated memories. * @note It work only if `LV_MEM_CUSTOM == 0` */ void _lv_mem_deinit(void) { #if LV_MEM_CUSTOM == 0 _lv_memset_00(work_mem, (LV_MEM_SIZE / sizeof(MEM_UNIT)) * sizeof(MEM_UNIT)); lv_mem_ent_t * full = (lv_mem_ent_t *)work_mem; full->header.s.used = 0; /*The total mem size id reduced by the first header and the close patterns */ full->header.s.d_size = LV_MEM_SIZE - sizeof(lv_mem_header_t); #endif } /** * Allocate a memory dynamically * @param size size of the memory to allocate in bytes * @return pointer to the allocated memory */ void * lv_mem_alloc(size_t size) { if(size == 0) { return &zero_mem; } #ifdef LV_ARCH_64 /*Round the size up to 8*/ size = (size + 7) & (~0x7); #else /*Round the size up to 4*/ size = (size + 3) & (~0x3); #endif void * alloc = NULL; #if LV_MEM_CUSTOM == 0 /*Use the built-in allocators*/ lv_mem_ent_t * e = NULL; /* Search for a appropriate entry*/ do { /* Get the next entry*/ e = ent_get_next(e); /*If there is next entry then try to allocate there*/ if(e != NULL) { alloc = ent_alloc(e, size); } /* End if there is not next entry OR the alloc. is successful*/ } while(e != NULL && alloc == NULL); #else /*Use custom, user defined malloc function*/ #if LV_ENABLE_GC == 1 /*gc must not include header*/ alloc = LV_MEM_CUSTOM_ALLOC(size); #else /* LV_ENABLE_GC */ /*Allocate a header too to store the size*/ alloc = LV_MEM_CUSTOM_ALLOC(size + sizeof(lv_mem_header_t)); if(alloc != NULL) { ((lv_mem_ent_t *)alloc)->header.s.d_size = size; ((lv_mem_ent_t *)alloc)->header.s.used = 1; alloc = &((lv_mem_ent_t *)alloc)->first_data; } #endif /* LV_ENABLE_GC */ #endif /* LV_MEM_CUSTOM */ #if LV_MEM_ADD_JUNK if(alloc != NULL) _lv_memset(alloc, 0xaa, size); #endif if(alloc == NULL) { LV_LOG_WARN("Couldn't allocate memory"); } else { #if LV_MEM_CUSTOM == 0 /* just a safety check, should always be true */ if((uintptr_t) alloc > (uintptr_t) work_mem) { if((((uintptr_t) alloc - (uintptr_t) work_mem) + size) > mem_max_size) { mem_max_size = ((uintptr_t) alloc - (uintptr_t) work_mem) + size; } } #endif } return alloc; } /** * Free an allocated data * @param data pointer to an allocated memory */ void lv_mem_free(const void * data) { if(data == &zero_mem) return; if(data == NULL) return; #if LV_MEM_ADD_JUNK _lv_memset((void *)data, 0xbb, _lv_mem_get_size(data)); #endif #if LV_ENABLE_GC == 0 /*e points to the header*/ lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *)data - sizeof(lv_mem_header_t)); e->header.s.used = 0; #endif #if LV_MEM_CUSTOM == 0 #if LV_MEM_AUTO_DEFRAG static uint16_t full_defrag_cnt = 0; full_defrag_cnt++; if(full_defrag_cnt < LV_MEM_FULL_DEFRAG_CNT) { /* Make a simple defrag. * Join the following free entries after this*/ lv_mem_ent_t * e_next; e_next = ent_get_next(e); while(e_next != NULL) { if(e_next->header.s.used == 0) { e->header.s.d_size += e_next->header.s.d_size + sizeof(e->header); } else { break; } e_next = ent_get_next(e_next); } } else { full_defrag_cnt = 0; lv_mem_defrag(); } #endif /*LV_MEM_AUTO_DEFRAG*/ #else /*Use custom, user defined free function*/ #if LV_ENABLE_GC == 0 LV_MEM_CUSTOM_FREE(e); #else LV_MEM_CUSTOM_FREE((void *)data); #endif /*LV_ENABLE_GC*/ #endif } /** * Reallocate a memory with a new size. The old content will be kept. * @param data pointer to an allocated memory. * Its content will be copied to the new memory block and freed * @param new_size the desired new size in byte * @return pointer to the new memory */ #if LV_ENABLE_GC == 0 void * lv_mem_realloc(void * data_p, size_t new_size) { #ifdef LV_ARCH_64 /*Round the size up to 8*/ new_size = (new_size + 7) & (~0x7); #else /*Round the size up to 4*/ new_size = (new_size + 3) & (~0x3); #endif /*data_p could be previously freed pointer (in this case it is invalid)*/ if(data_p != NULL) { lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *)data_p - sizeof(lv_mem_header_t)); if(e->header.s.used == 0) { data_p = NULL; } } uint32_t old_size = _lv_mem_get_size(data_p); if(old_size == new_size) return data_p; /*Also avoid reallocating the same memory*/ #if LV_MEM_CUSTOM == 0 /* Truncate the memory if the new size is smaller. */ if(new_size < old_size) { lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *)data_p - sizeof(lv_mem_header_t)); ent_trunc(e, new_size); return &e->first_data; } #endif void * new_p; new_p = lv_mem_alloc(new_size); if(new_p == NULL) { LV_LOG_WARN("Couldn't allocate memory"); return NULL; } if(data_p != NULL) { /*Copy the old data to the new. Use the smaller size*/ if(old_size != 0) { _lv_memcpy(new_p, data_p, LV_MATH_MIN(new_size, old_size)); lv_mem_free(data_p); } } return new_p; } #else /* LV_ENABLE_GC */ void * lv_mem_realloc(void * data_p, size_t new_size) { void * new_p = LV_MEM_CUSTOM_REALLOC(data_p, new_size); if(new_p == NULL) LV_LOG_WARN("Couldn't allocate memory"); return new_p; } #endif /* lv_enable_gc */ /** * Join the adjacent free memory blocks */ void lv_mem_defrag(void) { #if LV_MEM_CUSTOM == 0 lv_mem_ent_t * e_free; lv_mem_ent_t * e_next; e_free = ent_get_next(NULL); while(1) { /*Search the next free entry*/ while(e_free != NULL) { if(e_free->header.s.used != 0) { e_free = ent_get_next(e_free); } else { break; } } if(e_free == NULL) return; /*Joint the following free entries to the free*/ e_next = ent_get_next(e_free); while(e_next != NULL) { if(e_next->header.s.used == 0) { e_free->header.s.d_size += e_next->header.s.d_size + sizeof(e_next->header); } else { break; } e_next = ent_get_next(e_next); } if(e_next == NULL) return; /*Continue from the lastly checked entry*/ e_free = e_next; } #endif } lv_res_t lv_mem_test(void) { #if LV_MEM_CUSTOM == 0 lv_mem_ent_t * e; e = ent_get_next(NULL); while(e) { if(e->header.s.d_size > LV_MEM_SIZE) { return LV_RES_INV; } uint8_t * e8 = (uint8_t *) e; if(e8 + e->header.s.d_size > work_mem + LV_MEM_SIZE) { return LV_RES_INV; } e = ent_get_next(e); } #endif return LV_RES_OK; } /** * Give information about the work memory of dynamic allocation * @param mon_p pointer to a dm_mon_p variable, * the result of the analysis will be stored here */ void lv_mem_monitor(lv_mem_monitor_t * mon_p) { /*Init the data*/ _lv_memset(mon_p, 0, sizeof(lv_mem_monitor_t)); #if LV_MEM_CUSTOM == 0 lv_mem_ent_t * e; e = NULL; e = ent_get_next(e); while(e != NULL) { if(e->header.s.used == 0) { mon_p->free_cnt++; mon_p->free_size += e->header.s.d_size; if(e->header.s.d_size > mon_p->free_biggest_size) { mon_p->free_biggest_size = e->header.s.d_size; } } else { mon_p->used_cnt++; } e = ent_get_next(e); } mon_p->total_size = LV_MEM_SIZE; mon_p->max_used = mem_max_size; mon_p->used_pct = 100 - (100U * mon_p->free_size) / mon_p->total_size; if(mon_p->free_size > 0) { mon_p->frag_pct = (uint32_t)mon_p->free_biggest_size * 100U / mon_p->free_size; mon_p->frag_pct = 100 - mon_p->frag_pct; } else { mon_p->frag_pct = 0; /*no fragmentation if all the RAM is used*/ } #endif } /** * Give the size of an allocated memory * @param data pointer to an allocated memory * @return the size of data memory in bytes */ #if LV_ENABLE_GC == 0 uint32_t _lv_mem_get_size(const void * data) { if(data == NULL) return 0; if(data == &zero_mem) return 0; lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *)data - sizeof(lv_mem_header_t)); return e->header.s.d_size; } #else /* LV_ENABLE_GC */ uint32_t _lv_mem_get_size(const void * data) { return LV_MEM_CUSTOM_GET_SIZE(data); } #endif /*LV_ENABLE_GC*/ /** * Get a temporal buffer with the given size. * @param size the required size */ void * _lv_mem_buf_get(uint32_t size) { if(size == 0) return NULL; /*Try small static buffers first*/ uint8_t i; if(size <= MEM_BUF_SMALL_SIZE) { for(i = 0; i < sizeof(mem_buf_small) / sizeof(mem_buf_small[0]); i++) { if(mem_buf_small[i].used == 0) { mem_buf_small[i].used = 1; return mem_buf_small[i].p; } } } /*Try to find a free buffer with suitable size */ int8_t i_guess = -1; for(i = 0; i < LV_MEM_BUF_MAX_NUM; i++) { if(LV_GC_ROOT(_lv_mem_buf[i]).used == 0 && LV_GC_ROOT(_lv_mem_buf[i]).size >= size) { if(LV_GC_ROOT(_lv_mem_buf[i]).size == size) { LV_GC_ROOT(_lv_mem_buf[i]).used = 1; return LV_GC_ROOT(_lv_mem_buf[i]).p; } else if(i_guess < 0) { i_guess = i; } /*If size of `i` is closer to `size` prefer it*/ else if(LV_GC_ROOT(_lv_mem_buf[i]).size < LV_GC_ROOT(_lv_mem_buf[i_guess]).size) { i_guess = i; } } } if(i_guess >= 0) { LV_GC_ROOT(_lv_mem_buf[i_guess]).used = 1; return LV_GC_ROOT(_lv_mem_buf[i_guess]).p; } /*Reallocate a free buffer*/ for(i = 0; i < LV_MEM_BUF_MAX_NUM; i++) { if(LV_GC_ROOT(_lv_mem_buf[i]).used == 0) { LV_GC_ROOT(_lv_mem_buf[i]).used = 1; LV_GC_ROOT(_lv_mem_buf[i]).size = size; /*if this fails you probably need to increase your LV_MEM_SIZE/heap size*/ LV_GC_ROOT(_lv_mem_buf[i]).p = lv_mem_realloc(LV_GC_ROOT(_lv_mem_buf[i]).p, size); if(LV_GC_ROOT(_lv_mem_buf[i]).p == NULL) { LV_DEBUG_ASSERT(false, "Out of memory, can't allocate a new buffer (increase your LV_MEM_SIZE/heap size", 0x00); } return LV_GC_ROOT(_lv_mem_buf[i]).p; } } LV_DEBUG_ASSERT(false, "No free buffer. Increase LV_DRAW_BUF_MAX_NUM.", 0x00); return NULL; } /** * Release a memory buffer * @param p buffer to release */ void _lv_mem_buf_release(void * p) { uint8_t i; /*Try small static buffers first*/ for(i = 0; i < sizeof(mem_buf_small) / sizeof(mem_buf_small[0]); i++) { if(mem_buf_small[i].p == p) { mem_buf_small[i].used = 0; return; } } for(i = 0; i < LV_MEM_BUF_MAX_NUM; i++) { if(LV_GC_ROOT(_lv_mem_buf[i]).p == p) { LV_GC_ROOT(_lv_mem_buf[i]).used = 0; return; } } LV_LOG_ERROR("lv_mem_buf_release: p is not a known buffer") } /** * Free all memory buffers */ void _lv_mem_buf_free_all(void) { uint8_t i; for(i = 0; i < sizeof(mem_buf_small) / sizeof(mem_buf_small[0]); i++) { mem_buf_small[i].used = 0; } for(i = 0; i < LV_MEM_BUF_MAX_NUM; i++) { if(LV_GC_ROOT(_lv_mem_buf[i]).p) { lv_mem_free(LV_GC_ROOT(_lv_mem_buf[i]).p); LV_GC_ROOT(_lv_mem_buf[i]).p = NULL; LV_GC_ROOT(_lv_mem_buf[i]).used = 0; LV_GC_ROOT(_lv_mem_buf[i]).size = 0; } } } #if LV_MEMCPY_MEMSET_STD == 0 /** * Same as `memcpy` but optimized for 4 byte operation. * @param dst pointer to the destination buffer * @param src pointer to the source buffer * @param len number of byte to copy */ LV_ATTRIBUTE_FAST_MEM void * _lv_memcpy(void * dst, const void * src, size_t len) { uint8_t * d8 = dst; const uint8_t * s8 = src; lv_uintptr_t d_align = (lv_uintptr_t)d8 & ALIGN_MASK; lv_uintptr_t s_align = (lv_uintptr_t)s8 & ALIGN_MASK; /*Byte copy for unaligned memories*/ if(s_align != d_align) { while(len > 32) { REPEAT8(COPY8); REPEAT8(COPY8); REPEAT8(COPY8); REPEAT8(COPY8); len -= 32; } while(len) { COPY8 len--; } return dst; } /*Make the memories aligned*/ if(d_align) { d_align = ALIGN_MASK + 1 - d_align; while(d_align && len) { COPY8; d_align--; len--; } } uint32_t * d32 = (uint32_t *)d8; const uint32_t * s32 = (uint32_t *)s8; while(len > 32) { REPEAT8(COPY32) len -= 32; } while(len > 4) { COPY32; len -= 4; } d8 = (uint8_t *)d32; s8 = (const uint8_t *)s32; while(len) { COPY8 len--; } return dst; } /** * Same as `memset` but optimized for 4 byte operation. * @param dst pointer to the destination buffer * @param v value to set [0..255] * @param len number of byte to set */ LV_ATTRIBUTE_FAST_MEM void _lv_memset(void * dst, uint8_t v, size_t len) { uint8_t * d8 = (uint8_t *) dst; uintptr_t d_align = (lv_uintptr_t) d8 & ALIGN_MASK; /*Make the address aligned*/ if(d_align) { d_align = ALIGN_MASK + 1 - d_align; while(d_align && len) { *d8 = v; d8++; len--; d_align--; } } uint32_t v32 = v + (v << 8) + (v << 16) + (v << 24); uint32_t * d32 = (uint32_t *)d8; while(len > 32) { SET32(v32); SET32(v32); SET32(v32); SET32(v32); SET32(v32); SET32(v32); SET32(v32); SET32(v32); len -= 32; } while(len > 4) { SET32(v32); len -= 4; } d8 = (uint8_t *)d32; while(len) { *d8 = v; d8++; len--; } } /** * Same as `memset(dst, 0x00, len)` but optimized for 4 byte operation. * @param dst pointer to the destination buffer * @param len number of byte to set */ LV_ATTRIBUTE_FAST_MEM void _lv_memset_00(void * dst, size_t len) { uint8_t * d8 = (uint8_t *) dst; uintptr_t d_align = (lv_uintptr_t) d8 & ALIGN_MASK; /*Make the address aligned*/ if(d_align) { d_align = ALIGN_MASK + 1 - d_align; while(d_align && len) { *d8 = 0x00; d8++; len--; d_align--; } } uint32_t * d32 = (uint32_t *)d8; while(len > 32) { SET32(0); SET32(0); SET32(0); SET32(0); SET32(0); SET32(0); SET32(0); SET32(0); len -= 32; } while(len > 4) { SET32(0); len -= 4; } d8 = (uint8_t *)d32; while(len) { *d8 = 0; d8++; len--; } } /** * Same as `memset(dst, 0xFF, len)` but optimized for 4 byte operation. * @param dst pointer to the destination buffer * @param len number of byte to set */ LV_ATTRIBUTE_FAST_MEM void _lv_memset_ff(void * dst, size_t len) { uint8_t * d8 = (uint8_t *) dst; uintptr_t d_align = (lv_uintptr_t) d8 & ALIGN_MASK; /*Make the address aligned*/ if(d_align) { d_align = ALIGN_MASK + 1 - d_align; while(d_align && len) { *d8 = 0xFF; d8++; len--; d_align--; } } uint32_t * d32 = (uint32_t *)d8; while(len > 32) { SET32(0xFFFFFFFF); SET32(0xFFFFFFFF); SET32(0xFFFFFFFF); SET32(0xFFFFFFFF); SET32(0xFFFFFFFF); SET32(0xFFFFFFFF); SET32(0xFFFFFFFF); SET32(0xFFFFFFFF); len -= 32; } while(len > 4) { SET32(0xFFFFFFFF); len -= 4; } d8 = (uint8_t *)d32; while(len) { *d8 = 0xFF; d8++; len--; } } #endif /*LV_MEMCPY_MEMSET_STD*/ /********************** * STATIC FUNCTIONS **********************/ #if LV_MEM_CUSTOM == 0 /** * Give the next entry after 'act_e' * @param act_e pointer to an entry * @return pointer to an entry after 'act_e' */ static lv_mem_ent_t * ent_get_next(lv_mem_ent_t * act_e) { lv_mem_ent_t * next_e = NULL; if(act_e == NULL) { /*NULL means: get the first entry*/ next_e = (lv_mem_ent_t *)work_mem; } else { /*Get the next entry */ uint8_t * data = &act_e->first_data; next_e = (lv_mem_ent_t *)&data[act_e->header.s.d_size]; if(&next_e->first_data >= &work_mem[LV_MEM_SIZE]) next_e = NULL; } return next_e; } /** * Try to do the real allocation with a given size * @param e try to allocate to this entry * @param size size of the new memory in bytes * @return pointer to the allocated memory or NULL if not enough memory in the entry */ static void * ent_alloc(lv_mem_ent_t * e, size_t size) { void * alloc = NULL; /*If the memory is free and big enough then use it */ if(e->header.s.used == 0 && e->header.s.d_size >= size) { /*Truncate the entry to the desired size */ ent_trunc(e, size); e->header.s.used = 1; /*Save the allocated data*/ alloc = &e->first_data; } return alloc; } /** * Truncate the data of entry to the given size * @param e Pointer to an entry * @param size new size in bytes */ static void ent_trunc(lv_mem_ent_t * e, size_t size) { #ifdef LV_ARCH_64 /*Round the size up to 8*/ size = (size + 7) & (~0x7); #else /*Round the size up to 4*/ size = (size + 3) & (~0x3); #endif /*Don't let empty space only for a header without data*/ if(e->header.s.d_size == size + sizeof(lv_mem_header_t)) { size = e->header.s.d_size; } /* Create the new entry after the current if there is space for it */ if(e->header.s.d_size != size) { uint8_t * e_data = &e->first_data; lv_mem_ent_t * after_new_e = (lv_mem_ent_t *)&e_data[size]; after_new_e->header.s.used = 0; after_new_e->header.s.d_size = (uint32_t)e->header.s.d_size - size - sizeof(lv_mem_header_t); } /* Set the new size for the original entry */ e->header.s.d_size = (uint32_t)size; } #endif
22,190
lv_mem
c
en
c
code
{"qsc_code_num_words": 3387, "qsc_code_num_chars": 22190.0, "qsc_code_mean_word_length": 3.4726897, "qsc_code_frac_words_unique": 0.09654562, "qsc_code_frac_chars_top_2grams": 0.06163918, "qsc_code_frac_chars_top_3grams": 0.02380548, "qsc_code_frac_chars_top_4grams": 0.02678116, "qsc_code_frac_chars_dupe_5grams": 0.54267982, "qsc_code_frac_chars_dupe_6grams": 0.46046591, "qsc_code_frac_chars_dupe_7grams": 0.38037749, "qsc_code_frac_chars_dupe_8grams": 0.34313892, "qsc_code_frac_chars_dupe_9grams": 0.30802585, "qsc_code_frac_chars_dupe_10grams": 0.28192484, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.03047739, "qsc_code_frac_chars_whitespace": 0.28729157, "qsc_code_size_file_byte": 22190.0, "qsc_code_num_lines": 890.0, "qsc_code_num_chars_line_max": 130.0, "qsc_code_num_chars_line_mean": 24.93258427, "qsc_code_frac_chars_alphabet": 0.71324692, "qsc_code_frac_chars_comments": 0.26430825, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.43654822, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01617152, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00869832, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.00338409, "qsc_codec_frac_lines_func_ratio": 0.06598985, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.0964467, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": 0.1641286}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
00jacs/sveltekit-ultrafast
src/routes/docs/components/read-first/+page.svelte
<script lang="ts"> import { DocsPage, DocsCode, DocsNote, DocsPreview } from '$lib/components/page/docs'; </script> <DocsPage title="Read this first" subtitle="Here are some important things to know before you start using the components."> <h2 class="mb-4 text-xl font-semibold">1) Daisy UI</h2> <p class="mb-6"> Most of the components in this library are based on the <a href="https://daisyui.com" target="_blank" class="text-blue-600">Daisy UI</a> design system. This means that you can use the same classes and utilities that you would use with Daisy UI components. </p> <p class="mb-6"> This is one of the most popular UI kits and it makes it very easy to start developing UI (alongside with Tailwind CSS, of course). </p> <div class="divider"></div> <h2 class="mb-4 text-xl font-semibold">2) Components structure</h2> <p class="mb-6"> The components are organized in a way that makes it easy to find and use them. Each component is located in its own file in the <code>src/lib/components</code> directory. </p> <p class="mb-4">Why this way? Why not just use the DaisyUI classes?</p> <ul class="mb-6 ml-1 flex flex-col gap-4"> <li> - <strong>Reusability:</strong> you can use the components in multiple places in your project without having to remember the classes. </li> <li> - <strong>Consistency:</strong> the components are consistent across the project. </li> <li> - <strong>Customization:</strong> you can easily customize the components by changing the code in the component file. </li> </ul> <DocsCode class="mb-8" language="typescript" code={` import { Button, Checkbox, InputText, Loader, Popover } from '$lib/components'; `} /> <div class="divider"></div> <h2 class="mb-4 text-xl font-semibold">3) Customization</h2> <p class="mb-6"> The components are designed to be easily customizable. You can change the classes, add new props, or even change the structure of the component. </p> <p class="mb-6"> If you want to customize a component, you can simply copy the component file to your project and make the changes there. This way, you can keep the original component as it is and use the customized version in your project. </p> <div class="divider"></div> <h2 class="mb-4 text-xl font-semibold">4) Themes</h2> <p class="mb-6"> You can easily change the theme of the components by changing the colors in the <code>tailwind.config.js</code> file. This way, you can match the components with the design of your project. </p> <a href="https://daisyui.com/docs/themes/" target="_blank" class="link link-primary mb-6 block"> See DaisyUI's guide to theme/typography customziation. </a> <p class="mb-6"> The theme switch functionality has already been implemented (server cookies store the user's theme preference). You can toggle the theme by clicking the "Toggle theme" button in the top right corner of the page. Take a look at the `routes/+layout.svelte`: </p> <DocsCode class="mb-8" language="typescript" code={` if (data.theme === Theme.LIGHT || data.theme === Theme.DARK) { theme.set(data.theme); if (browser) { document.documentElement.setAttribute('data-theme', data.theme); } } `} /> <div class="divider"></div> <h2 class="mb-4 text-xl font-semibold">5) Theme recommendations</h2> <p> I would recommend you define the following colors for simplicity (unless you're an advanced designer and you know what you're doing): </p> <ul class="my-4 ml-1"> <li>- primary &rarr; your main (and only) brand color</li> <li>- primary-content &rarr; text color on the "primary" fill</li> <li>- base-100 &rarr; default background color</li> <li>- base-200 &rarr; used for borders and lighter backgrounds</li> <li>- base-300 &rarr; used for borders and lighter backgrounds</li> <li>- base-content &rarr; text color on the "base-100" fill</li> </ul> <p> Usually, keeping it simple (only one "accent"/"primary" color, no "secondary" color) is the best approach. You can always add more colors later. </p> </DocsPage>
4,115
+page
svelte
en
svelte
code
{"qsc_code_num_words": 658, "qsc_code_num_chars": 4115.0, "qsc_code_mean_word_length": 4.35410334, "qsc_code_frac_words_unique": 0.37082067, "qsc_code_frac_chars_top_2grams": 0.0390925, "qsc_code_frac_chars_top_3grams": 0.02233857, "qsc_code_frac_chars_top_4grams": 0.02198953, "qsc_code_frac_chars_dupe_5grams": 0.22129145, "qsc_code_frac_chars_dupe_6grams": 0.17033159, "qsc_code_frac_chars_dupe_7grams": 0.15287958, "qsc_code_frac_chars_dupe_8grams": 0.12635253, "qsc_code_frac_chars_dupe_9grams": 0.09773124, "qsc_code_frac_chars_dupe_10grams": 0.09773124, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01507983, "qsc_code_frac_chars_whitespace": 0.1781288, "qsc_code_size_file_byte": 4115.0, "qsc_code_num_lines": 131.0, "qsc_code_num_chars_line_max": 95.0, "qsc_code_num_chars_line_mean": 31.41221374, "qsc_code_frac_chars_alphabet": 0.83205204, "qsc_code_frac_chars_comments": 0.0, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.40384615, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.13438639, "qsc_code_frac_chars_long_word_length": 0.00607533, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_txt.c
/** * @file lv_text.c * */ /********************* * INCLUDES *********************/ #include "lv_txt.h" #include "lv_math.h" #include "lv_log.h" /********************* * DEFINES *********************/ #define NO_BREAK_FOUND UINT32_MAX /********************** * TYPEDEFS **********************/ /********************** * STATIC PROTOTYPES **********************/ static inline bool is_break_char(uint32_t letter); #if LV_TXT_ENC == LV_TXT_ENC_UTF8 static uint8_t lv_txt_utf8_size(const char * str); static uint32_t lv_txt_unicode_to_utf8(uint32_t letter_uni); static uint32_t lv_txt_utf8_conv_wc(uint32_t c); static uint32_t lv_txt_utf8_next(const char * txt, uint32_t * i); static uint32_t lv_txt_utf8_prev(const char * txt, uint32_t * i_start); static uint32_t lv_txt_utf8_get_byte_id(const char * txt, uint32_t utf8_id); static uint32_t lv_txt_utf8_get_char_id(const char * txt, uint32_t byte_id); static uint32_t lv_txt_utf8_get_length(const char * txt); #elif LV_TXT_ENC == LV_TXT_ENC_ASCII static uint8_t lv_txt_iso8859_1_size(const char * str); static uint32_t lv_txt_unicode_to_iso8859_1(uint32_t letter_uni); static uint32_t lv_txt_iso8859_1_conv_wc(uint32_t c); static uint32_t lv_txt_iso8859_1_next(const char * txt, uint32_t * i); static uint32_t lv_txt_iso8859_1_prev(const char * txt, uint32_t * i_start); static uint32_t lv_txt_iso8859_1_get_byte_id(const char * txt, uint32_t utf8_id); static uint32_t lv_txt_iso8859_1_get_char_id(const char * txt, uint32_t byte_id); static uint32_t lv_txt_iso8859_1_get_length(const char * txt); #endif /********************** * STATIC VARIABLES **********************/ /********************** * GLOBAL VARIABLES **********************/ #if LV_TXT_ENC == LV_TXT_ENC_UTF8 uint8_t (*_lv_txt_encoded_size)(const char *) = lv_txt_utf8_size; uint32_t (*_lv_txt_unicode_to_encoded)(uint32_t) = lv_txt_unicode_to_utf8; uint32_t (*_lv_txt_encoded_conv_wc)(uint32_t) = lv_txt_utf8_conv_wc; uint32_t (*_lv_txt_encoded_next)(const char *, uint32_t *) = lv_txt_utf8_next; uint32_t (*_lv_txt_encoded_prev)(const char *, uint32_t *) = lv_txt_utf8_prev; uint32_t (*_lv_txt_encoded_get_byte_id)(const char *, uint32_t) = lv_txt_utf8_get_byte_id; uint32_t (*_lv_txt_encoded_get_char_id)(const char *, uint32_t) = lv_txt_utf8_get_char_id; uint32_t (*_lv_txt_get_encoded_length)(const char *) = lv_txt_utf8_get_length; #elif LV_TXT_ENC == LV_TXT_ENC_ASCII uint8_t (*_lv_txt_encoded_size)(const char *) = lv_txt_iso8859_1_size; uint32_t (*_lv_txt_unicode_to_encoded)(uint32_t) = lv_txt_unicode_to_iso8859_1; uint32_t (*_lv_txt_encoded_conv_wc)(uint32_t) = lv_txt_iso8859_1_conv_wc; uint32_t (*_lv_txt_encoded_next)(const char *, uint32_t *) = lv_txt_iso8859_1_next; uint32_t (*_lv_txt_encoded_prev)(const char *, uint32_t *) = lv_txt_iso8859_1_prev; uint32_t (*_lv_txt_encoded_get_byte_id)(const char *, uint32_t) = lv_txt_iso8859_1_get_byte_id; uint32_t (*_lv_txt_encoded_get_char_id)(const char *, uint32_t) = lv_txt_iso8859_1_get_char_id; uint32_t (*_lv_txt_get_encoded_length)(const char *) = lv_txt_iso8859_1_get_length; #endif /********************** * MACROS **********************/ /********************** * GLOBAL FUNCTIONS **********************/ /** * Get size of a text * @param size_res pointer to a 'point_t' variable to store the result * @param text pointer to a text * @param font pointer to font of the text * @param letter_space letter space of the text * @param txt.line_space line space of the text * @param flags settings for the text from 'txt_flag_t' enum * @param max_width max with of the text (break the lines to fit this size) Set CORD_MAX to avoid * line breaks */ void _lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t line_space, lv_coord_t max_width, lv_txt_flag_t flag) { size_res->x = 0; size_res->y = 0; if(text == NULL) return; if(font == NULL) return; if(flag & LV_TXT_FLAG_EXPAND) max_width = LV_COORD_MAX; uint32_t line_start = 0; uint32_t new_line_start = 0; uint16_t letter_height = lv_font_get_line_height(font); /*Calc. the height and longest line*/ while(text[line_start] != '\0') { new_line_start += _lv_txt_get_next_line(&text[line_start], font, letter_space, max_width, flag); if((unsigned long)size_res->y + (unsigned long)letter_height + (unsigned long)line_space > LV_MAX_OF(lv_coord_t)) { LV_LOG_WARN("lv_txt_get_size: integer overflow while calculating text height"); return; } else { size_res->y += letter_height; size_res->y += line_space; } /*Calculate the the longest line*/ lv_coord_t act_line_length = _lv_txt_get_width(&text[line_start], new_line_start - line_start, font, letter_space, flag); size_res->x = LV_MATH_MAX(act_line_length, size_res->x); line_start = new_line_start; } /*Make the text one line taller if the last character is '\n' or '\r'*/ if((line_start != 0) && (text[line_start - 1] == '\n' || text[line_start - 1] == '\r')) { size_res->y += letter_height + line_space; } /*Correction with the last line space or set the height manually if the text is empty*/ if(size_res->y == 0) size_res->y = letter_height; else size_res->y -= line_space; } /** * Get the next word of text. A word is delimited by break characters. * * If the word cannot fit in the max_width space, obey LV_TXT_LINE_BREAK_LONG_* rules. * * If the next word cannot fit anything, return 0. * * If the first character is a break character, returns the next index. * * Example calls from lv_txt_get_next_line() assuming sufficient max_width and * txt = "Test text\n" * 0123456789 * * Calls would be as follows: * 1. Return i=4, pointing at breakchar ' ', for the string "Test" * 2. Return i=5, since i=4 was a breakchar. * 3. Return i=9, pointing at breakchar '\n' * 4. Parenting lv_txt_get_next_line() would detect subsequent '\0' * * TODO: Returned word_w_ptr may overestimate the returned word's width when * max_width is reached. In current usage, this has no impact. * * @param txt a '\0' terminated string * @param font pointer to a font * @param letter_space letter space * @param max_width max with of the text (break the lines to fit this size) Set CORD_MAX to avoid line breaks * @param flags settings for the text from 'txt_flag_type' enum * @param[out] word_w_ptr width (in pixels) of the parsed word. May be NULL. * @param force Force return the fraction of the word that can fit in the provided space. * @return the index of the first char of the next word (in byte index not letter index. With UTF-8 they are different) */ static uint32_t lv_txt_get_next_word(const char * txt, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t max_width, lv_txt_flag_t flag, uint32_t * word_w_ptr, lv_txt_cmd_state_t * cmd_state, bool force) { if(txt == NULL || txt[0] == '\0') return 0; if(font == NULL) return 0; if(flag & LV_TXT_FLAG_EXPAND) max_width = LV_COORD_MAX; uint32_t i = 0, i_next = 0, i_next_next = 0; /* Iterating index into txt */ uint32_t letter = 0; /* Letter at i */ uint32_t letter_next = 0; /* Letter at i_next */ lv_coord_t letter_w; lv_coord_t cur_w = 0; /* Pixel Width of transversed string */ uint32_t word_len = 0; /* Number of characters in the transversed word */ uint32_t break_index = NO_BREAK_FOUND; /* only used for "long" words */ uint32_t break_letter_count = 0; /* Number of characters up to the long word break point */ letter = _lv_txt_encoded_next(txt, &i_next); i_next_next = i_next; /* Obtain the full word, regardless if it fits or not in max_width */ while(txt[i] != '\0') { letter_next = _lv_txt_encoded_next(txt, &i_next_next); word_len++; /*Handle the recolor command*/ if((flag & LV_TXT_FLAG_RECOLOR) != 0) { if(_lv_txt_is_cmd(cmd_state, letter) != false) { i = i_next; i_next = i_next_next; letter = letter_next; continue; /*Skip the letter is it is part of a command*/ } } letter_w = lv_font_get_glyph_width(font, letter, letter_next); cur_w += letter_w; if(letter_w > 0) { cur_w += letter_space; } /* Test if this character fits within max_width */ if(break_index == NO_BREAK_FOUND && (cur_w - letter_space) > max_width) { break_index = i; break_letter_count = word_len - 1; /* break_index is now pointing at the character that doesn't fit */ } /*Check for new line chars and breakchars*/ if(letter == '\n' || letter == '\r' || is_break_char(letter)) { /* Update the output width on the first character if it fits. * Must do this here incase first letter is a break character. */ if(i == 0 && break_index == NO_BREAK_FOUND && word_w_ptr != NULL) *word_w_ptr = cur_w; word_len--; break; } /* Update the output width */ if(word_w_ptr != NULL && break_index == NO_BREAK_FOUND) *word_w_ptr = cur_w; i = i_next; i_next = i_next_next; letter = letter_next; } /* Entire Word fits in the provided space */ if(break_index == NO_BREAK_FOUND) { if(word_len == 0 || (letter == '\r' && letter_next == '\n')) i = i_next; return i; } #if LV_TXT_LINE_BREAK_LONG_LEN > 0 /* Word doesn't fit in provided space, but isn't "long" */ if(word_len < LV_TXT_LINE_BREAK_LONG_LEN) { if(force) return break_index; if(word_w_ptr != NULL) *word_w_ptr = 0; /* Return no word */ return 0; } /* Word is "long," but insufficient amounts can fit in provided space */ if(break_letter_count < LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN) { if(force) return break_index; if(word_w_ptr != NULL) *word_w_ptr = 0; return 0; } /* Word is a "long", but letters may need to be better distributed */ { i = break_index; int32_t n_move = LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN - (word_len - break_letter_count); /* Move pointer "i" backwards */ for(; n_move > 0; n_move--) { _lv_txt_encoded_prev(txt, &i); // TODO: it would be appropriate to update the returned word width here // However, in current usage, this doesn't impact anything. } } return i; #else if(force) return break_index; if(word_w_ptr != NULL) *word_w_ptr = 0; /* Return no word */ (void) break_letter_count; return 0; #endif } /** * Get the next line of text. Check line length and break chars too. * * A line of txt includes the \n character. * * @param txt a '\0' terminated string * @param font pointer to a font * @param letter_space letter space * @param max_width max with of the text (break the lines to fit this size) Set CORD_MAX to avoid line breaks * @param flags settings for the text from 'txt_flag_type' enum * @return the index of the first char of the new line (in byte index not letter index. With UTF-8 they are different) */ uint32_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font, lv_coord_t letter_space, lv_coord_t max_width, lv_txt_flag_t flag) { if(txt == NULL) return 0; if(font == NULL) return 0; /* If max_width doesn't mater simply find the new line character * without thinking about word wrapping*/ if((flag & LV_TXT_FLAG_EXPAND) || (flag & LV_TXT_FLAG_FIT)) { uint32_t i; for(i = 0; txt[i] != '\n' && txt[i] != '\r' && txt[i] != '\0'; i++) { /*Just find the new line chars or string ends by incrementing `i`*/ } if(txt[i] != '\0') i++; /*To go beyond `\n`*/ return i; } if(flag & LV_TXT_FLAG_EXPAND) max_width = LV_COORD_MAX; lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT; uint32_t i = 0; /* Iterating index into txt */ while(txt[i] != '\0' && max_width > 0) { uint32_t word_w = 0; uint32_t advance = lv_txt_get_next_word(&txt[i], font, letter_space, max_width, flag, &word_w, &cmd_state, i == 0); max_width -= word_w; if(advance == 0) { if(i == 0) _lv_txt_encoded_next(txt, &i); // prevent inf loops break; } i += advance; if(txt[0] == '\n' || txt[0] == '\r') break; if(txt[i] == '\n' || txt[i] == '\r') { i++; /* Include the following newline in the current line */ break; } } /* Always step at least one to avoid infinite loops */ if(i == 0) { _lv_txt_encoded_next(txt, &i); } return i; } /** * Give the length of a text with a given font * @param txt a '\0' terminate string * @param length length of 'txt' in byte count and not characters (Á is 1 character but 2 bytes in * UTF-8) * @param font pointer to a font * @param letter_space letter space * @param flags settings for the text from 'txt_flag_t' enum * @return length of a char_num long text */ lv_coord_t _lv_txt_get_width(const char * txt, uint32_t length, const lv_font_t * font, lv_coord_t letter_space, lv_txt_flag_t flag) { if(txt == NULL) return 0; if(font == NULL) return 0; uint32_t i = 0; lv_coord_t width = 0; lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT; if(length != 0) { while(i < length) { uint32_t letter = _lv_txt_encoded_next(txt, &i); uint32_t letter_next = _lv_txt_encoded_next(&txt[i], NULL); if((flag & LV_TXT_FLAG_RECOLOR) != 0) { if(_lv_txt_is_cmd(&cmd_state, letter) != false) { continue; } } lv_coord_t char_width = lv_font_get_glyph_width(font, letter, letter_next); if(char_width > 0) { width += char_width; width += letter_space; } } if(width > 0) { width -= letter_space; /*Trim the last letter space. Important if the text is center aligned */ } } return width; } /** * Check next character in a string and decide if the character is part of the command or not * @param state pointer to a txt_cmd_state_t variable which stores the current state of command * processing (Initied. to TXT_CMD_STATE_WAIT ) * @param c the current character * @return true: the character is part of a command and should not be written, * false: the character should be written */ bool _lv_txt_is_cmd(lv_txt_cmd_state_t * state, uint32_t c) { bool ret = false; if(c == (uint32_t)LV_TXT_COLOR_CMD[0]) { if(*state == LV_TXT_CMD_STATE_WAIT) { /*Start char*/ *state = LV_TXT_CMD_STATE_PAR; ret = true; } /*Other start char in parameter is escaped cmd. char */ else if(*state == LV_TXT_CMD_STATE_PAR) { *state = LV_TXT_CMD_STATE_WAIT; } /*Command end */ else if(*state == LV_TXT_CMD_STATE_IN) { *state = LV_TXT_CMD_STATE_WAIT; ret = true; } } /*Skip the color parameter and wait the space after it*/ if(*state == LV_TXT_CMD_STATE_PAR) { if(c == ' ') { *state = LV_TXT_CMD_STATE_IN; /*After the parameter the text is in the command*/ } ret = true; } return ret; } /** * Insert a string into an other * @param txt_buf the original text (must be big enough for the result text) * @param pos position to insert. Expressed in character index and not byte index (Different in * UTF-8) 0: before the original text, 1: after the first char etc. * @param ins_txt text to insert */ void _lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt) { size_t old_len = strlen(txt_buf); size_t ins_len = strlen(ins_txt); size_t new_len = ins_len + old_len; pos = _lv_txt_encoded_get_byte_id(txt_buf, pos); /*Convert to byte index instead of letter index*/ /*Copy the second part into the end to make place to text to insert*/ size_t i; for(i = new_len; i >= pos + ins_len; i--) { txt_buf[i] = txt_buf[i - ins_len]; } /* Copy the text into the new space*/ _lv_memcpy_small(txt_buf + pos, ins_txt, ins_len); } /** * Delete a part of a string * @param txt string to modify * @param pos position where to start the deleting (0: before the first char, 1: after the first * char etc.) * @param len number of characters to delete */ void _lv_txt_cut(char * txt, uint32_t pos, uint32_t len) { size_t old_len = strlen(txt); pos = _lv_txt_encoded_get_byte_id(txt, pos); /*Convert to byte index instead of letter index*/ len = _lv_txt_encoded_get_byte_id(&txt[pos], len); /*Copy the second part into the end to make place to text to insert*/ uint32_t i; for(i = pos; i <= old_len - len; i++) { txt[i] = txt[i + len]; } } #if LV_TXT_ENC == LV_TXT_ENC_UTF8 /******************************* * UTF-8 ENCODER/DECOER ******************************/ /** * Give the size of an UTF-8 coded character * @param str pointer to a character in a string * @return length of the UTF-8 character (1,2,3 or 4). O on invalid code */ static uint8_t lv_txt_utf8_size(const char * str) { if((str[0] & 0x80) == 0) return 1; else if((str[0] & 0xE0) == 0xC0) return 2; else if((str[0] & 0xF0) == 0xE0) return 3; else if((str[0] & 0xF8) == 0xF0) return 4; return 0; /*If the char was invalid tell it's 1 byte long*/ } /** * Convert an Unicode letter to UTF-8. * @param letter_uni an Unicode letter * @return UTF-8 coded character in Little Endian to be compatible with C chars (e.g. 'Á', 'Ű') */ static uint32_t lv_txt_unicode_to_utf8(uint32_t letter_uni) { if(letter_uni < 128) return letter_uni; uint8_t bytes[4]; if(letter_uni < 0x0800) { bytes[0] = ((letter_uni >> 6) & 0x1F) | 0xC0; bytes[1] = ((letter_uni >> 0) & 0x3F) | 0x80; bytes[2] = 0; bytes[3] = 0; } else if(letter_uni < 0x010000) { bytes[0] = ((letter_uni >> 12) & 0x0F) | 0xE0; bytes[1] = ((letter_uni >> 6) & 0x3F) | 0x80; bytes[2] = ((letter_uni >> 0) & 0x3F) | 0x80; bytes[3] = 0; } else if(letter_uni < 0x110000) { bytes[0] = ((letter_uni >> 18) & 0x07) | 0xF0; bytes[1] = ((letter_uni >> 12) & 0x3F) | 0x80; bytes[2] = ((letter_uni >> 6) & 0x3F) | 0x80; bytes[3] = ((letter_uni >> 0) & 0x3F) | 0x80; } uint32_t * res_p = (uint32_t *)bytes; return *res_p; } /** * Convert a wide character, e.g. 'Á' little endian to be UTF-8 compatible * @param c a wide character or a Little endian number * @return `c` in big endian */ static uint32_t lv_txt_utf8_conv_wc(uint32_t c) { #if LV_BIG_ENDIAN_SYSTEM == 0 /*Swap the bytes (UTF-8 is big endian, but the MCUs are little endian)*/ if((c & 0x80) != 0) { uint32_t swapped; uint8_t c8[4]; _lv_memcpy_small(c8, &c, 4); swapped = (c8[0] << 24) + (c8[1] << 16) + (c8[2] << 8) + (c8[3]); uint8_t i; for(i = 0; i < 4; i++) { if((swapped & 0xFF) == 0) swapped = (swapped >> 8); /*Ignore leading zeros (they were in the end originally)*/ } c = swapped; } #endif return c; } /** * Decode an UTF-8 character from a string. * @param txt pointer to '\0' terminated string * @param i start byte index in 'txt' where to start. * After call it will point to the next UTF-8 char in 'txt'. * NULL to use txt[0] as index * @return the decoded Unicode character or 0 on invalid UTF-8 code */ static uint32_t lv_txt_utf8_next(const char * txt, uint32_t * i) { /* Unicode to UTF-8 * 00000000 00000000 00000000 0xxxxxxx -> 0xxxxxxx * 00000000 00000000 00000yyy yyxxxxxx -> 110yyyyy 10xxxxxx * 00000000 00000000 zzzzyyyy yyxxxxxx -> 1110zzzz 10yyyyyy 10xxxxxx * 00000000 000wwwzz zzzzyyyy yyxxxxxx -> 11110www 10zzzzzz 10yyyyyy 10xxxxxx * */ uint32_t result = 0; /*Dummy 'i' pointer is required*/ uint32_t i_tmp = 0; if(i == NULL) i = &i_tmp; /*Normal ASCII*/ if((txt[*i] & 0x80) == 0) { result = txt[*i]; (*i)++; } /*Real UTF-8 decode*/ else { /*2 bytes UTF-8 code*/ if((txt[*i] & 0xE0) == 0xC0) { result = (uint32_t)(txt[*i] & 0x1F) << 6; (*i)++; if((txt[*i] & 0xC0) != 0x80) return 0; /*Invalid UTF-8 code*/ result += (txt[*i] & 0x3F); (*i)++; } /*3 bytes UTF-8 code*/ else if((txt[*i] & 0xF0) == 0xE0) { result = (uint32_t)(txt[*i] & 0x0F) << 12; (*i)++; if((txt[*i] & 0xC0) != 0x80) return 0; /*Invalid UTF-8 code*/ result += (uint32_t)(txt[*i] & 0x3F) << 6; (*i)++; if((txt[*i] & 0xC0) != 0x80) return 0; /*Invalid UTF-8 code*/ result += (txt[*i] & 0x3F); (*i)++; } /*4 bytes UTF-8 code*/ else if((txt[*i] & 0xF8) == 0xF0) { result = (uint32_t)(txt[*i] & 0x07) << 18; (*i)++; if((txt[*i] & 0xC0) != 0x80) return 0; /*Invalid UTF-8 code*/ result += (uint32_t)(txt[*i] & 0x3F) << 12; (*i)++; if((txt[*i] & 0xC0) != 0x80) return 0; /*Invalid UTF-8 code*/ result += (uint32_t)(txt[*i] & 0x3F) << 6; (*i)++; if((txt[*i] & 0xC0) != 0x80) return 0; /*Invalid UTF-8 code*/ result += txt[*i] & 0x3F; (*i)++; } else { (*i)++; /*Not UTF-8 char. Go the next.*/ } } return result; } /** * Get previous UTF-8 character form a string. * @param txt pointer to '\0' terminated string * @param i start byte index in 'txt' where to start. After the call it will point to the previous * UTF-8 char in 'txt'. * @return the decoded Unicode character or 0 on invalid UTF-8 code */ static uint32_t lv_txt_utf8_prev(const char * txt, uint32_t * i) { uint8_t c_size; uint8_t cnt = 0; /*Try to find a !0 long UTF-8 char by stepping one character back*/ (*i)--; do { if(cnt >= 4) return 0; /*No UTF-8 char found before the initial*/ c_size = _lv_txt_encoded_size(&txt[*i]); if(c_size == 0) { if(*i != 0) (*i)--; else return 0; } cnt++; } while(c_size == 0); uint32_t i_tmp = *i; uint32_t letter = _lv_txt_encoded_next(txt, &i_tmp); /*Character found, get it*/ return letter; } /** * Convert a character index (in an UTF-8 text) to byte index. * E.g. in "AÁRT" index of 'R' is 2th char but start at byte 3 because 'Á' is 2 bytes long * @param txt a '\0' terminated UTF-8 string * @param utf8_id character index * @return byte index of the 'utf8_id'th letter */ static uint32_t lv_txt_utf8_get_byte_id(const char * txt, uint32_t utf8_id) { uint32_t i; uint32_t byte_cnt = 0; for(i = 0; i < utf8_id; i++) { uint8_t c_size = _lv_txt_encoded_size(&txt[byte_cnt]); byte_cnt += c_size > 0 ? c_size : 1; } return byte_cnt; } /** * Convert a byte index (in an UTF-8 text) to character index. * E.g. in "AÁRT" index of 'R' is 2th char but start at byte 3 because 'Á' is 2 bytes long * @param txt a '\0' terminated UTF-8 string * @param byte_id byte index * @return character index of the letter at 'byte_id'th position */ static uint32_t lv_txt_utf8_get_char_id(const char * txt, uint32_t byte_id) { uint32_t i = 0; uint32_t char_cnt = 0; while(i < byte_id) { _lv_txt_encoded_next(txt, &i); /*'i' points to the next letter so use the prev. value*/ char_cnt++; } return char_cnt; } /** * Get the number of characters (and NOT bytes) in a string. Decode it with UTF-8 if enabled. * E.g.: "ÁBC" is 3 characters (but 4 bytes) * @param txt a '\0' terminated char string * @return number of characters */ static uint32_t lv_txt_utf8_get_length(const char * txt) { uint32_t len = 0; uint32_t i = 0; while(txt[i] != '\0') { _lv_txt_encoded_next(txt, &i); len++; } return len; } #elif LV_TXT_ENC == LV_TXT_ENC_ASCII /******************************* * ASCII ENCODER/DECOER ******************************/ /** * Give the size of an ISO8859-1 coded character * @param str pointer to a character in a string * @return length of the UTF-8 character (1,2,3 or 4). O on invalid code */ static uint8_t lv_txt_iso8859_1_size(const char * str) { (void)str; /*Unused*/ return 1; } /** * Convert an Unicode letter to ISO8859-1. * @param letter_uni an Unicode letter * @return ISO8859-1 coded character in Little Endian to be compatible with C chars (e.g. 'Á', 'Ű') */ static uint32_t lv_txt_unicode_to_iso8859_1(uint32_t letter_uni) { if(letter_uni < 128) return letter_uni; else return ' '; } /** * Convert wide characters to ASCII, however wide characters in ASCII range (e.g. 'A') are ASCII compatible by default. * So this function does nothing just returns with `c`. * @param c a character, e.g. 'A' * @return same as `c` */ static uint32_t lv_txt_iso8859_1_conv_wc(uint32_t c) { return c; } /** * Decode an ISO8859-1 character from a string. * @param txt pointer to '\0' terminated string * @param i start byte index in 'txt' where to start. * After call it will point to the next UTF-8 char in 'txt'. * NULL to use txt[0] as index * @return the decoded Unicode character or 0 on invalid UTF-8 code */ static uint32_t lv_txt_iso8859_1_next(const char * txt, uint32_t * i) { if(i == NULL) return txt[1]; /*Get the next char */ uint8_t letter = txt[*i]; (*i)++; return letter; } /** * Get previous ISO8859-1 character form a string. * @param txt pointer to '\0' terminated string * @param i start byte index in 'txt' where to start. After the call it will point to the previous UTF-8 char in 'txt'. * @return the decoded Unicode character or 0 on invalid UTF-8 code */ static uint32_t lv_txt_iso8859_1_prev(const char * txt, uint32_t * i) { if(i == NULL) return *(txt - 1); /*Get the prev. char */ (*i)--; uint8_t letter = txt[*i]; return letter; } /** * Convert a character index (in an ISO8859-1 text) to byte index. * E.g. in "AÁRT" index of 'R' is 2th char but start at byte 3 because 'Á' is 2 bytes long * @param txt a '\0' terminated UTF-8 string * @param utf8_id character index * @return byte index of the 'utf8_id'th letter */ static uint32_t lv_txt_iso8859_1_get_byte_id(const char * txt, uint32_t utf8_id) { (void)txt; /*Unused*/ return utf8_id; /*In Non encoded no difference*/ } /** * Convert a byte index (in an ISO8859-1 text) to character index. * E.g. in "AÁRT" index of 'R' is 2th char but start at byte 3 because 'Á' is 2 bytes long * @param txt a '\0' terminated UTF-8 string * @param byte_id byte index * @return character index of the letter at 'byte_id'th position */ static uint32_t lv_txt_iso8859_1_get_char_id(const char * txt, uint32_t byte_id) { (void)txt; /*Unused*/ return byte_id; /*In Non encoded no difference*/ } /** * Get the number of characters (and NOT bytes) in a string. Decode it with UTF-8 if enabled. * E.g.: "ÁBC" is 3 characters (but 4 bytes) * @param txt a '\0' terminated char string * @return number of characters */ static uint32_t lv_txt_iso8859_1_get_length(const char * txt) { return strlen(txt); } #else #error "Invalid character encoding. See `LV_TXT_ENC` in `lv_conf.h`" #endif /********************** * STATIC FUNCTIONS **********************/ /** * Test if char is break char or not (a text can broken here or not) * @param letter a letter * @return false: 'letter' is not break char */ static inline bool is_break_char(uint32_t letter) { uint8_t i; bool ret = false; /*Compare the letter to TXT_BREAK_CHARS*/ for(i = 0; LV_TXT_BREAK_CHARS[i] != '\0'; i++) { if(letter == (uint32_t)LV_TXT_BREAK_CHARS[i]) { ret = true; /*If match then it is break char*/ break; } } return ret; }
29,185
lv_txt
c
en
c
code
{"qsc_code_num_words": 4500, "qsc_code_num_chars": 29185.0, "qsc_code_mean_word_length": 3.68733333, "qsc_code_frac_words_unique": 0.09244444, "qsc_code_frac_chars_top_2grams": 0.0424878, "qsc_code_frac_chars_top_3grams": 0.02350389, "qsc_code_frac_chars_top_4grams": 0.0419454, "qsc_code_frac_chars_dupe_5grams": 0.57427831, "qsc_code_frac_chars_dupe_6grams": 0.52082203, "qsc_code_frac_chars_dupe_7grams": 0.48502381, "qsc_code_frac_chars_dupe_8grams": 0.45718074, "qsc_code_frac_chars_dupe_9grams": 0.42529983, "qsc_code_frac_chars_dupe_10grams": 0.39902368, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.04617827, "qsc_code_frac_chars_whitespace": 0.26616413, "qsc_code_size_file_byte": 29185.0, "qsc_code_num_lines": 859.0, "qsc_code_num_chars_line_max": 124.0, "qsc_code_num_chars_line_mean": 33.97555297, "qsc_code_frac_chars_alphabet": 0.7285801, "qsc_code_frac_chars_comments": 0.41761179, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.25052632, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01111961, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.01423781, "qsc_code_frac_lines_prompt_comments": 0.00232829, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.10947368, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.18105263, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": 0.04210526}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_Icon_Note.c
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #include "lvgl.h" #ifndef LV_ATTRIBUTE_MEM_ALIGN #define LV_ATTRIBUTE_MEM_ALIGN #endif #ifndef LV_ATTRIBUTE_IMG_ESP32BERRY_ICON_NOTE #define LV_ATTRIBUTE_IMG_ESP32BERRY_ICON_NOTE #endif const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_ESP32BERRY_ICON_NOTE uint8_t ESP32Berry_Icon_Note_map[] = { 0x00, 0x00, 0x00, 0x00, /*Color of index 0*/ 0xff, 0xff, 0xff, 0x01, /*Color of index 1*/ 0xaa, 0xaa, 0xaa, 0x03, /*Color of index 2*/ 0xcc, 0xcc, 0xcc, 0x05, /*Color of index 3*/ 0xbf, 0xbf, 0xbf, 0x04, /*Color of index 4*/ 0xfb, 0xfb, 0xfb, 0xff, /*Color of index 5*/ 0x60, 0x60, 0x60, 0x10, /*Color of index 6*/ 0x55, 0x55, 0x55, 0x0f, /*Color of index 7*/ 0x69, 0x69, 0x69, 0x11, /*Color of index 8*/ 0x00, 0x00, 0x00, 0x0b, /*Color of index 9*/ 0x5a, 0x5a, 0x5a, 0x11, /*Color of index 10*/ 0x4b, 0x4b, 0x4b, 0x11, /*Color of index 11*/ 0xf3, 0xf3, 0xf3, 0xff, /*Color of index 12*/ 0xa0, 0xa0, 0xa0, 0x23, /*Color of index 13*/ 0x99, 0x99, 0x99, 0x23, /*Color of index 14*/ 0xaf, 0xaf, 0xaf, 0x33, /*Color of index 15*/ 0xc2, 0xc2, 0xc2, 0x45, /*Color of index 16*/ 0xec, 0xec, 0xec, 0xfe, /*Color of index 17*/ 0xd4, 0xd4, 0xd4, 0x85, /*Color of index 18*/ 0xcb, 0xcb, 0xcb, 0x71, /*Color of index 19*/ 0xda, 0xda, 0xda, 0xb2, /*Color of index 20*/ 0xe3, 0xe3, 0xe3, 0xed, /*Color of index 21*/ 0xde, 0xde, 0xde, 0xce, /*Color of index 22*/ 0xe4, 0xe4, 0xe4, 0xfe, /*Color of index 23*/ 0xe0, 0xe0, 0xe0, 0xde, /*Color of index 24*/ 0xe1, 0xe1, 0xe1, 0xe7, /*Color of index 25*/ 0xdf, 0xdf, 0xdf, 0xe0, /*Color of index 26*/ 0xdc, 0xdc, 0xdc, 0xd1, /*Color of index 27*/ 0xe0, 0xe0, 0xe0, 0xf6, /*Color of index 28*/ 0xdb, 0xdb, 0xdb, 0xee, /*Color of index 29*/ 0xdc, 0xdc, 0xdc, 0xfe, /*Color of index 30*/ 0xd7, 0xd7, 0xd7, 0xe0, /*Color of index 31*/ 0xd3, 0xd3, 0xd3, 0xff, /*Color of index 32*/ 0xcb, 0xcb, 0xcb, 0xff, /*Color of index 33*/ 0xc6, 0xc6, 0xc6, 0xff, /*Color of index 34*/ 0x55, 0xaa, 0xff, 0x03, /*Color of index 35*/ 0x80, 0xbf, 0xff, 0x04, /*Color of index 36*/ 0x40, 0xbf, 0xff, 0x04, /*Color of index 37*/ 0x33, 0x99, 0xcc, 0x05, /*Color of index 38*/ 0x33, 0x44, 0x55, 0x0f, /*Color of index 39*/ 0x3c, 0x5a, 0x69, 0x11, /*Color of index 40*/ 0x22, 0x44, 0x55, 0x0f, /*Color of index 41*/ 0x2d, 0x5a, 0x69, 0x11, /*Color of index 42*/ 0x11, 0x44, 0x55, 0x0f, /*Color of index 43*/ 0x1e, 0x5a, 0x69, 0x11, /*Color of index 44*/ 0x0f, 0x5a, 0x69, 0x11, /*Color of index 45*/ 0x1e, 0x4b, 0x69, 0x11, /*Color of index 46*/ 0x42, 0x92, 0xa8, 0x23, /*Color of index 47*/ 0x3a, 0x8a, 0xa8, 0x23, /*Color of index 48*/ 0x42, 0x8a, 0xa0, 0x23, /*Color of index 49*/ 0x46, 0xa0, 0xb9, 0x33, /*Color of index 50*/ 0x55, 0xb3, 0xcd, 0x45, /*Color of index 51*/ 0x3f, 0xaa, 0xcf, 0x45, /*Color of index 52*/ 0x3e, 0xa8, 0xd0, 0x46, /*Color of index 53*/ 0x69, 0xe4, 0xff, 0xff, /*Color of index 54*/ 0x55, 0xbb, 0xd9, 0x71, /*Color of index 55*/ 0x62, 0xe2, 0xff, 0xff, /*Color of index 56*/ 0x5c, 0xc3, 0xde, 0x85, /*Color of index 57*/ 0x45, 0xb6, 0xdb, 0x71, /*Color of index 58*/ 0x59, 0xe0, 0xff, 0xff, /*Color of index 59*/ 0x56, 0xe0, 0xff, 0xff, /*Color of index 60*/ 0x66, 0xde, 0xff, 0xff, /*Color of index 61*/ 0x5b, 0xdd, 0xff, 0xff, /*Color of index 62*/ 0x42, 0xb9, 0xe2, 0x85, /*Color of index 63*/ 0x4e, 0xdc, 0xff, 0xff, /*Color of index 64*/ 0x60, 0xc9, 0xe7, 0xb2, /*Color of index 65*/ 0x5f, 0xc9, 0xe7, 0xb2, /*Color of index 66*/ 0x4d, 0xd7, 0xff, 0xff, /*Color of index 67*/ 0x5e, 0xd6, 0xfa, 0xfd, /*Color of index 68*/ 0x61, 0xcc, 0xea, 0xce, /*Color of index 69*/ 0x62, 0xcf, 0xed, 0xde, /*Color of index 70*/ 0x59, 0xd4, 0xfb, 0xfe, /*Color of index 71*/ 0x62, 0xd0, 0xed, 0xe7, /*Color of index 72*/ 0x43, 0xbf, 0xea, 0xb2, /*Color of index 73*/ 0x63, 0xd0, 0xef, 0xed, /*Color of index 74*/ 0x51, 0xd2, 0xfc, 0xfe, /*Color of index 75*/ 0x48, 0xd2, 0xff, 0xff, /*Color of index 76*/ 0x5e, 0xcc, 0xec, 0xe0, /*Color of index 77*/ 0x58, 0xc7, 0xe8, 0xd1, /*Color of index 78*/ 0x4b, 0xcf, 0xfd, 0xfe, /*Color of index 79*/ 0x24, 0xd0, 0xff, 0xff, /*Color of index 80*/ 0x4d, 0xc3, 0xe9, 0xd1, /*Color of index 81*/ 0x47, 0xcd, 0xfb, 0xfe, /*Color of index 82*/ 0x43, 0xc1, 0xee, 0xce, /*Color of index 83*/ 0x44, 0xcc, 0xfb, 0xfe, /*Color of index 84*/ 0x49, 0xc5, 0xef, 0xe0, /*Color of index 85*/ 0x55, 0xca, 0xee, 0xf6, /*Color of index 86*/ 0x43, 0xc2, 0xef, 0xde, /*Color of index 87*/ 0x23, 0xcb, 0xfd, 0xfe, /*Color of index 88*/ 0x90, 0xc8, 0xe1, 0xff, /*Color of index 89*/ 0x42, 0xc3, 0xf0, 0xe7, /*Color of index 90*/ 0x43, 0xc3, 0xf0, 0xec, /*Color of index 91*/ 0x22, 0xc3, 0xf3, 0xee, /*Color of index 92*/ 0x8d, 0xc3, 0xdb, 0xfe, /*Color of index 93*/ 0x87, 0xbc, 0xd2, 0xee, /*Color of index 94*/ 0x00, 0xff, 0xff, 0x01, /*Color of index 95*/ 0x80, 0xff, 0xff, 0x04, /*Color of index 96*/ 0x55, 0xff, 0xff, 0x03, /*Color of index 97*/ 0x55, 0xaa, 0xaa, 0x03, /*Color of index 98*/ 0x30, 0x60, 0x60, 0x10, /*Color of index 99*/ 0x3c, 0x5a, 0x5a, 0x11, /*Color of index 100*/ 0xed, 0xee, 0xee, 0xfe, /*Color of index 101*/ 0xe7, 0xe7, 0xe6, 0xfe, /*Color of index 102*/ 0xf3, 0xed, 0xea, 0xff, /*Color of index 103*/ 0xea, 0xe8, 0xe6, 0xfe, /*Color of index 104*/ 0xe1, 0xdf, 0xdd, 0xee, /*Color of index 105*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 106*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 107*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 108*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 109*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 110*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 111*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 112*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 113*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 114*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 115*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 116*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 117*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 118*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 119*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 120*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 121*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 122*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 123*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 124*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 125*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 126*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 127*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 128*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 129*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 130*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 131*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 132*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 133*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 134*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 135*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 136*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 137*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 138*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 139*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 140*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 141*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 142*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 143*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 144*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 145*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 146*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 147*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 148*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 149*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 150*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 151*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 152*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 153*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 154*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 155*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 156*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 157*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 158*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 159*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 160*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 161*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 162*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 163*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 164*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 165*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 166*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 167*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 168*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 169*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 170*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 171*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 172*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 173*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 174*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 175*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 176*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 177*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 178*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 179*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 180*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 181*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 182*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 183*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 184*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 185*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 186*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 187*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 188*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 189*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 190*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 191*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 192*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 193*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 194*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 195*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 196*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 197*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 198*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 199*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 200*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 201*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 202*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 203*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 204*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 205*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 206*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 207*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 208*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 209*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 210*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 211*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 212*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 213*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 214*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 215*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 216*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 217*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 218*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 219*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 220*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 221*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 222*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 223*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 224*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 225*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 226*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 227*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 228*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 229*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 230*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 231*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 232*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 233*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 234*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 235*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 236*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 237*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 238*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 239*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 240*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 241*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 242*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 243*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 244*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 245*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 246*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 247*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 248*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 249*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 250*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 251*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 252*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 253*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 254*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 255*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x60, 0x61, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x61, 0x60, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x27, 0x63, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x63, 0x27, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x33, 0x39, 0x41, 0x45, 0x46, 0x48, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x4a, 0x48, 0x46, 0x45, 0x42, 0x39, 0x33, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x37, 0x4d, 0x3d, 0x36, 0x36, 0x36, 0x38, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x3d, 0x38, 0x36, 0x36, 0x36, 0x3d, 0x4d, 0x37, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x2f, 0x4e, 0x36, 0x3d, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x36, 0x4e, 0x31, 0x00, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x32, 0x56, 0x38, 0x44, 0x44, 0x47, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x47, 0x44, 0x44, 0x38, 0x56, 0x32, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x00, 0x30, 0x56, 0x3e, 0x44, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x47, 0x44, 0x3e, 0x56, 0x30, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x3b, 0x4b, 0x4b, 0x4b, 0x47, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x47, 0x4b, 0x4b, 0x4b, 0x3b, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x3a, 0x3c, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x4b, 0x3c, 0x3a, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x43, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4c, 0x4b, 0x4b, 0x43, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x35, 0x43, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x43, 0x35, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0x3f, 0x40, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x40, 0x3f, 0x00, 0x25, 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x49, 0x40, 0x52, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x52, 0x40, 0x49, 0x00, 0x61, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x53, 0x43, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x4f, 0x52, 0x43, 0x53, 0x00, 0x5f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x43, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x54, 0x43, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x09, 0x5a, 0x4c, 0x54, 0x52, 0x54, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x54, 0x52, 0x52, 0x4c, 0x5a, 0x09, 0x00, 0x5f, 0x00, 0x00, 0x5f, 0x00, 0x2b, 0x5b, 0x4c, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x4c, 0x5b, 0x29, 0x00, 0x5f, 0x00, 0x00, 0x5f, 0x00, 0x2e, 0x5b, 0x4c, 0x54, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x52, 0x4f, 0x5b, 0x2e, 0x00, 0x5f, 0x00, 0x00, 0x5f, 0x00, 0x2d, 0x5c, 0x50, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x58, 0x50, 0x5c, 0x2c, 0x00, 0x5f, 0x00, 0x00, 0x5f, 0x00, 0x28, 0x5e, 0x59, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x5d, 0x59, 0x5e, 0x64, 0x00, 0x5f, 0x00, 0x00, 0x01, 0x00, 0x08, 0x69, 0x67, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x67, 0x69, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x0c, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x0c, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x0b, 0x15, 0x21, 0x1e, 0x22, 0x1e, 0x22, 0x1e, 0x21, 0x20, 0x20, 0x21, 0x1e, 0x22, 0x1e, 0x22, 0x1e, 0x21, 0x20, 0x20, 0x21, 0x1e, 0x22, 0x1e, 0x22, 0x1e, 0x21, 0x20, 0x20, 0x20, 0x20, 0x21, 0x1e, 0x22, 0x1e, 0x22, 0x1e, 0x21, 0x20, 0x20, 0x21, 0x1e, 0x22, 0x1e, 0x22, 0x1e, 0x21, 0x20, 0x20, 0x21, 0x1e, 0x22, 0x1e, 0x22, 0x1e, 0x21, 0x15, 0x0b, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x65, 0x11, 0x66, 0x11, 0x66, 0x68, 0x68, 0x11, 0x68, 0x68, 0x11, 0x17, 0x11, 0x66, 0x11, 0x66, 0x11, 0x66, 0x68, 0x11, 0x17, 0x11, 0x66, 0x11, 0x66, 0x11, 0x66, 0x68, 0x11, 0x66, 0x11, 0x66, 0x11, 0x66, 0x68, 0x68, 0x11, 0x68, 0x68, 0x68, 0x66, 0x11, 0x66, 0x11, 0x66, 0x11, 0x66, 0x68, 0x68, 0x68, 0x11, 0x66, 0x11, 0x11, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x0c, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x0c, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x0c, 0x11, 0x11, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x65, 0x11, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x65, 0x65, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x0c, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x0c, 0x11, 0x11, 0x11, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x11, 0x11, 0x65, 0x11, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x0c, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x0c, 0x11, 0x11, 0x11, 0x65, 0x11, 0x11, 0x65, 0x65, 0x65, 0x11, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x65, 0x11, 0x11, 0x11, 0x65, 0x11, 0x11, 0x65, 0x65, 0x65, 0x11, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x11, 0x0c, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x0c, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x0c, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x1d, 0x11, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x66, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x11, 0x1d, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x69, 0x0c, 0x68, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x68, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x68, 0x11, 0x68, 0x11, 0x11, 0x11, 0x68, 0x11, 0x65, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x0c, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x11, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x0c, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x0c, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x11, 0x11, 0x11, 0x0c, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x0c, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x0c, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x0c, 0x11, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x11, 0x11, 0x11, 0x11, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x0c, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x0c, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x11, 0x11, 0x11, 0x11, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x11, 0x11, 0x65, 0x11, 0x11, 0x0c, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x0c, 0x11, 0x11, 0x65, 0x65, 0x11, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x11, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x65, 0x0c, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x0c, 0x11, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x11, 0x0c, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x0c, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x0c, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x69, 0x65, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x65, 0x69, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x1d, 0x11, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x17, 0x66, 0x66, 0x66, 0x17, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x17, 0x11, 0x1d, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x0c, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x0c, 0x15, 0x08, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x08, 0x15, 0x0c, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x11, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x11, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x11, 0x11, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x11, 0x0c, 0x15, 0x0a, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x07, 0x15, 0x0c, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x11, 0x0c, 0x15, 0x07, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x09, 0x19, 0x0c, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x0c, 0x19, 0x09, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x0c, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x11, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x16, 0x05, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x65, 0x11, 0x11, 0x65, 0x65, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x05, 0x16, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x14, 0x05, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x11, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x65, 0x05, 0x14, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x12, 0x05, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x11, 0x65, 0x11, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x11, 0x11, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x05, 0x12, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x0c, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x0c, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x11, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x11, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x13, 0x05, 0x65, 0x65, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x11, 0x65, 0x11, 0x11, 0x65, 0x65, 0x65, 0x11, 0x11, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x11, 0x65, 0x65, 0x05, 0x13, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, 0x05, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x05, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0d, 0x1c, 0x0c, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x11, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x0c, 0x1c, 0x0e, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0f, 0x1c, 0x05, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x11, 0x65, 0x11, 0x11, 0x11, 0x65, 0x65, 0x11, 0x65, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x65, 0x05, 0x1c, 0x0f, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x0d, 0x1b, 0x05, 0x0c, 0x65, 0x65, 0x11, 0x65, 0x11, 0x65, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x11, 0x11, 0x65, 0x11, 0x11, 0x65, 0x11, 0x11, 0x11, 0x11, 0x11, 0x65, 0x11, 0x65, 0x65, 0x65, 0x65, 0x0c, 0x05, 0x1b, 0x0d, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x13, 0x1a, 0x0c, 0x05, 0x05, 0x05, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x05, 0x05, 0x05, 0x0c, 0x1a, 0x13, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x10, 0x12, 0x14, 0x16, 0x18, 0x19, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x19, 0x18, 0x16, 0x14, 0x12, 0x10, 0x09, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x07, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x0a, 0x06, 0x07, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const lv_img_dsc_t ESP32Berry_Icon_Note = { .header.cf = LV_IMG_CF_INDEXED_8BIT, .header.always_zero = 0, .header.reserved = 0, .header.w = 64, .header.h = 64, .data_size = 5120, .data = ESP32Berry_Icon_Note_map, };
38,284
ESP32Berry_Icon_Note
c
en
c
code
{"qsc_code_num_words": 6250, "qsc_code_num_chars": 38284.0, "qsc_code_mean_word_length": 3.9528, "qsc_code_frac_words_unique": 0.07728, "qsc_code_frac_chars_top_2grams": 0.34098361, "qsc_code_frac_chars_top_3grams": 0.40024287, "qsc_code_frac_chars_top_4grams": 0.40736693, "qsc_code_frac_chars_dupe_5grams": 0.84355394, "qsc_code_frac_chars_dupe_6grams": 0.81732443, "qsc_code_frac_chars_dupe_7grams": 0.78024691, "qsc_code_frac_chars_dupe_8grams": 0.60165958, "qsc_code_frac_chars_dupe_9grams": 0.59064967, "qsc_code_frac_chars_dupe_10grams": 0.58336369, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.48069995, "qsc_code_frac_chars_whitespace": 0.18796364, "qsc_code_size_file_byte": 38284.0, "qsc_code_num_lines": 350.0, "qsc_code_num_chars_line_max": 387.0, "qsc_code_num_chars_line_mean": 109.38285714, "qsc_code_frac_chars_alphabet": 0.31397967, "qsc_code_frac_chars_comments": 0.15129036, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.47337278, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00018466, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.630309, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.0, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.00295858, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": 0.02071006}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 1, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 1, "qsc_code_frac_chars_dupe_6grams": 1, "qsc_code_frac_chars_dupe_7grams": 1, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 1, "qsc_code_frac_chars_alphabet": 1, "qsc_code_frac_chars_digital": 1, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 1, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_AppBase.cpp
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #include "ESP32Berry_AppBase.h" static AppBase *instance = NULL; AppBase::AppBase(Display *display, System *system, Network *network, const char *title) { instance = this; _display = display; _bodyScreen = display->get_body_screen(); _system = system; _network = network; this->ui_app(title); } AppBase::~AppBase() {} extern "C" void base_event_handler_thunk(lv_event_t *e) { instance->base_event_handler(e); } void AppBase::base_event_handler(lv_event_t *e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t *btn = lv_event_get_target(e); if (code == LV_EVENT_CLICKED) { this->close_app(); } } void AppBase::ui_app(const char *title) { appMain = lv_obj_create(_bodyScreen); lv_obj_set_size(appMain, DISPLAY_WIDTH, DISPLAY_HEIGHT - 40); lv_obj_align(appMain, LV_ALIGN_TOP_LEFT, -16, -16); lv_obj_clear_flag(appMain, LV_OBJ_FLAG_SCROLLABLE); closeBtn = lv_btn_create(appMain); lv_obj_set_size(closeBtn, 30, 30); lv_obj_align(closeBtn, LV_ALIGN_TOP_RIGHT, 12, -4); lv_obj_add_event_cb(closeBtn, base_event_handler_thunk, LV_EVENT_CLICKED, NULL); lv_obj_t *label = lv_label_create(closeBtn); lv_label_set_text(label, LV_SYMBOL_CLOSE); lv_obj_center(label); appTitle = lv_label_create(appMain); lv_label_set_text(appTitle, title); lv_obj_align(appTitle, LV_ALIGN_TOP_LEFT, 4, 0); lv_obj_set_style_text_font(appTitle, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT); }
1,714
ESP32Berry_AppBase
cpp
en
cpp
code
{"qsc_code_num_words": 245, "qsc_code_num_chars": 1714.0, "qsc_code_mean_word_length": 4.4244898, "qsc_code_frac_words_unique": 0.36326531, "qsc_code_frac_chars_top_2grams": 0.0599631, "qsc_code_frac_chars_top_3grams": 0.05904059, "qsc_code_frac_chars_top_4grams": 0.04797048, "qsc_code_frac_chars_dupe_5grams": 0.05166052, "qsc_code_frac_chars_dupe_6grams": 0.05166052, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01593625, "qsc_code_frac_chars_whitespace": 0.12135356, "qsc_code_size_file_byte": 1714.0, "qsc_code_num_lines": 54.0, "qsc_code_num_chars_line_max": 97.0, "qsc_code_num_chars_line_mean": 31.74074074, "qsc_code_frac_chars_alphabet": 0.70385126, "qsc_code_frac_chars_comments": 0.15752625, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01453287, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codecpp_frac_lines_preprocessor_directives": 0.02631579, "qsc_codecpp_frac_lines_func_ratio": 0.02631579, "qsc_codecpp_cate_bitsstdc": 0.0, "qsc_codecpp_nums_lines_main": 0.0, "qsc_codecpp_frac_lines_goto": 0.0, "qsc_codecpp_cate_var_zero": 0.0, "qsc_codecpp_score_lines_no_logic": 0.05263158, "qsc_codecpp_frac_lines_print": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codecpp_frac_lines_func_ratio": 0, "qsc_codecpp_nums_lines_main": 0, "qsc_codecpp_score_lines_no_logic": 0, "qsc_codecpp_frac_lines_preprocessor_directives": 0, "qsc_codecpp_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_AppESPNow.cpp
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #include "ESP32Berry_AppESPNow.h" static AppESPNow *instance = NULL; AppESPNow::AppESPNow(Display *display, System *system, Network *network, const char *title) : AppBase(display, system, network, title) { _bodyScreen = display->get_body_screen(); instance = this; this->draw_ui(); } AppESPNow::~AppESPNow() {} extern "C" void esp_textarea_event_cb_thunk(lv_event_t *e) { instance->_display->textarea_event_cb(e); } extern "C" void esp_event_handler_thunk(lv_event_t *e) { instance->esp_event_handler(e); } extern "C" void esp_on_data_sent_thunk(const uint8_t *macAddr, esp_now_send_status_t status) { instance->esp_on_data_sent(macAddr, status); } extern "C" void esp_on_data_receive_thunk(const uint8_t *macAddr, const uint8_t *incomingData, int len) { instance->esp_on_data_receive(macAddr, incomingData, len); } void AppESPNow::esp_on_data_sent(const uint8_t *macAddr, esp_now_send_status_t status) { if (status == ESP_NOW_SEND_SUCCESS) { String myMsg = String(lv_textarea_get_text(textField)); myMsg.trim(); if (myMsg.length() > 0) { if ((_system->get_local_time_for_msg()).length() > 0) { this->add_msg(true, _system->get_local_time_for_msg() + "\n" + myMsg); } else { this->add_msg(true, myMsg); } } } else { this->add_msg(true, "Error sending the data"); } } void AppESPNow::esp_on_data_receive(const uint8_t *macAddr, const uint8_t *incomingData, int len) { memcpy(&received_message, incomingData, sizeof(received_message)); if (len > 0) { String id = received_message.id; String msg = received_message.msg; if ((_system->get_local_time_for_msg()).length() > 0) { char buffer[len + (_system->get_local_time_for_msg()).length()]; sprintf(buffer, "%s\n[%s] - %s", _system->get_local_time_for_msg(), id, msg); this->add_msg(false, String(buffer)); } else { char buffer[len]; sprintf(buffer, "[%s] - %s", id, msg); this->add_msg(false, String(buffer)); } } } String AppESPNow::get_string_mac(uint8_t addr[]) { String temp; for (int i = 0; i < 6; ++i) { char buf[3]; sprintf(buf, "%02X", addr[i]); temp += buf; if (i < 5) temp += ':'; } return temp; } void AppESPNow::esp_event_handler(lv_event_t *e) { lv_event_code_t code = lv_event_get_code(e); lv_obj_t *obj = lv_event_get_target(e); if (code == LV_EVENT_CLICKED) { if (obj == sendBtn) { String myMsg = String(lv_textarea_get_text(textField)); myMsg.trim(); if (myMsg.length() > 0) { send_message.id = DEVICE_NAME; send_message.msg = myMsg; esp_now_send(peerMacAddr, (uint8_t *)&send_message, sizeof(send_message)); } } else if (obj == mboxConnectBtn) { String peerAddr = String(lv_textarea_get_text(mboxInput)); peerAddr.trim(); if (peerAddr.length() != 12) { _display->ui_popup_open("[Error]", "Check The Peer's Mac Address.\n(Enter without colons.)"); return; } lv_obj_move_background(mboxConnect); lv_obj_add_flag(mboxConnect, LV_OBJ_FLAG_HIDDEN); sscanf(peerAddr.c_str(), "%2hhx%2hhx%2hhx%2hhx%2hhx%2hhx", &peerMacAddr[0], &peerMacAddr[1], &peerMacAddr[2], &peerMacAddr[3], &peerMacAddr[4], &peerMacAddr[5]); memset(&peerInfo, 0, sizeof(peerInfo)); memcpy(peerInfo.peer_addr, peerMacAddr, 6); peerInfo.encrypt = false; peerInfo.channel = WiFi.channel(); this->init_espnow(); } } } void AppESPNow::draw_ui() { lv_style_init(&msgStyle); lv_style_set_bg_color(&msgStyle, lv_color_white()); lv_style_set_pad_ver(&msgStyle, 8); lv_style_set_border_color(&msgStyle, lv_palette_main(LV_PALETTE_BLUE)); lv_style_set_border_width(&msgStyle, 2); lv_style_set_border_opa(&msgStyle, LV_OPA_50); lv_style_set_border_side(&msgStyle, LV_BORDER_SIDE_BOTTOM); myMacLabel = lv_label_create(appMain); lv_label_set_long_mode(myMacLabel, LV_LABEL_LONG_SCROLL_CIRCULAR); lv_obj_set_width(myMacLabel, 240); lv_label_set_text(myMacLabel, _network->get_mac_address().c_str()); lv_obj_align_to(myMacLabel, appTitle, LV_ALIGN_OUT_RIGHT_TOP, 14, -7); bottomPart = lv_obj_create(appMain); lv_obj_remove_style_all(bottomPart); lv_obj_add_flag(bottomPart, LV_OBJ_FLAG_HIDDEN); lv_obj_set_size(bottomPart, DISPLAY_WIDTH, 50); lv_obj_align(bottomPart, LV_ALIGN_BOTTOM_MID, 0, 20); lv_obj_clear_flag(bottomPart, LV_OBJ_FLAG_SCROLLABLE); textField = lv_textarea_create(bottomPart); lv_obj_set_size(textField, DISPLAY_WIDTH * 2 / 3 - 10, 40); lv_obj_align(textField, LV_ALIGN_LEFT_MID, 10, 0); lv_textarea_set_placeholder_text(textField, "typing?"); lv_obj_add_event_cb(textField, esp_textarea_event_cb_thunk, LV_EVENT_FOCUSED, NULL); lv_obj_add_event_cb(textField, esp_textarea_event_cb_thunk, LV_EVENT_DEFOCUSED, NULL); sendBtn = lv_btn_create(bottomPart); lv_obj_set_size(sendBtn, DISPLAY_WIDTH * 1 / 3 - 20, 40); lv_obj_align(sendBtn, LV_ALIGN_RIGHT_MID, 0, 0); lv_obj_t *btnLabel = lv_label_create(sendBtn); lv_label_set_text(btnLabel, "Send"); lv_obj_center(btnLabel); lv_obj_add_event_cb(sendBtn, esp_event_handler_thunk, LV_EVENT_CLICKED, NULL); msgList = lv_list_create(appMain); lv_obj_set_size(msgList, DISPLAY_WIDTH, 180); lv_obj_align_to(msgList, bottomPart, LV_ALIGN_OUT_TOP_MID, 0, -2); ui_espnow_conenct_box(); } void AppESPNow::init_espnow() { esp_wifi_set_channel(WiFi.channel(), WIFI_SECOND_CHAN_NONE); if (esp_now_init() != ESP_OK) { _display->ui_popup_open("[Error]", "There was an error initializing ESP-NOW"); return; } if (esp_now_add_peer(&peerInfo) != ESP_OK) { lv_obj_move_foreground(mboxConnect); lv_obj_clear_flag(mboxConnect, LV_OBJ_FLAG_HIDDEN); _display->ui_popup_open("[Error]", "Failed to add peer"); return; } esp_now_register_send_cb(esp_on_data_sent_thunk); esp_now_register_recv_cb(esp_on_data_receive_thunk); lv_obj_clear_flag(bottomPart, LV_OBJ_FLAG_HIDDEN); String connectedInfo = "My Mac: "; connectedInfo += _network->get_mac_address(); connectedInfo += "\n"; connectedInfo += "Peer Mac: "; connectedInfo += get_string_mac(peerMacAddr); lv_label_set_text(myMacLabel, connectedInfo.c_str()); lv_textarea_set_text(textField, "Hello!"); lv_event_send(sendBtn, LV_EVENT_CLICKED, NULL); } void AppESPNow::ui_espnow_conenct_box() { mboxConnect = lv_obj_create(appMain); lv_obj_set_size(mboxConnect, DISPLAY_WIDTH * 2 / 3, DISPLAY_HEIGHT / 2); lv_obj_center(mboxConnect); lv_obj_t *mboxTitle = lv_label_create(mboxConnect); lv_label_set_text(mboxTitle, "Enter the Mac Address of the connected device"); lv_obj_set_size(mboxTitle, DISPLAY_WIDTH * 2 / 3 - 40, 40); lv_obj_align(mboxTitle, LV_ALIGN_TOP_MID, 0, 0); mboxInput = lv_textarea_create(mboxConnect); lv_obj_set_size(mboxInput, DISPLAY_WIDTH * 2 / 3 - 40, 40); lv_obj_align_to(mboxInput, mboxTitle, LV_ALIGN_TOP_MID, 0, 40); lv_textarea_set_placeholder_text(mboxInput, "Like 30AEA45DD4B4"); lv_obj_add_event_cb(mboxInput, esp_textarea_event_cb_thunk, LV_EVENT_FOCUSED, NULL); lv_obj_add_event_cb(mboxInput, esp_textarea_event_cb_thunk, LV_EVENT_DEFOCUSED, NULL); mboxConnectBtn = lv_btn_create(mboxConnect); lv_obj_add_event_cb(mboxConnectBtn, esp_event_handler_thunk, LV_EVENT_ALL, NULL); lv_obj_align(mboxConnectBtn, LV_ALIGN_BOTTOM_RIGHT, 0, 0); lv_obj_t *btnLabel = lv_label_create(mboxConnectBtn); lv_label_set_text(btnLabel, "Connect"); lv_obj_center(btnLabel); } void AppESPNow::add_msg(bool isMine, String msg) { lv_obj_t *text = lv_list_add_text(msgList, msg.c_str()); lv_obj_add_style(text, &msgStyle, 0); lv_label_set_long_mode(text, LV_LABEL_LONG_WRAP); lv_obj_set_style_text_align(text, isMine ? LV_TEXT_ALIGN_RIGHT : LV_TEXT_ALIGN_LEFT, 0); lv_obj_scroll_to_y(msgList, lv_obj_get_scroll_y(msgList) + lv_obj_get_height(msgList), LV_ANIM_ON); if (isMine) lv_textarea_set_text(textField, ""); } void AppESPNow::close_app() { if (appMain != NULL) { if (esp_now_del_peer(peerMacAddr) == ESP_OK) { esp_now_unregister_recv_cb(); esp_now_unregister_send_cb(); esp_now_deinit(); } delay(1); lv_obj_del_async(appMain); appMain = NULL; delete this; } }
8,524
ESP32Berry_AppESPNow
cpp
en
cpp
code
{"qsc_code_num_words": 1241, "qsc_code_num_chars": 8524.0, "qsc_code_mean_word_length": 4.47864625, "qsc_code_frac_words_unique": 0.182917, "qsc_code_frac_chars_top_2grams": 0.04587981, "qsc_code_frac_chars_top_3grams": 0.0129543, "qsc_code_frac_chars_top_4grams": 0.01511335, "qsc_code_frac_chars_dupe_5grams": 0.35678302, "qsc_code_frac_chars_dupe_6grams": 0.26124505, "qsc_code_frac_chars_dupe_7grams": 0.16948543, "qsc_code_frac_chars_dupe_8grams": 0.15869018, "qsc_code_frac_chars_dupe_9grams": 0.13530047, "qsc_code_frac_chars_dupe_10grams": 0.09823678, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01511404, "qsc_code_frac_chars_whitespace": 0.1461755, "qsc_code_size_file_byte": 8524.0, "qsc_code_num_lines": 241.0, "qsc_code_num_chars_line_max": 168.0, "qsc_code_num_chars_line_mean": 35.36929461, "qsc_code_frac_chars_alphabet": 0.7485573, "qsc_code_frac_chars_comments": 0.03167527, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.09230769, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.04179285, "qsc_code_frac_chars_long_word_length": 0.00629921, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codecpp_frac_lines_preprocessor_directives": 0.00512821, "qsc_codecpp_frac_lines_func_ratio": 0.02051282, "qsc_codecpp_cate_bitsstdc": 0.0, "qsc_codecpp_nums_lines_main": 0.0, "qsc_codecpp_frac_lines_goto": 0.0, "qsc_codecpp_cate_var_zero": 0.0, "qsc_codecpp_score_lines_no_logic": 0.04615385, "qsc_codecpp_frac_lines_print": 0.01538462}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codecpp_frac_lines_func_ratio": 0, "qsc_codecpp_nums_lines_main": 0, "qsc_codecpp_score_lines_no_logic": 0, "qsc_codecpp_frac_lines_preprocessor_directives": 0, "qsc_codecpp_frac_lines_print": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_task.c
/** * @file lv_task.c * An 'lv_task' is a void (*fp) (void* param) type function which will be called periodically. * A priority (5 levels + disable) can be assigned to lv_tasks. */ /********************* * INCLUDES *********************/ #include <stddef.h> #include "lv_task.h" #include "../lv_misc/lv_debug.h" #include "../lv_hal/lv_hal_tick.h" #include "lv_gc.h" #if defined(LV_GC_INCLUDE) #include LV_GC_INCLUDE #endif /* LV_ENABLE_GC */ /********************* * DEFINES *********************/ #define IDLE_MEAS_PERIOD 500 /*[ms]*/ #define DEF_PRIO LV_TASK_PRIO_MID #define DEF_PERIOD 500 /********************** * TYPEDEFS **********************/ /********************** * STATIC PROTOTYPES **********************/ static bool lv_task_exec(lv_task_t * task); static uint32_t lv_task_time_remaining(lv_task_t * task); /********************** * STATIC VARIABLES **********************/ static bool lv_task_run = false; static uint8_t idle_last = 0; static bool task_deleted; static bool task_list_changed; static bool task_created; /********************** * MACROS **********************/ /********************** * GLOBAL FUNCTIONS **********************/ /** * Init the lv_task module */ void _lv_task_core_init(void) { _lv_ll_init(&LV_GC_ROOT(_lv_task_ll), sizeof(lv_task_t)); task_list_changed = false; /*Initially enable the lv_task handling*/ lv_task_enable(true); } /** * Call it periodically to handle lv_tasks. * @return the time after which it must be called again */ LV_ATTRIBUTE_TASK_HANDLER uint32_t lv_task_handler(void) { LV_LOG_TRACE("lv_task_handler started"); /*Avoid concurrent running of the task handler*/ static bool already_running = false; if(already_running) return 1; already_running = true; static uint32_t idle_period_start = 0; static uint32_t handler_start = 0; static uint32_t busy_time = 0; static uint32_t time_till_next; if(lv_task_run == false) { already_running = false; /*Release mutex*/ return 1; } handler_start = lv_tick_get(); /* Run all task from the highest to the lowest priority * If a lower priority task is executed check task again from the highest priority * but on the priority of executed tasks don't run tasks before the executed*/ lv_task_t * task_interrupter = NULL; lv_task_t * next; bool end_flag; do { end_flag = true; task_deleted = false; task_created = false; LV_GC_ROOT(_lv_task_act) = _lv_ll_get_head(&LV_GC_ROOT(_lv_task_ll)); while(LV_GC_ROOT(_lv_task_act)) { /* The task might be deleted if it runs only once ('once = 1') * So get next element until the current is surely valid*/ next = _lv_ll_get_next(&LV_GC_ROOT(_lv_task_ll), LV_GC_ROOT(_lv_task_act)); /*We reach priority of the turned off task. There is nothing more to do.*/ if(((lv_task_t *)LV_GC_ROOT(_lv_task_act))->prio == LV_TASK_PRIO_OFF) { break; } /*Here is the interrupter task. Don't execute it again.*/ if(LV_GC_ROOT(_lv_task_act) == task_interrupter) { task_interrupter = NULL; /*From this point only task after the interrupter comes, so the interrupter is not interesting anymore*/ LV_GC_ROOT(_lv_task_act) = next; continue; /*Load the next task*/ } /*Just try to run the tasks with highest priority.*/ if(((lv_task_t *)LV_GC_ROOT(_lv_task_act))->prio == LV_TASK_PRIO_HIGHEST) { lv_task_exec(LV_GC_ROOT(_lv_task_act)); } /*Tasks with higher priority than the interrupted shall be run in every case*/ else if(task_interrupter) { if(((lv_task_t *)LV_GC_ROOT(_lv_task_act))->prio > task_interrupter->prio) { if(lv_task_exec(LV_GC_ROOT(_lv_task_act))) { if(!task_created && !task_deleted) { /*Check all tasks again from the highest priority */ task_interrupter = LV_GC_ROOT(_lv_task_act); end_flag = false; break; } } } } /* It is no interrupter task or we already reached it earlier. * Just run the remaining tasks*/ else { if(lv_task_exec(LV_GC_ROOT(_lv_task_act))) { if(!task_created && !task_deleted) { task_interrupter = LV_GC_ROOT(_lv_task_act); /*Check all tasks again from the highest priority */ end_flag = false; break; } } } /*If a task was created or deleted then this or the next item might be corrupted*/ if(task_created || task_deleted) { task_interrupter = NULL; break; } if(task_list_changed) { task_interrupter = NULL; end_flag = false; task_list_changed = false; break; } LV_GC_ROOT(_lv_task_act) = next; /*Load the next task*/ } } while(!end_flag); busy_time += lv_tick_elaps(handler_start); uint32_t idle_period_time = lv_tick_elaps(idle_period_start); if(idle_period_time >= IDLE_MEAS_PERIOD) { idle_last = (uint32_t)((uint32_t)busy_time * 100) / IDLE_MEAS_PERIOD; /*Calculate the busy percentage*/ idle_last = idle_last > 100 ? 0 : 100 - idle_last; /*But we need idle time*/ busy_time = 0; idle_period_start = lv_tick_get(); } time_till_next = LV_NO_TASK_READY; next = _lv_ll_get_head(&LV_GC_ROOT(_lv_task_ll)); while(next) { if(next->prio != LV_TASK_PRIO_OFF) { uint32_t delay = lv_task_time_remaining(next); if(delay < time_till_next) time_till_next = delay; } next = _lv_ll_get_next(&LV_GC_ROOT(_lv_task_ll), next); /*Find the next task*/ } already_running = false; /*Release the mutex*/ LV_LOG_TRACE("lv_task_handler ready"); return time_till_next; } /** * Create an "empty" task. It needs to initialized with at least * `lv_task_set_cb` and `lv_task_set_period` * @return pointer to the created task */ lv_task_t * lv_task_create_basic(void) { lv_task_t * new_task = NULL; lv_task_t * tmp; /*Create task lists in order of priority from high to low*/ tmp = _lv_ll_get_head(&LV_GC_ROOT(_lv_task_ll)); /*It's the first task*/ if(NULL == tmp) { new_task = _lv_ll_ins_head(&LV_GC_ROOT(_lv_task_ll)); LV_ASSERT_MEM(new_task); if(new_task == NULL) return NULL; } /*Insert the new task to proper place according to its priority*/ else { do { if(tmp->prio <= DEF_PRIO) { new_task = _lv_ll_ins_prev(&LV_GC_ROOT(_lv_task_ll), tmp); LV_ASSERT_MEM(new_task); if(new_task == NULL) return NULL; break; } tmp = _lv_ll_get_next(&LV_GC_ROOT(_lv_task_ll), tmp); } while(tmp != NULL); /*Only too high priority tasks were found. Add the task to the end*/ if(tmp == NULL) { new_task = _lv_ll_ins_tail(&LV_GC_ROOT(_lv_task_ll)); LV_ASSERT_MEM(new_task); if(new_task == NULL) return NULL; } } task_list_changed = true; new_task->period = DEF_PERIOD; new_task->task_cb = NULL; new_task->prio = DEF_PRIO; new_task->repeat_count = -1; new_task->last_run = lv_tick_get(); new_task->user_data = NULL; task_created = true; return new_task; } /** * Create a new lv_task * @param task_xcb a callback which is the task itself. It will be called periodically. * (the 'x' in the argument name indicates that its not a fully generic function because it not follows * the `func_name(object, callback, ...)` convention) * @param period call period in ms unit * @param prio priority of the task (LV_TASK_PRIO_OFF means the task is stopped) * @param user_data custom parameter * @return pointer to the new task */ lv_task_t * lv_task_create(lv_task_cb_t task_xcb, uint32_t period, lv_task_prio_t prio, void * user_data) { lv_task_t * new_task = lv_task_create_basic(); LV_ASSERT_MEM(new_task); if(new_task == NULL) return NULL; lv_task_set_cb(new_task, task_xcb); lv_task_set_period(new_task, period); lv_task_set_prio(new_task, prio); new_task->user_data = user_data; return new_task; } /** * Set the callback the task (the function to call periodically) * @param task pointer to a task * @param task_cb the function to call periodically */ void lv_task_set_cb(lv_task_t * task, lv_task_cb_t task_cb) { task->task_cb = task_cb; } /** * Delete a lv_task * @param task pointer to task created by task */ void lv_task_del(lv_task_t * task) { _lv_ll_remove(&LV_GC_ROOT(_lv_task_ll), task); task_list_changed = true; lv_mem_free(task); if(LV_GC_ROOT(_lv_task_act) == task) task_deleted = true; /*The active task was deleted*/ } /** * Set new priority for a lv_task * @param task pointer to a lv_task * @param prio the new priority */ void lv_task_set_prio(lv_task_t * task, lv_task_prio_t prio) { if(task->prio == prio) return; /*Find the tasks with new priority*/ lv_task_t * i; _LV_LL_READ(LV_GC_ROOT(_lv_task_ll), i) { if(i->prio <= prio) { if(i != task) _lv_ll_move_before(&LV_GC_ROOT(_lv_task_ll), task, i); break; } } /*There was no such a low priority so far then add the node to the tail*/ if(i == NULL) { _lv_ll_move_before(&LV_GC_ROOT(_lv_task_ll), task, NULL); } task_list_changed = true; task->prio = prio; } /** * Set new period for a lv_task * @param task pointer to a lv_task * @param period the new period */ void lv_task_set_period(lv_task_t * task, uint32_t period) { task->period = period; } /** * Make a lv_task ready. It will not wait its period. * @param task pointer to a lv_task. */ void lv_task_ready(lv_task_t * task) { task->last_run = lv_tick_get() - task->period - 1; } /** * Set the number of times a task will repeat. * @param task pointer to a lv_task. * @param repeat_count -1 : infinity; 0 : stop ; n>0: residual times */ void lv_task_set_repeat_count(lv_task_t * task, int32_t repeat_count) { task->repeat_count = repeat_count; } /** * Reset a lv_task. * It will be called the previously set period milliseconds later. * @param task pointer to a lv_task. */ void lv_task_reset(lv_task_t * task) { task->last_run = lv_tick_get(); } /** * Enable or disable the whole lv_task handling * @param en: true: lv_task handling is running, false: lv_task handling is suspended */ void lv_task_enable(bool en) { lv_task_run = en; } /** * Get idle percentage * @return the lv_task idle in percentage */ uint8_t lv_task_get_idle(void) { return idle_last; } /** * Iterate through the tasks * @param task NULL to start iteration or the previous return value to get the next task * @return the next task or NULL if there is no more task */ lv_task_t * lv_task_get_next(lv_task_t * task) { if(task == NULL) return _lv_ll_get_head(&LV_GC_ROOT(_lv_task_ll)); else return _lv_ll_get_next(&LV_GC_ROOT(_lv_task_ll), task); } /********************** * STATIC FUNCTIONS **********************/ /** * Execute task if its the priority is appropriate * @param task pointer to lv_task * @return true: execute, false: not executed */ static bool lv_task_exec(lv_task_t * task) { bool exec = false; if(lv_task_time_remaining(task) == 0) { task->last_run = lv_tick_get(); task_deleted = false; task_created = false; if(task->task_cb) task->task_cb(task); /*Delete if it was a one shot lv_task*/ if(task_deleted == false) { /*The task might be deleted by itself as well*/ if(task->repeat_count > 0) { task->repeat_count--; } if(task->repeat_count == 0) { lv_task_del(task); } } exec = true; } return exec; } /** * Find out how much time remains before a task must be run. * @param task pointer to lv_task * @return the time remaining, or 0 if it needs to be run again */ static uint32_t lv_task_time_remaining(lv_task_t * task) { /*Check if at least 'period' time elapsed*/ uint32_t elp = lv_tick_elaps(task->last_run); if(elp >= task->period) return 0; return task->period - elp; }
13,058
lv_task
c
en
c
code
{"qsc_code_num_words": 1868, "qsc_code_num_chars": 13058.0, "qsc_code_mean_word_length": 3.88115632, "qsc_code_frac_words_unique": 0.15042827, "qsc_code_frac_chars_top_2grams": 0.10262069, "qsc_code_frac_chars_top_3grams": 0.0342069, "qsc_code_frac_chars_top_4grams": 0.04275862, "qsc_code_frac_chars_dupe_5grams": 0.32427586, "qsc_code_frac_chars_dupe_6grams": 0.26358621, "qsc_code_frac_chars_dupe_7grams": 0.22248276, "qsc_code_frac_chars_dupe_8grams": 0.1822069, "qsc_code_frac_chars_dupe_9grams": 0.15186207, "qsc_code_frac_chars_dupe_10grams": 0.13958621, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00710047, "qsc_code_frac_chars_whitespace": 0.27737785, "qsc_code_size_file_byte": 13058.0, "qsc_code_num_lines": 438.0, "qsc_code_num_chars_line_max": 122.0, "qsc_code_num_chars_line_mean": 29.81278539, "qsc_code_frac_chars_alphabet": 0.76123357, "qsc_code_frac_chars_comments": 0.37364068, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.19591837, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01271549, "qsc_code_frac_chars_long_word_length": 0.00537963, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.01632653, "qsc_codec_frac_lines_func_ratio": 0.08979592, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.14285714, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": 0.04489796}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_task.h
/** * @file lv_task.c * An 'lv_task' is a void (*fp) (void* param) type function which will be called periodically. * A priority (5 levels + disable) can be assigned to lv_tasks. */ #ifndef LV_TASK_H #define LV_TASK_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #include "../lv_conf_internal.h" #include <stdint.h> #include <stdbool.h> #include "lv_mem.h" #include "lv_ll.h" /********************* * DEFINES *********************/ #ifndef LV_ATTRIBUTE_TASK_HANDLER #define LV_ATTRIBUTE_TASK_HANDLER #endif #define LV_NO_TASK_READY 0xFFFFFFFF /********************** * TYPEDEFS **********************/ struct _lv_task_t; /** * Tasks execute this type type of functions. */ typedef void (*lv_task_cb_t)(struct _lv_task_t *); /** * Possible priorities for lv_tasks */ enum { LV_TASK_PRIO_OFF = 0, LV_TASK_PRIO_LOWEST, LV_TASK_PRIO_LOW, LV_TASK_PRIO_MID, LV_TASK_PRIO_HIGH, LV_TASK_PRIO_HIGHEST, _LV_TASK_PRIO_NUM, }; typedef uint8_t lv_task_prio_t; /** * Descriptor of a lv_task */ typedef struct _lv_task_t { uint32_t period; /**< How often the task should run */ uint32_t last_run; /**< Last time the task ran */ lv_task_cb_t task_cb; /**< Task function */ void * user_data; /**< Custom user data */ int32_t repeat_count; /**< 1: Task times; -1 : infinity; 0 : stop ; n>0: residual times */ uint8_t prio : 3; /**< Task priority */ } lv_task_t; /********************** * GLOBAL PROTOTYPES **********************/ /** * Init the lv_task module */ void _lv_task_core_init(void); //! @cond Doxygen_Suppress /** * Call it periodically to handle lv_tasks. * @return time till it needs to be run next (in ms) */ LV_ATTRIBUTE_TASK_HANDLER uint32_t lv_task_handler(void); //! @endcond /** * Create an "empty" task. It needs to initialized with at least * `lv_task_set_cb` and `lv_task_set_period` * @return pointer to the created task */ lv_task_t * lv_task_create_basic(void); /** * Create a new lv_task * @param task_xcb a callback which is the task itself. It will be called periodically. * (the 'x' in the argument name indicates that its not a fully generic function because it not follows * the `func_name(object, callback, ...)` convention) * @param period call period in ms unit * @param prio priority of the task (LV_TASK_PRIO_OFF means the task is stopped) * @param user_data custom parameter * @return pointer to the new task */ lv_task_t * lv_task_create(lv_task_cb_t task_xcb, uint32_t period, lv_task_prio_t prio, void * user_data); /** * Delete a lv_task * @param task pointer to task_cb created by task */ void lv_task_del(lv_task_t * task); /** * Set the callback the task (the function to call periodically) * @param task pointer to a task * @param task_cb the function to call periodically */ void lv_task_set_cb(lv_task_t * task, lv_task_cb_t task_cb); /** * Set new priority for a lv_task * @param task pointer to a lv_task * @param prio the new priority */ void lv_task_set_prio(lv_task_t * task, lv_task_prio_t prio); /** * Set new period for a lv_task * @param task pointer to a lv_task * @param period the new period */ void lv_task_set_period(lv_task_t * task, uint32_t period); /** * Make a lv_task ready. It will not wait its period. * @param task pointer to a lv_task. */ void lv_task_ready(lv_task_t * task); /** * Set the number of times a task will repeat. * @param task pointer to a lv_task. * @param repeat_count -1 : infinity; 0 : stop ; n>0: residual times */ void lv_task_set_repeat_count(lv_task_t * task, int32_t repeat_count); /** * Reset a lv_task. * It will be called the previously set period milliseconds later. * @param task pointer to a lv_task. */ void lv_task_reset(lv_task_t * task); /** * Enable or disable the whole lv_task handling * @param en: true: lv_task handling is running, false: lv_task handling is suspended */ void lv_task_enable(bool en); /** * Get idle percentage * @return the lv_task idle in percentage */ uint8_t lv_task_get_idle(void); /** * Iterate through the tasks * @param task NULL to start iteration or the previous return value to get the next task * @return the next task or NULL if there is no more task */ lv_task_t * lv_task_get_next(lv_task_t * task); /********************** * MACROS **********************/ #ifdef __cplusplus } /* extern "C" */ #endif #endif
4,502
lv_task
h
en
c
code
{"qsc_code_num_words": 706, "qsc_code_num_chars": 4502.0, "qsc_code_mean_word_length": 3.97592068, "qsc_code_frac_words_unique": 0.25212465, "qsc_code_frac_chars_top_2grams": 0.1432134, "qsc_code_frac_chars_top_3grams": 0.03740648, "qsc_code_frac_chars_top_4grams": 0.0313502, "qsc_code_frac_chars_dupe_5grams": 0.2080513, "qsc_code_frac_chars_dupe_6grams": 0.14891343, "qsc_code_frac_chars_dupe_7grams": 0.11008194, "qsc_code_frac_chars_dupe_8grams": 0.08478803, "qsc_code_frac_chars_dupe_9grams": 0.05343783, "qsc_code_frac_chars_dupe_10grams": 0.05343783, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00768597, "qsc_code_frac_chars_whitespace": 0.19080409, "qsc_code_size_file_byte": 4502.0, "qsc_code_num_lines": 183.0, "qsc_code_num_chars_line_max": 120.0, "qsc_code_num_chars_line_mean": 24.6010929, "qsc_code_frac_chars_alphabet": 0.76283283, "qsc_code_frac_chars_comments": 0.65171035, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.11538462, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.02359694, "qsc_code_frac_chars_long_word_length": 0.01339286, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00637755, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.26923077, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.36538462, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 1, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry.cpp
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #include "ESP32Berry.h" static ESP32Berry* instance = NULL; ESP32Berry::ESP32Berry() { instance = this; isSDCardAvailable = false; appNote = NULL; appTelegram = NULL; appESPNow = NULL; } ESP32Berry::~ESP32Berry() {} void appEventHandler(App_Event_t event, char* param) { switch (event) { case APP_Note: if (!instance->isSDCardAvailable) { instance->display->ui_popup_open("Oops!", "Check Your SD Card."); return; } if (instance->appNote != NULL) { instance->appNote = NULL; } instance->appNote = new AppNote(instance->display, instance->system, NULL, "Note App"); break; case APP_Telegram: if (instance->network->get_network_status() != NETWORK_CONNECTED) { instance->display->ui_popup_open("Oops!", "Check Your Wi-Fi Connection."); return; } if (instance->appTelegram != NULL) { instance->appTelegram = NULL; } instance->appTelegram = new AppTelegram(instance->display, NULL, instance->network, "Telegram App"); break; case APP_ESPNOW: if (instance->appESPNow != NULL) { instance->appESPNow = NULL; } instance->appESPNow = new AppESPNow(instance->display, instance->system, instance->network, "ESP-NOW App"); break; } } void menuEventHandler(Menu_Event_t event, char* param) { switch (event) { case WIFI_OFF: instance->network->WiFiCommend(NETWORK_SCANNING_OFF, param); break; case WIFI_ON: if (param == NULL) { instance->network->WiFiCommend(NETWORK_SCANNING_ON, param); } else { instance->network->WiFiCommend(NETWORK_CONNECTING, param); } break; } } void networkResponse(Network_Event_t event, std::vector<String> result) { switch (event) { case NETWORK_SCANNING_ON: instance->menu->update_ui_network(result); break; case NETWORK_CONNECTING: instance->display->launch_noti(result.back()); break; case NETWORK_CONNECTED: instance->display->show_loading_popup(false); instance->display->launch_noti(result.back()); instance->display->set_wifi_icon(true); instance->system->set_config_tz_time(); break; case NETWORK_CONNECT_FAILURE: case NETWORK_DISCONNECTED: instance->display->show_loading_popup(false); instance->display->launch_noti(result.back()); instance->display->set_wifi_icon(false); instance->menu->ui_network_switch(false); break; case TELEGRAM_MESSAGE: instance->display->launch_noti(result.back()); break; } } void systemInfo(System_Event_t event, String param) { switch (event) { case SYS_TIME: instance->display->update_time(param); break; case SYS_BATTERY: instance->display->update_battery(param); instance->menu->update_battery(param); break; } } void ESP32Berry::begin() { void (*iptr)(App_Event_t, char*) = &appEventHandler; display = new Display(appEventHandler); void (*vptr)(Network_Event_t, std::vector<String>) = &networkResponse; network = new Network(networkResponse); void (*sptr)(System_Event_t, String) = &systemInfo; system = new System(systemInfo); isSDCardAvailable = system->init_SDCard(); void (*mptr)(Menu_Event_t, char*) = &menuEventHandler; menu = new Menu(display, system, menuEventHandler); } void ESP32Berry::loop() { system->update(); network->update(); }
3,732
ESP32Berry
cpp
en
cpp
code
{"qsc_code_num_words": 393, "qsc_code_num_chars": 3732.0, "qsc_code_mean_word_length": 5.87531807, "qsc_code_frac_words_unique": 0.26463104, "qsc_code_frac_chars_top_2grams": 0.09744478, "qsc_code_frac_chars_top_3grams": 0.01905587, "qsc_code_frac_chars_top_4grams": 0.04330879, "qsc_code_frac_chars_dupe_5grams": 0.29493287, "qsc_code_frac_chars_dupe_6grams": 0.1827631, "qsc_code_frac_chars_dupe_7grams": 0.1827631, "qsc_code_frac_chars_dupe_8grams": 0.14811607, "qsc_code_frac_chars_dupe_9grams": 0.08401906, "qsc_code_frac_chars_dupe_10grams": 0.08401906, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00703753, "qsc_code_frac_chars_whitespace": 0.20042872, "qsc_code_size_file_byte": 3732.0, "qsc_code_num_lines": 141.0, "qsc_code_num_chars_line_max": 114.0, "qsc_code_num_chars_line_mean": 26.46808511, "qsc_code_frac_chars_alphabet": 0.76675603, "qsc_code_frac_chars_comments": 0.07234727, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.22641509, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.0288767, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codecpp_frac_lines_preprocessor_directives": 0.00943396, "qsc_codecpp_frac_lines_func_ratio": 0.10377358, "qsc_codecpp_cate_bitsstdc": 0.0, "qsc_codecpp_nums_lines_main": 0.0, "qsc_codecpp_frac_lines_goto": 0.0, "qsc_codecpp_cate_var_zero": 1.0, "qsc_codecpp_score_lines_no_logic": 0.13207547, "qsc_codecpp_frac_lines_print": 0.0}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codecpp_frac_lines_func_ratio": 0, "qsc_codecpp_nums_lines_main": 0, "qsc_codecpp_score_lines_no_logic": 0, "qsc_codecpp_frac_lines_preprocessor_directives": 0, "qsc_codecpp_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_Display.h
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #pragma once #include <lvgl.h> #define LGFX_USE_V1 #include <LovyanGFX.hpp> #include "ESP32Berry_Config.h" #ifdef ESP32BERRY #include "ESP32Berry_KeyPad.h" #endif typedef enum { APP_Note, APP_Telegram, APP_ESPNOW } App_Event_t; class LGFX : public lgfx::LGFX_Device { lgfx::Panel_ILI9488 _panel_instance; lgfx::Bus_SPI _bus_instance; lgfx::Touch_XPT2046 _touch_instance; public: LGFX(void) { { auto cfg = _bus_instance.config(); cfg.spi_host = VSPI_HOST; cfg.spi_mode = 0; cfg.freq_write = 40000000; cfg.freq_read = 16000000; cfg.spi_3wire = false; cfg.use_lock = true; cfg.dma_channel = 1; cfg.pin_sclk = 18; cfg.pin_mosi = 23; cfg.pin_miso = -1; cfg.pin_dc = 14; _bus_instance.config(cfg); _panel_instance.setBus(&_bus_instance); } { auto cfg = _panel_instance.config(); cfg.pin_cs = 13; cfg.pin_rst = 12; cfg.pin_busy = -1; cfg.memory_width = 320; cfg.memory_height = 480; cfg.panel_width = 320; cfg.panel_height = 480; cfg.offset_x = 0; cfg.offset_y = 0; cfg.offset_rotation = 2; cfg.dummy_read_pixel = 8; cfg.dummy_read_bits = 1; cfg.readable = true; cfg.invert = false; cfg.rgb_order = false; cfg.dlen_16bit = false; cfg.bus_shared = true; _panel_instance.config(cfg); } { auto cfg = _touch_instance.config(); cfg.x_min = 0; cfg.x_max = 319; cfg.y_min = 0; cfg.y_max = 479; cfg.pin_int = -1; cfg.bus_shared = true; cfg.offset_rotation = 0; cfg.spi_host = VSPI_HOST; cfg.freq = 1000000; cfg.pin_sclk = 18; cfg.pin_mosi = 23; cfg.pin_miso = 19; cfg.pin_cs = 4; _touch_instance.config(cfg); _panel_instance.setTouch(&_touch_instance); } setPanel(&_panel_instance); } }; class Display { private: SemaphoreHandle_t bin_sem; friend void update_ui_task(void *pvParameters); LGFX *tft; #ifdef ESP32BERRY KeyPad *keypad; #else lv_obj_t *kb; #endif long uiTimer; lv_obj_t *uiRoot; lv_obj_t *timeDataLabel; lv_obj_t *timeDataBtn; lv_obj_t *bodyScreen; lv_obj_t *calendar; lv_obj_t *networkIcon; lv_obj_t *popupBox; lv_obj_t *popupBoxCloseBtn; lv_obj_t *focusedObj; lv_obj_t *popupLoading; lv_obj_t *appNoteBtn; lv_obj_t *appTelegramBtn; lv_obj_t *appESPNOWBtn; lv_obj_t *batLabel; lv_obj_t *notiBtn; lv_obj_t *notiLabel; lv_style_t titleStyle; lv_style_t borderStyle; lv_style_t notiStyle; void init_tft(); void init_lvgl(); void init_keypad(); void ui_style(); void ui_main(); void ui_popup_box(); void ui_calendar(); void ui_apps(); void ui_noti(); void ui_noti_anim(); String add_battery_icon(int percentage); typedef void (*FuncPtrInt)(App_Event_t, char *); public: FuncPtrInt app_event_cb; Display(FuncPtrInt callback); ~Display(); void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p); void my_touch_read(lv_indev_drv_t *indev_driver, lv_indev_data_t *data); void ui_popup_open(String title, String msg); void btn_event_cb(lv_event_t *e); void textarea_event_cb(lv_event_t *e); void anim_x_cb(void *var, int32_t v); void set_wifi_icon(bool isConnected); void set_focused_obj(lv_obj_t *obj); void show_loading_popup(bool isOn); void update_time(String time); void update_battery(String info); void launch_noti(String msg); LGFX * get_lgfx(); lv_obj_t *focused_obj(); lv_obj_t *get_ui_root(); lv_obj_t *get_body_screen(); SemaphoreHandle_t get_mutex(); };
3,930
ESP32Berry_Display
h
en
c
code
{"qsc_code_num_words": 567, "qsc_code_num_chars": 3930.0, "qsc_code_mean_word_length": 4.14462081, "qsc_code_frac_words_unique": 0.35978836, "qsc_code_frac_chars_top_2grams": 0.04468085, "qsc_code_frac_chars_top_3grams": 0.05361702, "qsc_code_frac_chars_top_4grams": 0.01702128, "qsc_code_frac_chars_dupe_5grams": 0.10297872, "qsc_code_frac_chars_dupe_6grams": 0.06382979, "qsc_code_frac_chars_dupe_7grams": 0.04595745, "qsc_code_frac_chars_dupe_8grams": 0.02893617, "qsc_code_frac_chars_dupe_9grams": 0.02893617, "qsc_code_frac_chars_dupe_10grams": 0.02893617, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.03170495, "qsc_code_frac_chars_whitespace": 0.21348601, "qsc_code_size_file_byte": 3930.0, "qsc_code_num_lines": 161.0, "qsc_code_num_chars_line_max": 87.0, "qsc_code_num_chars_line_mean": 24.40993789, "qsc_code_frac_chars_alphabet": 0.72856681, "qsc_code_frac_chars_comments": 0.06870229, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.11347518, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.01037968, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.20567376, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.24822695, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 1, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_AppNote.h
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #pragma once #include "ESP32Berry_Config.h" #include "ESP32Berry_AppBase.h" class AppNote : public AppBase { private: lv_obj_t *_bodyScreen; lv_obj_t *currentFileName; lv_obj_t *msgBox; lv_obj_t *saveBox; lv_obj_t *saveBoxTitle; lv_obj_t *saveBoxFileName; lv_obj_t *saveBoxSaveBtn; lv_obj_t *saveBoxCloseBtn; lv_obj_t *dropDownMenu; lv_obj_t *uiFileList; lv_obj_t *uiFileListCloseBtn; String contents; String filename; uint8_t menuIdx; char menuItem[32]; void ui_app(); const char *NOTE_PATH = "/Note"; void ui_open_file(); void ui_close_file(); void ui_write_textarea(String contents); void menu_action(); void ui_reset(); void draw_ui(); public: AppNote(Display *display, System *system, Network *network, const char *title); ~AppNote(); lv_obj_t *textarea; void event_handler(lv_event_t *e); void file_event_cb(lv_event_t *e); void ui_save_box(); void ui_message_box(const char *title, String msg, bool isSelectable); void close_app(); };
1,275
ESP32Berry_AppNote
h
en
c
code
{"qsc_code_num_words": 169, "qsc_code_num_chars": 1275.0, "qsc_code_mean_word_length": 4.66272189, "qsc_code_frac_words_unique": 0.47337278, "qsc_code_frac_chars_top_2grams": 0.07614213, "qsc_code_frac_chars_top_3grams": 0.09137056, "qsc_code_frac_chars_top_4grams": 0.02284264, "qsc_code_frac_chars_dupe_5grams": 0.03299492, "qsc_code_frac_chars_dupe_6grams": 0.0, "qsc_code_frac_chars_dupe_7grams": 0.0, "qsc_code_frac_chars_dupe_8grams": 0.0, "qsc_code_frac_chars_dupe_9grams": 0.0, "qsc_code_frac_chars_dupe_10grams": 0.0, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.01097896, "qsc_code_frac_chars_whitespace": 0.1427451, "qsc_code_size_file_byte": 1275.0, "qsc_code_num_lines": 46.0, "qsc_code_num_chars_line_max": 82.0, "qsc_code_num_chars_line_mean": 27.7173913, "qsc_code_frac_chars_alphabet": 0.70997255, "qsc_code_frac_chars_comments": 0.21176471, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.0, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.04373757, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.31578947, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.39473684, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 1, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_fs.c
/** * @file lv_fs.c * */ /********************* * INCLUDES *********************/ #include "lv_fs.h" #if LV_USE_FILESYSTEM #include "../lv_misc/lv_debug.h" #include "lv_ll.h" #include <string.h> #include "lv_gc.h" #if defined(LV_GC_INCLUDE) #include LV_GC_INCLUDE #endif /* LV_ENABLE_GC */ /********************* * DEFINES *********************/ /* "free" is used as a function pointer (in lv_fs_drv_t). * We must make sure "free" was not defined to a platform specific * free function, otherwise compilation would fail. */ #ifdef free #undef free #endif /********************** * TYPEDEFS **********************/ /********************** * STATIC PROTOTYPES **********************/ static const char * lv_fs_get_real_path(const char * path); /********************** * STATIC VARIABLES **********************/ /********************** * MACROS **********************/ /********************** * GLOBAL FUNCTIONS **********************/ /** * Initialize the File system interface */ void _lv_fs_init(void) { _lv_ll_init(&LV_GC_ROOT(_lv_drv_ll), sizeof(lv_fs_drv_t)); } /** * Test if a drive is ready or not. If the `ready` function was not initialized `true` will be * returned. * @param letter letter of the drive * @return true: drive is ready; false: drive is not ready */ bool lv_fs_is_ready(char letter) { lv_fs_drv_t * drv = lv_fs_get_drv(letter); if(drv == NULL) return false; /*An unknown driver in not ready*/ if(drv->ready_cb == NULL) return true; /*Assume the driver is always ready if no handler provided*/ return drv->ready_cb(drv); } /** * Open a file * @param file_p pointer to a lv_fs_file_t variable * @param path path to the file beginning with the driver letter (e.g. S:/folder/file.txt) * @param mode read: FS_MODE_RD, write: FS_MODE_WR, both: FS_MODE_RD | FS_MODE_WR * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_open(lv_fs_file_t * file_p, const char * path, lv_fs_mode_t mode) { file_p->drv = NULL; file_p->file_d = NULL; if(path == NULL) return LV_FS_RES_INV_PARAM; char letter = path[0]; file_p->drv = lv_fs_get_drv(letter); if(file_p->drv == NULL) { file_p->file_d = NULL; return LV_FS_RES_NOT_EX; } if(file_p->drv->ready_cb != NULL) { if(file_p->drv->ready_cb(file_p->drv) == false) { file_p->drv = NULL; file_p->file_d = NULL; return LV_FS_RES_HW_ERR; } } file_p->file_d = lv_mem_alloc(file_p->drv->file_size); LV_ASSERT_MEM(file_p->file_d); if(file_p->file_d == NULL) { file_p->drv = NULL; return LV_FS_RES_OUT_OF_MEM; /* Out of memory */ } if(file_p->drv->open_cb == NULL) { return LV_FS_RES_NOT_IMP; } const char * real_path = lv_fs_get_real_path(path); lv_fs_res_t res = file_p->drv->open_cb(file_p->drv, file_p->file_d, real_path, mode); if(res != LV_FS_RES_OK) { lv_mem_free(file_p->file_d); file_p->file_d = NULL; file_p->drv = NULL; } return res; } /** * Close an already opened file * @param file_p pointer to a lv_fs_file_t variable * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_close(lv_fs_file_t * file_p) { if(file_p->drv == NULL) { return LV_FS_RES_INV_PARAM; } if(file_p->drv->close_cb == NULL) { return LV_FS_RES_NOT_IMP; } lv_fs_res_t res = file_p->drv->close_cb(file_p->drv, file_p->file_d); lv_mem_free(file_p->file_d); /*Clean up*/ file_p->file_d = NULL; file_p->drv = NULL; file_p->file_d = NULL; return res; } /** * Delete a file * @param path path of the file to delete * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_remove(const char * path) { if(path == NULL) return LV_FS_RES_INV_PARAM; char letter = path[0]; lv_fs_drv_t * drv = lv_fs_get_drv(letter); if(drv == NULL) return LV_FS_RES_NOT_EX; if(drv->ready_cb != NULL) { if(drv->ready_cb(drv) == false) return LV_FS_RES_HW_ERR; } if(drv->remove_cb == NULL) return LV_FS_RES_NOT_IMP; const char * real_path = lv_fs_get_real_path(path); lv_fs_res_t res = drv->remove_cb(drv, real_path); return res; } /** * Read from a file * @param file_p pointer to a lv_fs_file_t variable * @param buf pointer to a buffer where the read bytes are stored * @param btr Bytes To Read * @param br the number of real read bytes (Bytes Read). NULL if unused. * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_read(lv_fs_file_t * file_p, void * buf, uint32_t btr, uint32_t * br) { if(br != NULL) *br = 0; if(file_p->drv == NULL) return LV_FS_RES_INV_PARAM; if(file_p->drv->read_cb == NULL) return LV_FS_RES_NOT_IMP; uint32_t br_tmp = 0; lv_fs_res_t res = file_p->drv->read_cb(file_p->drv, file_p->file_d, buf, btr, &br_tmp); if(br != NULL) *br = br_tmp; return res; } /** * Write into a file * @param file_p pointer to a lv_fs_file_t variable * @param buf pointer to a buffer with the bytes to write * @param btr Bytes To Write * @param br the number of real written bytes (Bytes Written). NULL if unused. * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_write(lv_fs_file_t * file_p, const void * buf, uint32_t btw, uint32_t * bw) { if(bw != NULL) *bw = 0; if(file_p->drv == NULL) { return LV_FS_RES_INV_PARAM; } if(file_p->drv->write_cb == NULL) { return LV_FS_RES_NOT_IMP; } uint32_t bw_tmp = 0; lv_fs_res_t res = file_p->drv->write_cb(file_p->drv, file_p->file_d, buf, btw, &bw_tmp); if(bw != NULL) *bw = bw_tmp; return res; } /** * Set the position of the 'cursor' (read write pointer) in a file * @param file_p pointer to a lv_fs_file_t variable * @param pos the new position expressed in bytes index (0: start of file) * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_seek(lv_fs_file_t * file_p, uint32_t pos) { if(file_p->drv == NULL) { return LV_FS_RES_INV_PARAM; } if(file_p->drv->seek_cb == NULL) { return LV_FS_RES_NOT_IMP; } lv_fs_res_t res = file_p->drv->seek_cb(file_p->drv, file_p->file_d, pos); return res; } /** * Give the position of the read write pointer * @param file_p pointer to a lv_fs_file_t variable * @param pos_p pointer to store the position of the read write pointer * @return LV_FS_RES_OK or any error from 'fs_res_t' */ lv_fs_res_t lv_fs_tell(lv_fs_file_t * file_p, uint32_t * pos) { if(file_p->drv == NULL) { pos = 0; return LV_FS_RES_INV_PARAM; } if(file_p->drv->tell_cb == NULL) { pos = 0; return LV_FS_RES_NOT_IMP; } lv_fs_res_t res = file_p->drv->tell_cb(file_p->drv, file_p->file_d, pos); return res; } /** * Truncate the file size to the current position of the read write pointer * @param file_p pointer to an 'ufs_file_t' variable. (opened with lv_fs_open ) * @return LV_FS_RES_OK: no error, the file is read * any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_trunc(lv_fs_file_t * file_p) { if(file_p->drv == NULL) { return LV_FS_RES_INV_PARAM; } if(file_p->drv->tell_cb == NULL) { return LV_FS_RES_NOT_IMP; } lv_fs_res_t res = file_p->drv->trunc_cb(file_p->drv, file_p->file_d); return res; } /** * Give the size of a file bytes * @param file_p pointer to a lv_fs_file_t variable * @param size pointer to a variable to store the size * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_size(lv_fs_file_t * file_p, uint32_t * size) { if(file_p->drv == NULL) { return LV_FS_RES_INV_PARAM; } if(file_p->drv->size_cb == NULL) return LV_FS_RES_NOT_IMP; if(size == NULL) return LV_FS_RES_INV_PARAM; lv_fs_res_t res = file_p->drv->size_cb(file_p->drv, file_p->file_d, size); return res; } /** * Rename a file * @param oldname path to the file * @param newname path with the new name * @return LV_FS_RES_OK or any error from 'fs_res_t' */ lv_fs_res_t lv_fs_rename(const char * oldname, const char * newname) { if(!oldname || !newname) return LV_FS_RES_INV_PARAM; char letter = oldname[0]; lv_fs_drv_t * drv = lv_fs_get_drv(letter); if(!drv) { return LV_FS_RES_NOT_EX; } if(drv->ready_cb != NULL) { if(drv->ready_cb(drv) == false) { return LV_FS_RES_HW_ERR; } } if(drv->rename_cb == NULL) return LV_FS_RES_NOT_IMP; const char * old_real = lv_fs_get_real_path(oldname); const char * new_real = lv_fs_get_real_path(newname); lv_fs_res_t res = drv->rename_cb(drv, old_real, new_real); return res; } /** * Initialize a 'fs_read_dir_t' variable for directory reading * @param rddir_p pointer to a 'fs_read_dir_t' variable * @param path path to a directory * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path) { if(path == NULL) return LV_FS_RES_INV_PARAM; char letter = path[0]; rddir_p->drv = lv_fs_get_drv(letter); if(rddir_p->drv == NULL) { rddir_p->dir_d = NULL; return LV_FS_RES_NOT_EX; } rddir_p->dir_d = lv_mem_alloc(rddir_p->drv->rddir_size); LV_ASSERT_MEM(rddir_p->dir_d); if(rddir_p->dir_d == NULL) { rddir_p->dir_d = NULL; return LV_FS_RES_OUT_OF_MEM; /* Out of memory */ } if(rddir_p->drv->dir_open_cb == NULL) { return LV_FS_RES_NOT_IMP; } const char * real_path = lv_fs_get_real_path(path); lv_fs_res_t res = rddir_p->drv->dir_open_cb(rddir_p->drv, rddir_p->dir_d, real_path); return res; } /** * Read the next filename form a directory. * The name of the directories will begin with '/' * @param rddir_p pointer to an initialized 'fs_read_dir_t' variable * @param fn pointer to a buffer to store the filename * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_dir_read(lv_fs_dir_t * rddir_p, char * fn) { if(rddir_p->drv == NULL || rddir_p->dir_d == NULL) { fn[0] = '\0'; return LV_FS_RES_INV_PARAM; } if(rddir_p->drv->dir_read_cb == NULL) { return LV_FS_RES_NOT_IMP; } lv_fs_res_t res = rddir_p->drv->dir_read_cb(rddir_p->drv, rddir_p->dir_d, fn); return res; } /** * Close the directory reading * @param rddir_p pointer to an initialized 'fs_read_dir_t' variable * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_dir_close(lv_fs_dir_t * rddir_p) { if(rddir_p->drv == NULL || rddir_p->dir_d == NULL) { return LV_FS_RES_INV_PARAM; } lv_fs_res_t res; if(rddir_p->drv->dir_close_cb == NULL) { res = LV_FS_RES_NOT_IMP; } else { res = rddir_p->drv->dir_close_cb(rddir_p->drv, rddir_p->dir_d); } lv_mem_free(rddir_p->dir_d); /*Clean up*/ rddir_p->dir_d = NULL; rddir_p->drv = NULL; rddir_p->dir_d = NULL; return res; } /** * Get the free and total size of a driver in kB * @param letter the driver letter * @param total_p pointer to store the total size [kB] * @param free_p pointer to store the free size_cb [kB] * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_free_space(char letter, uint32_t * total_p, uint32_t * free_p) { lv_fs_drv_t * drv = lv_fs_get_drv(letter); if(drv == NULL) { return LV_FS_RES_INV_PARAM; } lv_fs_res_t res; if(drv->free_space_cb == NULL) { res = LV_FS_RES_NOT_IMP; } else { uint32_t total_tmp = 0; uint32_t free_tmp = 0; res = drv->free_space_cb(drv, &total_tmp, &free_tmp); if(total_p != NULL) *total_p = total_tmp; if(free_p != NULL) *free_p = free_tmp; } return res; } /** * Initialize a file system driver with default values. * It is used to surly have known values in the fields ant not memory junk. * After it you can set the fields. * @param drv pointer to driver variable to initialize */ void lv_fs_drv_init(lv_fs_drv_t * drv) { _lv_memset_00(drv, sizeof(lv_fs_drv_t)); } /** * Add a new drive * @param drv_p pointer to an lv_fs_drv_t structure which is inited with the * corresponding function pointers. The data will be copied so the variable can be local. */ void lv_fs_drv_register(lv_fs_drv_t * drv_p) { /*Save the new driver*/ lv_fs_drv_t * new_drv; new_drv = _lv_ll_ins_head(&LV_GC_ROOT(_lv_drv_ll)); LV_ASSERT_MEM(new_drv); if(new_drv == NULL) return; _lv_memcpy(new_drv, drv_p, sizeof(lv_fs_drv_t)); } /** * Give a pointer to a driver from its letter * @param letter the driver letter * @return pointer to a driver or NULL if not found */ lv_fs_drv_t * lv_fs_get_drv(char letter) { lv_fs_drv_t * drv; _LV_LL_READ(LV_GC_ROOT(_lv_drv_ll), drv) { if(drv->letter == letter) { return drv; } } return NULL; } /** * Fill a buffer with the letters of existing drivers * @param buf buffer to store the letters ('\0' added after the last letter) * @return the buffer */ char * lv_fs_get_letters(char * buf) { lv_fs_drv_t * drv; uint8_t i = 0; _LV_LL_READ(LV_GC_ROOT(_lv_drv_ll), drv) { buf[i] = drv->letter; i++; } buf[i] = '\0'; return buf; } /** * Return with the extension of the filename * @param fn string with a filename * @return pointer to the beginning extension or empty string if no extension */ const char * lv_fs_get_ext(const char * fn) { size_t i; for(i = strlen(fn); i > 0; i--) { if(fn[i] == '.') { return &fn[i + 1]; } else if(fn[i] == '/' || fn[i] == '\\') { return ""; /*No extension if a '\' or '/' found*/ } } return ""; /*Empty string if no '.' in the file name. */ } /** * Step up one level * @param path pointer to a file name * @return the truncated file name */ char * lv_fs_up(char * path) { size_t len = strlen(path); if(len == 0) return path; len--; /*Go before the trailing '\0'*/ /*Ignore trailing '/' or '\'*/ while(path[len] == '/' || path[len] == '\\') { path[len] = '\0'; if(len > 0) len--; else return path; } size_t i; for(i = len; i > 0; i--) { if(path[i] == '/' || path[i] == '\\') break; } if(i > 0) path[i] = '\0'; return path; } /** * Get the last element of a path (e.g. U:/folder/file -> file) * @param path a character sting with the path to search in * @return pointer to the beginning of the last element in the path */ const char * lv_fs_get_last(const char * path) { size_t len = strlen(path); if(len == 0) return path; len--; /*Go before the trailing '\0'*/ /*Ignore trailing '/' or '\'*/ while(path[len] == '/' || path[len] == '\\') { if(len > 0) len--; else return path; } size_t i; for(i = len; i > 0; i--) { if(path[i] == '/' || path[i] == '\\') break; } /*No '/' or '\' in the path so return with path itself*/ if(i == 0) return path; return &path[i + 1]; } /********************** * STATIC FUNCTIONS **********************/ /** * Leave the driver letters and / or \ letters from beginning of the path * @param path path string (E.g. S:/folder/file.txt) * @return pointer to the beginning of the real path (E.g. folder/file.txt) */ static const char * lv_fs_get_real_path(const char * path) { /* Example path: "S:/folder/file.txt" * Leave the letter and the : / \ characters*/ path++; /*Ignore the driver letter*/ while(*path != '\0') { if(*path == ':' || *path == '\\' || *path == '/') { path++; } else { break; } } return path; } #endif /*LV_USE_FILESYSTEM*/
16,120
lv_fs
c
en
c
code
{"qsc_code_num_words": 2726, "qsc_code_num_chars": 16120.0, "qsc_code_mean_word_length": 3.3382245, "qsc_code_frac_words_unique": 0.09097579, "qsc_code_frac_chars_top_2grams": 0.07296703, "qsc_code_frac_chars_top_3grams": 0.07153846, "qsc_code_frac_chars_top_4grams": 0.07142857, "qsc_code_frac_chars_dupe_5grams": 0.58406593, "qsc_code_frac_chars_dupe_6grams": 0.54318681, "qsc_code_frac_chars_dupe_7grams": 0.49527473, "qsc_code_frac_chars_dupe_8grams": 0.46692308, "qsc_code_frac_chars_dupe_9grams": 0.4289011, "qsc_code_frac_chars_dupe_10grams": 0.41021978, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00514454, "qsc_code_frac_chars_whitespace": 0.24032258, "qsc_code_size_file_byte": 16120.0, "qsc_code_num_lines": 643.0, "qsc_code_num_chars_line_max": 104.0, "qsc_code_num_chars_line_mean": 25.06998445, "qsc_code_frac_chars_alphabet": 0.73795525, "qsc_code_frac_chars_comments": 0.38610422, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.36521739, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00727567, "qsc_code_frac_chars_long_word_length": 0.00212207, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.0, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.00869565, "qsc_codec_frac_lines_func_ratio": 0.07826087, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.22898551, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": 0.03768116}
1
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32-OpenCV-Projects
esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_misc/lv_fs.h
/** * @file lv_fs.h * */ #ifndef LV_FS_H #define LV_FS_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #include "../lv_conf_internal.h" #if LV_USE_FILESYSTEM #include <stdint.h> #include <stdbool.h> #include "lv_mem.h" /********************* * DEFINES *********************/ #define LV_FS_MAX_FN_LENGTH 64 #define LV_FS_MAX_PATH_LENGTH 256 /********************** * TYPEDEFS **********************/ /** * Errors in the file system module. */ enum { LV_FS_RES_OK = 0, LV_FS_RES_HW_ERR, /*Low level hardware error*/ LV_FS_RES_FS_ERR, /*Error in the file system structure */ LV_FS_RES_NOT_EX, /*Driver, file or directory is not exists*/ LV_FS_RES_FULL, /*Disk full*/ LV_FS_RES_LOCKED, /*The file is already opened*/ LV_FS_RES_DENIED, /*Access denied. Check 'fs_open' modes and write protect*/ LV_FS_RES_BUSY, /*The file system now can't handle it, try later*/ LV_FS_RES_TOUT, /*Process time outed*/ LV_FS_RES_NOT_IMP, /*Requested function is not implemented*/ LV_FS_RES_OUT_OF_MEM, /*Not enough memory for an internal operation*/ LV_FS_RES_INV_PARAM, /*Invalid parameter among arguments*/ LV_FS_RES_UNKNOWN, /*Other unknown error*/ }; typedef uint8_t lv_fs_res_t; /** * Filesystem mode. */ enum { LV_FS_MODE_WR = 0x01, LV_FS_MODE_RD = 0x02, }; typedef uint8_t lv_fs_mode_t; typedef struct _lv_fs_drv_t { char letter; uint16_t file_size; uint16_t rddir_size; bool (*ready_cb)(struct _lv_fs_drv_t * drv); lv_fs_res_t (*open_cb)(struct _lv_fs_drv_t * drv, void * file_p, const char * path, lv_fs_mode_t mode); lv_fs_res_t (*close_cb)(struct _lv_fs_drv_t * drv, void * file_p); lv_fs_res_t (*remove_cb)(struct _lv_fs_drv_t * drv, const char * fn); lv_fs_res_t (*read_cb)(struct _lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br); lv_fs_res_t (*write_cb)(struct _lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw); lv_fs_res_t (*seek_cb)(struct _lv_fs_drv_t * drv, void * file_p, uint32_t pos); lv_fs_res_t (*tell_cb)(struct _lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p); lv_fs_res_t (*trunc_cb)(struct _lv_fs_drv_t * drv, void * file_p); lv_fs_res_t (*size_cb)(struct _lv_fs_drv_t * drv, void * file_p, uint32_t * size_p); lv_fs_res_t (*rename_cb)(struct _lv_fs_drv_t * drv, const char * oldname, const char * newname); lv_fs_res_t (*free_space_cb)(struct _lv_fs_drv_t * drv, uint32_t * total_p, uint32_t * free_p); lv_fs_res_t (*dir_open_cb)(struct _lv_fs_drv_t * drv, void * rddir_p, const char * path); lv_fs_res_t (*dir_read_cb)(struct _lv_fs_drv_t * drv, void * rddir_p, char * fn); lv_fs_res_t (*dir_close_cb)(struct _lv_fs_drv_t * drv, void * rddir_p); #if LV_USE_USER_DATA lv_fs_drv_user_data_t user_data; /**< Custom file user data */ #endif } lv_fs_drv_t; typedef struct { void * file_d; lv_fs_drv_t * drv; } lv_fs_file_t; typedef struct { void * dir_d; lv_fs_drv_t * drv; } lv_fs_dir_t; /********************** * GLOBAL PROTOTYPES **********************/ /** * Initialize the File system interface */ void _lv_fs_init(void); /** * Initialize a file system driver with default values. * It is used to surly have known values in the fields ant not memory junk. * After it you can set the fields. * @param drv pointer to driver variable to initialize */ void lv_fs_drv_init(lv_fs_drv_t * drv); /** * Add a new drive * @param drv_p pointer to an lv_fs_drv_t structure which is inited with the * corresponding function pointers. The data will be copied so the variable can be local. */ void lv_fs_drv_register(lv_fs_drv_t * drv_p); /** * Give a pointer to a driver from its letter * @param letter the driver letter * @return pointer to a driver or NULL if not found */ lv_fs_drv_t * lv_fs_get_drv(char letter); /** * Test if a drive is ready or not. If the `ready` function was not initialized `true` will be * returned. * @param letter letter of the drive * @return true: drive is ready; false: drive is not ready */ bool lv_fs_is_ready(char letter); /** * Open a file * @param file_p pointer to a lv_fs_file_t variable * @param path path to the file beginning with the driver letter (e.g. S:/folder/file.txt) * @param mode read: FS_MODE_RD, write: FS_MODE_WR, both: FS_MODE_RD | FS_MODE_WR * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_open(lv_fs_file_t * file_p, const char * path, lv_fs_mode_t mode); /** * Close an already opened file * @param file_p pointer to a lv_fs_file_t variable * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_close(lv_fs_file_t * file_p); /** * Delete a file * @param path path of the file to delete * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_remove(const char * path); /** * Read from a file * @param file_p pointer to a lv_fs_file_t variable * @param buf pointer to a buffer where the read bytes are stored * @param btr Bytes To Read * @param br the number of real read bytes (Bytes Read). NULL if unused. * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_read(lv_fs_file_t * file_p, void * buf, uint32_t btr, uint32_t * br); /** * Write into a file * @param file_p pointer to a lv_fs_file_t variable * @param buf pointer to a buffer with the bytes to write * @param btr Bytes To Write * @param br the number of real written bytes (Bytes Written). NULL if unused. * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_write(lv_fs_file_t * file_p, const void * buf, uint32_t btw, uint32_t * bw); /** * Set the position of the 'cursor' (read write pointer) in a file * @param file_p pointer to a lv_fs_file_t variable * @param pos the new position expressed in bytes index (0: start of file) * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_seek(lv_fs_file_t * file_p, uint32_t pos); /** * Give the position of the read write pointer * @param file_p pointer to a lv_fs_file_t variable * @param pos_p pointer to store the position of the read write pointer * @return LV_FS_RES_OK or any error from 'fs_res_t' */ lv_fs_res_t lv_fs_tell(lv_fs_file_t * file_p, uint32_t * pos); /** * Truncate the file size to the current position of the read write pointer * @param file_p pointer to an 'ufs_file_t' variable. (opened with lv_fs_open ) * @return LV_FS_RES_OK: no error, the file is read * any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_trunc(lv_fs_file_t * file_p); /** * Give the size of a file bytes * @param file_p pointer to a lv_fs_file_t variable * @param size pointer to a variable to store the size * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_size(lv_fs_file_t * file_p, uint32_t * size); /** * Rename a file * @param oldname path to the file * @param newname path with the new name * @return LV_FS_RES_OK or any error from 'fs_res_t' */ lv_fs_res_t lv_fs_rename(const char * oldname, const char * newname); /** * Initialize a 'fs_dir_t' variable for directory reading * @param rddir_p pointer to a 'fs_read_dir_t' variable * @param path path to a directory * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path); /** * Read the next filename form a directory. * The name of the directories will begin with '/' * @param rddir_p pointer to an initialized 'fs_rdir_t' variable * @param fn pointer to a buffer to store the filename * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_dir_read(lv_fs_dir_t * rddir_p, char * fn); /** * Close the directory reading * @param rddir_p pointer to an initialized 'fs_dir_t' variable * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_dir_close(lv_fs_dir_t * rddir_p); /** * Get the free and total size of a driver in kB * @param letter the driver letter * @param total_p pointer to store the total size [kB] * @param free_p pointer to store the free size [kB] * @return LV_FS_RES_OK or any error from lv_fs_res_t enum */ lv_fs_res_t lv_fs_free_space(char letter, uint32_t * total_p, uint32_t * free_p); /** * Fill a buffer with the letters of existing drivers * @param buf buffer to store the letters ('\0' added after the last letter) * @return the buffer */ char * lv_fs_get_letters(char * buf); /** * Return with the extension of the filename * @param fn string with a filename * @return pointer to the beginning extension or empty string if no extension */ const char * lv_fs_get_ext(const char * fn); /** * Step up one level * @param path pointer to a file name * @return the truncated file name */ char * lv_fs_up(char * path); /** * Get the last element of a path (e.g. U:/folder/file -> file) * @param buf buffer to store the letters ('\0' added after the last letter) * @return pointer to the beginning of the last element in the path */ const char * lv_fs_get_last(const char * path); /********************** * MACROS **********************/ #endif /*LV_USE_FILESYSTEM*/ #ifdef __cplusplus } /* extern "C" */ #endif #endif /*LV_FS_H*/
9,381
lv_fs
h
en
c
code
{"qsc_code_num_words": 1720, "qsc_code_num_chars": 9381.0, "qsc_code_mean_word_length": 3.48372093, "qsc_code_frac_words_unique": 0.14127907, "qsc_code_frac_chars_top_2grams": 0.09813084, "qsc_code_frac_chars_top_3grams": 0.07943925, "qsc_code_frac_chars_top_4grams": 0.05473965, "qsc_code_frac_chars_dupe_5grams": 0.48948598, "qsc_code_frac_chars_dupe_6grams": 0.42540053, "qsc_code_frac_chars_dupe_7grams": 0.38317757, "qsc_code_frac_chars_dupe_8grams": 0.35864486, "qsc_code_frac_chars_dupe_9grams": 0.32977303, "qsc_code_frac_chars_dupe_10grams": 0.30807744, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.00748916, "qsc_code_frac_chars_whitespace": 0.18867925, "qsc_code_size_file_byte": 9381.0, "qsc_code_num_lines": 293.0, "qsc_code_num_chars_line_max": 118.0, "qsc_code_num_chars_line_mean": 32.01706485, "qsc_code_frac_chars_alphabet": 0.77979241, "qsc_code_frac_chars_comments": 0.59780407, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.16304348, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00795123, "qsc_code_frac_chars_long_word_length": 0.00556586, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.00212033, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.25, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.30434783, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": null}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 0, "qsc_code_frac_chars_top_3grams": 0, "qsc_code_frac_chars_top_4grams": 0, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 0, "qsc_code_frac_chars_digital": 0, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 0, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 1, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}
0015/ESP32Berry
Deprecated/ESP32Berry_0.3/ESP32Berry_Icon.c
///////////////////////////////////////////////////////////////// /* ESP32Berry, "ESP-NOW Chat App" Version 0.3 For More Information: https://youtu.be/UhIXAp2wqjg Created by Eric N. (ThatProject) */ ///////////////////////////////////////////////////////////////// #include "lvgl.h" #ifndef LV_ATTRIBUTE_MEM_ALIGN #define LV_ATTRIBUTE_MEM_ALIGN #endif #ifndef LV_ATTRIBUTE_IMG_ESP32BERRY_ICON #define LV_ATTRIBUTE_IMG_ESP32BERRY_ICON #endif const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_ESP32BERRY_ICON uint8_t ESP32Berry_Icon_map[] = { 0x00, 0x00, 0x00, 0x00, /*Color of index 0*/ 0xff, 0xff, 0xff, 0x02, /*Color of index 1*/ 0xff, 0xff, 0xff, 0x81, /*Color of index 2*/ 0xff, 0xff, 0xff, 0x35, /*Color of index 3*/ 0xff, 0xff, 0xff, 0xa6, /*Color of index 4*/ 0xff, 0xff, 0xff, 0x73, /*Color of index 5*/ 0xff, 0xff, 0xff, 0x0e, /*Color of index 6*/ 0xff, 0xff, 0xff, 0x51, /*Color of index 7*/ 0xff, 0xff, 0xff, 0x8e, /*Color of index 8*/ 0xff, 0xff, 0xff, 0x1c, /*Color of index 9*/ 0xff, 0xff, 0xff, 0xad, /*Color of index 10*/ 0xf8, 0xf8, 0xf8, 0xd9, /*Color of index 11*/ 0xf7, 0xf7, 0xf7, 0xc9, /*Color of index 12*/ 0xf6, 0xf6, 0xf6, 0xd9, /*Color of index 13*/ 0xf6, 0xf6, 0xf6, 0xeb, /*Color of index 14*/ 0xf5, 0xf5, 0xf5, 0xff, /*Color of index 15*/ 0xf1, 0xf1, 0xf1, 0xef, /*Color of index 16*/ 0x2a, 0x2a, 0x2a, 0xff, /*Color of index 17*/ 0x21, 0x21, 0x21, 0xfe, /*Color of index 18*/ 0x13, 0x13, 0x13, 0xff, /*Color of index 19*/ 0x0c, 0x0c, 0x0c, 0xff, /*Color of index 20*/ 0x00, 0x00, 0x00, 0xfe, /*Color of index 21*/ 0x13, 0x15, 0x1b, 0xff, /*Color of index 22*/ 0x00, 0x04, 0x10, 0xff, /*Color of index 23*/ 0x02, 0x03, 0x07, 0xfe, /*Color of index 24*/ 0x15, 0x91, 0xff, 0xff, /*Color of index 25*/ 0x14, 0x8a, 0xf8, 0xff, /*Color of index 26*/ 0x14, 0x88, 0xf5, 0xff, /*Color of index 27*/ 0x14, 0x86, 0xf1, 0xff, /*Color of index 28*/ 0x13, 0x84, 0xed, 0xff, /*Color of index 29*/ 0x12, 0x80, 0xe5, 0xff, /*Color of index 30*/ 0x12, 0x7f, 0xe5, 0xff, /*Color of index 31*/ 0x11, 0x79, 0xda, 0xff, /*Color of index 32*/ 0x10, 0x75, 0xd3, 0xff, /*Color of index 33*/ 0x0e, 0x6c, 0xc4, 0xff, /*Color of index 34*/ 0x0c, 0x65, 0xb7, 0xff, /*Color of index 35*/ 0x0c, 0x63, 0xb5, 0xff, /*Color of index 36*/ 0x0b, 0x60, 0xae, 0xff, /*Color of index 37*/ 0x0b, 0x5f, 0xad, 0xff, /*Color of index 38*/ 0x0a, 0x59, 0xa3, 0xff, /*Color of index 39*/ 0x09, 0x54, 0x9a, 0xff, /*Color of index 40*/ 0x08, 0x50, 0x92, 0xff, /*Color of index 41*/ 0x07, 0x4a, 0x89, 0xff, /*Color of index 42*/ 0x03, 0x2f, 0x5b, 0xff, /*Color of index 43*/ 0x03, 0x2e, 0x59, 0xff, /*Color of index 44*/ 0x02, 0x25, 0x49, 0xff, /*Color of index 45*/ 0x02, 0x22, 0x44, 0xff, /*Color of index 46*/ 0x02, 0x20, 0x3f, 0xff, /*Color of index 47*/ 0x02, 0x1f, 0x3e, 0xff, /*Color of index 48*/ 0x01, 0x18, 0x34, 0xff, /*Color of index 49*/ 0x10, 0x18, 0x27, 0xff, /*Color of index 50*/ 0x0e, 0x17, 0x28, 0xff, /*Color of index 51*/ 0x0f, 0x17, 0x26, 0xff, /*Color of index 52*/ 0x01, 0x13, 0x2a, 0xff, /*Color of index 53*/ 0x04, 0x11, 0x23, 0xff, /*Color of index 54*/ 0x00, 0x0e, 0x22, 0xff, /*Color of index 55*/ 0x00, 0x0c, 0x1e, 0xff, /*Color of index 56*/ 0x08, 0x0c, 0x15, 0xff, /*Color of index 57*/ 0x00, 0x07, 0x14, 0xff, /*Color of index 58*/ 0xf4, 0xf3, 0xf3, 0xe0, /*Color of index 59*/ 0xaf, 0xac, 0xad, 0xff, /*Color of index 60*/ 0x43, 0x42, 0x42, 0xfe, /*Color of index 61*/ 0xfa, 0xf9, 0xfa, 0xc9, /*Color of index 62*/ 0xf0, 0xef, 0xf0, 0xf8, /*Color of index 63*/ 0xeb, 0xea, 0xeb, 0xff, /*Color of index 64*/ 0xe8, 0xe7, 0xe8, 0xff, /*Color of index 65*/ 0xe6, 0xe5, 0xe6, 0xff, /*Color of index 66*/ 0xde, 0xdc, 0xdd, 0xff, /*Color of index 67*/ 0xcb, 0xc8, 0xca, 0xff, /*Color of index 68*/ 0xc5, 0xc3, 0xc5, 0xff, /*Color of index 69*/ 0xb7, 0xb5, 0xb6, 0xff, /*Color of index 70*/ 0xb3, 0xb0, 0xb2, 0xff, /*Color of index 71*/ 0xb1, 0xae, 0xb0, 0xff, /*Color of index 72*/ 0xac, 0xa9, 0xab, 0xff, /*Color of index 73*/ 0xaa, 0xa7, 0xa9, 0xff, /*Color of index 74*/ 0xa5, 0xa2, 0xa4, 0xff, /*Color of index 75*/ 0xa2, 0x9f, 0xa1, 0xff, /*Color of index 76*/ 0x9c, 0x9a, 0x9b, 0xff, /*Color of index 77*/ 0x99, 0x97, 0x98, 0xff, /*Color of index 78*/ 0x98, 0x94, 0x97, 0xfb, /*Color of index 79*/ 0x97, 0x94, 0x96, 0xff, /*Color of index 80*/ 0x90, 0x8c, 0x8f, 0xfa, /*Color of index 81*/ 0x91, 0x8d, 0x8f, 0xfd, /*Color of index 82*/ 0x8c, 0x89, 0x8b, 0xfe, /*Color of index 83*/ 0x8a, 0x87, 0x89, 0xfd, /*Color of index 84*/ 0x87, 0x84, 0x86, 0xf9, /*Color of index 85*/ 0x85, 0x81, 0x83, 0xf9, /*Color of index 86*/ 0x82, 0x7e, 0x81, 0xf9, /*Color of index 87*/ 0x7b, 0x77, 0x7a, 0xfb, /*Color of index 88*/ 0x79, 0x76, 0x78, 0xfb, /*Color of index 89*/ 0x75, 0x72, 0x74, 0xfb, /*Color of index 90*/ 0x72, 0x6e, 0x70, 0xfa, /*Color of index 91*/ 0x70, 0x6c, 0x6e, 0xfb, /*Color of index 92*/ 0x6c, 0x6a, 0x6b, 0xff, /*Color of index 93*/ 0x68, 0x65, 0x67, 0xfd, /*Color of index 94*/ 0x65, 0x61, 0x64, 0xf9, /*Color of index 95*/ 0x61, 0x5f, 0x60, 0xfd, /*Color of index 96*/ 0x60, 0x5e, 0x5f, 0xfe, /*Color of index 97*/ 0x5b, 0x59, 0x5a, 0xfc, /*Color of index 98*/ 0x5a, 0x57, 0x59, 0xfb, /*Color of index 99*/ 0x58, 0x55, 0x57, 0xfa, /*Color of index 100*/ 0x53, 0x51, 0x52, 0xfc, /*Color of index 101*/ 0x4c, 0x4a, 0x4b, 0xfc, /*Color of index 102*/ 0x47, 0x45, 0x46, 0xfb, /*Color of index 103*/ 0x41, 0x3c, 0x3f, 0xf9, /*Color of index 104*/ 0x42, 0x3f, 0x41, 0xfd, /*Color of index 105*/ 0x39, 0x35, 0x38, 0xfa, /*Color of index 106*/ 0x39, 0x38, 0x39, 0xff, /*Color of index 107*/ 0x35, 0x31, 0x34, 0xfb, /*Color of index 108*/ 0x1b, 0x19, 0x1a, 0xfd, /*Color of index 109*/ 0x18, 0x17, 0x18, 0xff, /*Color of index 110*/ 0x16, 0x15, 0x16, 0xff, /*Color of index 111*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 112*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 113*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 114*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 115*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 116*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 117*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 118*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 119*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 120*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 121*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 122*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 123*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 124*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 125*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 126*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 127*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 128*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 129*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 130*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 131*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 132*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 133*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 134*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 135*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 136*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 137*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 138*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 139*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 140*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 141*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 142*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 143*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 144*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 145*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 146*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 147*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 148*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 149*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 150*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 151*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 152*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 153*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 154*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 155*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 156*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 157*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 158*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 159*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 160*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 161*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 162*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 163*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 164*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 165*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 166*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 167*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 168*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 169*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 170*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 171*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 172*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 173*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 174*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 175*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 176*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 177*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 178*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 179*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 180*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 181*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 182*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 183*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 184*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 185*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 186*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 187*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 188*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 189*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 190*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 191*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 192*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 193*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 194*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 195*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 196*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 197*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 198*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 199*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 200*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 201*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 202*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 203*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 204*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 205*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 206*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 207*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 208*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 209*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 210*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 211*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 212*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 213*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 214*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 215*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 216*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 217*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 218*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 219*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 220*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 221*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 222*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 223*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 224*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 225*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 226*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 227*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 228*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 229*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 230*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 231*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 232*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 233*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 234*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 235*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 236*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 237*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 238*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 239*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 240*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 241*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 242*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 243*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 244*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 245*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 246*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 247*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 248*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 249*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 250*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 251*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 252*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 253*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 254*/ 0x00, 0x00, 0x00, 0x00, /*Color of index 255*/ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x03, 0x05, 0x04, 0x3e, 0x3b, 0x10, 0x10, 0x3b, 0x3e, 0x04, 0x05, 0x03, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x09, 0x02, 0x0b, 0x40, 0x43, 0x45, 0x49, 0x4e, 0x53, 0x52, 0x4d, 0x3c, 0x45, 0x43, 0x40, 0x0b, 0x02, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x06, 0x08, 0x3f, 0x43, 0x4b, 0x5e, 0x6c, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x6d, 0x67, 0x5a, 0x4a, 0x43, 0x3f, 0x08, 0x06, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x07, 0x0e, 0x43, 0x53, 0x6a, 0x15, 0x15, 0x15, 0x18, 0x13, 0x13, 0x13, 0x13, 0x13, 0x14, 0x15, 0x15, 0x15, 0x12, 0x64, 0x50, 0x43, 0x0e, 0x07, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x08, 0x0f, 0x4b, 0x68, 0x15, 0x15, 0x14, 0x6e, 0x13, 0x14, 0x14, 0x18, 0x18, 0x18, 0x18, 0x14, 0x14, 0x6f, 0x6f, 0x15, 0x15, 0x12, 0x5f, 0x3c, 0x0f, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0a, 0x40, 0x58, 0x18, 0x15, 0x13, 0x6f, 0x14, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x18, 0x14, 0x6e, 0x15, 0x15, 0x66, 0x51, 0x40, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x0a, 0x41, 0x5f, 0x15, 0x18, 0x6f, 0x14, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x14, 0x6e, 0x15, 0x6b, 0x57, 0x41, 0x0a, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x40, 0x5f, 0x15, 0x14, 0x13, 0x18, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x18, 0x6e, 0x15, 0x6b, 0x56, 0x40, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x07, 0x0f, 0x58, 0x15, 0x13, 0x14, 0x18, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x6e, 0x15, 0x3d, 0x51, 0x0f, 0x07, 0x00, 0x01, 0x00, 0x01, 0x00, 0x06, 0x0e, 0x4b, 0x18, 0x18, 0x13, 0x18, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x6d, 0x15, 0x62, 0x3c, 0x0e, 0x06, 0x00, 0x01, 0x01, 0x00, 0x08, 0x43, 0x68, 0x15, 0x6e, 0x18, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x18, 0x13, 0x15, 0x5a, 0x43, 0x08, 0x00, 0x01, 0x00, 0x09, 0x3f, 0x53, 0x15, 0x13, 0x14, 0x15, 0x15, 0x15, 0x17, 0x37, 0x37, 0x37, 0x37, 0x17, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x17, 0x37, 0x37, 0x37, 0x37, 0x17, 0x15, 0x15, 0x15, 0x13, 0x15, 0x3d, 0x4d, 0x3f, 0x09, 0x00, 0x00, 0x02, 0x43, 0x6a, 0x15, 0x6f, 0x15, 0x15, 0x18, 0x37, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x37, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x37, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x37, 0x18, 0x15, 0x15, 0x6f, 0x15, 0x5b, 0x43, 0x02, 0x00, 0x01, 0x0b, 0x4b, 0x15, 0x13, 0x14, 0x15, 0x17, 0x18, 0x15, 0x2d, 0x28, 0x23, 0x23, 0x28, 0x2f, 0x15, 0x3a, 0x17, 0x15, 0x15, 0x17, 0x3a, 0x15, 0x2f, 0x28, 0x23, 0x23, 0x28, 0x2d, 0x15, 0x18, 0x17, 0x15, 0x13, 0x15, 0x66, 0x47, 0x0d, 0x01, 0x03, 0x40, 0x5e, 0x15, 0x6e, 0x15, 0x17, 0x15, 0x15, 0x23, 0x1a, 0x19, 0x19, 0x19, 0x19, 0x1b, 0x26, 0x15, 0x15, 0x3a, 0x3a, 0x15, 0x15, 0x25, 0x1b, 0x19, 0x19, 0x19, 0x19, 0x1b, 0x23, 0x15, 0x15, 0x17, 0x18, 0x18, 0x12, 0x54, 0x40, 0x03, 0x05, 0x43, 0x6c, 0x15, 0x13, 0x18, 0x18, 0x15, 0x21, 0x19, 0x19, 0x19, 0x1a, 0x1a, 0x19, 0x19, 0x19, 0x21, 0x15, 0x15, 0x15, 0x15, 0x21, 0x19, 0x19, 0x19, 0x1a, 0x1a, 0x19, 0x19, 0x19, 0x21, 0x15, 0x18, 0x18, 0x6f, 0x15, 0x5c, 0x43, 0x05, 0x04, 0x45, 0x15, 0x18, 0x14, 0x37, 0x15, 0x23, 0x19, 0x19, 0x1d, 0x28, 0x2c, 0x2b, 0x27, 0x1c, 0x19, 0x19, 0x20, 0x15, 0x35, 0x20, 0x19, 0x19, 0x1c, 0x27, 0x2c, 0x2c, 0x28, 0x1d, 0x19, 0x19, 0x23, 0x15, 0x37, 0x6f, 0x15, 0x63, 0x44, 0x04, 0x3e, 0x49, 0x15, 0x13, 0x39, 0x15, 0x2d, 0x1b, 0x19, 0x1d, 0x2e, 0x15, 0x15, 0x15, 0x15, 0x2e, 0x1e, 0x19, 0x19, 0x22, 0x2a, 0x19, 0x19, 0x1f, 0x2f, 0x15, 0x15, 0x15, 0x15, 0x2d, 0x1d, 0x19, 0x1b, 0x2d, 0x15, 0x16, 0x15, 0x66, 0x46, 0x0c, 0x3b, 0x4e, 0x15, 0x13, 0x36, 0x15, 0x28, 0x19, 0x19, 0x28, 0x15, 0x31, 0x17, 0x17, 0x35, 0x15, 0x37, 0x1d, 0x19, 0x19, 0x27, 0x22, 0x1c, 0x17, 0x15, 0x35, 0x17, 0x17, 0x31, 0x15, 0x28, 0x19, 0x19, 0x28, 0x15, 0x34, 0x15, 0x69, 0x4a, 0x3b, 0x10, 0x53, 0x15, 0x13, 0x36, 0x15, 0x23, 0x19, 0x1a, 0x2b, 0x15, 0x17, 0x15, 0x15, 0x15, 0x37, 0x15, 0x2d, 0x1b, 0x19, 0x19, 0x29, 0x35, 0x15, 0x38, 0x15, 0x15, 0x15, 0x17, 0x15, 0x2b, 0x1a, 0x19, 0x23, 0x15, 0x33, 0x15, 0x3d, 0x4c, 0x10, 0x10, 0x53, 0x15, 0x6f, 0x36, 0x15, 0x23, 0x19, 0x1a, 0x2b, 0x15, 0x17, 0x15, 0x15, 0x15, 0x38, 0x15, 0x35, 0x29, 0x1a, 0x19, 0x1b, 0x2d, 0x15, 0x37, 0x15, 0x15, 0x15, 0x17, 0x15, 0x2b, 0x1a, 0x19, 0x23, 0x15, 0x33, 0x15, 0x69, 0x4c, 0x10, 0x3b, 0x4d, 0x15, 0x13, 0x36, 0x15, 0x28, 0x19, 0x19, 0x28, 0x15, 0x31, 0x17, 0x17, 0x35, 0x15, 0x3a, 0x1b, 0x22, 0x26, 0x19, 0x19, 0x1d, 0x36, 0x15, 0x35, 0x17, 0x3a, 0x31, 0x15, 0x28, 0x19, 0x19, 0x28, 0x15, 0x32, 0x15, 0x67, 0x49, 0x3b, 0x3e, 0x3c, 0x15, 0x14, 0x39, 0x15, 0x2d, 0x1b, 0x19, 0x1d, 0x2d, 0x15, 0x15, 0x15, 0x15, 0x2e, 0x1e, 0x19, 0x19, 0x2a, 0x22, 0x19, 0x19, 0x1f, 0x2e, 0x15, 0x15, 0x15, 0x15, 0x2d, 0x1c, 0x19, 0x1a, 0x2e, 0x15, 0x16, 0x15, 0x65, 0x46, 0x0c, 0x04, 0x45, 0x6d, 0x15, 0x14, 0x37, 0x15, 0x24, 0x19, 0x19, 0x1d, 0x28, 0x2b, 0x2b, 0x27, 0x1c, 0x19, 0x19, 0x20, 0x35, 0x15, 0x20, 0x19, 0x19, 0x1c, 0x27, 0x2b, 0x2b, 0x28, 0x1d, 0x19, 0x19, 0x24, 0x15, 0x37, 0x6f, 0x15, 0x5f, 0x44, 0x04, 0x05, 0x43, 0x67, 0x15, 0x6f, 0x18, 0x18, 0x15, 0x21, 0x19, 0x19, 0x19, 0x1a, 0x1a, 0x19, 0x19, 0x19, 0x21, 0x15, 0x15, 0x15, 0x15, 0x21, 0x19, 0x19, 0x19, 0x1a, 0x1a, 0x19, 0x19, 0x19, 0x21, 0x15, 0x18, 0x18, 0x13, 0x15, 0x59, 0x43, 0x05, 0x03, 0x40, 0x59, 0x15, 0x6f, 0x18, 0x17, 0x15, 0x15, 0x23, 0x1b, 0x19, 0x19, 0x19, 0x19, 0x1b, 0x26, 0x15, 0x15, 0x3a, 0x3a, 0x15, 0x15, 0x25, 0x1b, 0x19, 0x19, 0x19, 0x19, 0x1b, 0x23, 0x15, 0x15, 0x17, 0x14, 0x15, 0x6b, 0x52, 0x41, 0x03, 0x01, 0x0b, 0x4a, 0x12, 0x15, 0x14, 0x15, 0x17, 0x18, 0x15, 0x2d, 0x28, 0x23, 0x23, 0x28, 0x30, 0x15, 0x3a, 0x17, 0x15, 0x15, 0x17, 0x17, 0x15, 0x30, 0x28, 0x23, 0x23, 0x28, 0x2d, 0x15, 0x18, 0x17, 0x15, 0x6f, 0x15, 0x60, 0x47, 0x0d, 0x01, 0x00, 0x02, 0x43, 0x64, 0x15, 0x6e, 0x15, 0x15, 0x18, 0x37, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x37, 0x15, 0x15, 0x15, 0x15, 0x15, 0x18, 0x37, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x37, 0x18, 0x15, 0x18, 0x14, 0x13, 0x57, 0x43, 0x02, 0x00, 0x00, 0x09, 0x3f, 0x50, 0x12, 0x15, 0x14, 0x15, 0x15, 0x15, 0x17, 0x37, 0x37, 0x37, 0x37, 0x17, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x17, 0x37, 0x37, 0x37, 0x37, 0x17, 0x15, 0x15, 0x15, 0x6e, 0x15, 0x61, 0x4c, 0x3f, 0x09, 0x00, 0x01, 0x00, 0x08, 0x43, 0x5f, 0x15, 0x6e, 0x18, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x14, 0x15, 0x11, 0x55, 0x43, 0x08, 0x00, 0x01, 0x01, 0x00, 0x06, 0x0e, 0x49, 0x66, 0x15, 0x6d, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x18, 0x6e, 0x15, 0x58, 0x3c, 0x0e, 0x06, 0x00, 0x01, 0x00, 0x01, 0x00, 0x07, 0x0f, 0x51, 0x6b, 0x15, 0x6e, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x18, 0x6d, 0x15, 0x5d, 0x4f, 0x0f, 0x07, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x40, 0x56, 0x6b, 0x15, 0x6d, 0x18, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x14, 0x6e, 0x15, 0x5e, 0x51, 0x40, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x0a, 0x41, 0x56, 0x3d, 0x15, 0x6f, 0x13, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x18, 0x6e, 0x15, 0x15, 0x5d, 0x51, 0x42, 0x0a, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x0a, 0x40, 0x52, 0x62, 0x15, 0x15, 0x6f, 0x13, 0x18, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x14, 0x6e, 0x14, 0x15, 0x11, 0x58, 0x4f, 0x40, 0x0a, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x08, 0x0f, 0x3c, 0x5a, 0x3d, 0x15, 0x15, 0x18, 0x6e, 0x6f, 0x13, 0x14, 0x14, 0x14, 0x14, 0x13, 0x6f, 0x13, 0x15, 0x15, 0x13, 0x61, 0x55, 0x48, 0x0f, 0x08, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x07, 0x0e, 0x43, 0x4d, 0x5b, 0x66, 0x12, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x6b, 0x61, 0x57, 0x4c, 0x43, 0x0e, 0x07, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x06, 0x08, 0x3f, 0x43, 0x47, 0x54, 0x5c, 0x63, 0x66, 0x69, 0x3d, 0x3d, 0x67, 0x65, 0x5f, 0x59, 0x52, 0x47, 0x43, 0x3f, 0x08, 0x06, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x09, 0x02, 0x0d, 0x40, 0x43, 0x44, 0x46, 0x4a, 0x4c, 0x4c, 0x49, 0x46, 0x44, 0x43, 0x41, 0x0d, 0x02, 0x09, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x03, 0x05, 0x04, 0x0c, 0x3b, 0x10, 0x10, 0x3b, 0x0c, 0x04, 0x05, 0x03, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; const lv_img_dsc_t ESP32Berry_Icon = { .header.cf = LV_IMG_CF_INDEXED_8BIT, .header.always_zero = 0, .header.reserved = 0, .header.w = 40, .header.h = 40, .data_size = 2624, .data = ESP32Berry_Icon_map, };
23,206
ESP32Berry_Icon
c
en
c
code
{"qsc_code_num_words": 3748, "qsc_code_num_chars": 23206.0, "qsc_code_mean_word_length": 3.92129136, "qsc_code_frac_words_unique": 0.13794023, "qsc_code_frac_chars_top_2grams": 0.32387562, "qsc_code_frac_chars_top_3grams": 0.33721168, "qsc_code_frac_chars_top_4grams": 0.27107573, "qsc_code_frac_chars_dupe_5grams": 0.58950806, "qsc_code_frac_chars_dupe_6grams": 0.55249371, "qsc_code_frac_chars_dupe_7grams": 0.54242362, "qsc_code_frac_chars_dupe_8grams": 0.2552902, "qsc_code_frac_chars_dupe_9grams": 0.24522011, "qsc_code_frac_chars_dupe_10grams": 0.23651085, "qsc_code_frac_chars_replacement_symbols": 0.0, "qsc_code_frac_chars_digital": 0.42426526, "qsc_code_frac_chars_whitespace": 0.19943118, "qsc_code_size_file_byte": 23206.0, "qsc_code_num_lines": 326.0, "qsc_code_num_chars_line_max": 243.0, "qsc_code_num_chars_line_mean": 71.18404908, "qsc_code_frac_chars_alphabet": 0.36683174, "qsc_code_frac_chars_comments": 0.24959062, "qsc_code_cate_xml_start": 0.0, "qsc_code_frac_lines_dupe_lines": 0.47452229, "qsc_code_cate_autogen": 0.0, "qsc_code_frac_lines_long_string": 0.0, "qsc_code_frac_chars_string_length": 0.00034455, "qsc_code_frac_chars_long_word_length": 0.0, "qsc_code_frac_lines_string_concat": 0.0, "qsc_code_cate_encoded_data": 0.0, "qsc_code_frac_chars_hex_words": 0.60273343, "qsc_code_frac_lines_prompt_comments": 0.0, "qsc_code_frac_lines_assert": 0.0, "qsc_codec_frac_lines_func_ratio": 0.0, "qsc_codec_cate_bitsstdc": 0.0, "qsc_codec_nums_lines_main": 0, "qsc_codec_frac_lines_goto": 0.0, "qsc_codec_cate_var_zero": 0.0, "qsc_codec_score_lines_no_logic": 0.00318471, "qsc_codec_frac_lines_print": 0.0, "qsc_codec_frac_lines_preprocessor_directives": 0.02229299}
0
{"qsc_code_frac_chars_replacement_symbols": 0, "qsc_code_num_words": 0, "qsc_code_num_chars": 0, "qsc_code_mean_word_length": 0, "qsc_code_frac_chars_top_2grams": 1, "qsc_code_frac_chars_top_3grams": 1, "qsc_code_frac_chars_top_4grams": 1, "qsc_code_frac_chars_dupe_5grams": 0, "qsc_code_frac_chars_dupe_6grams": 0, "qsc_code_frac_chars_dupe_7grams": 0, "qsc_code_frac_chars_dupe_8grams": 0, "qsc_code_frac_chars_dupe_9grams": 0, "qsc_code_frac_chars_dupe_10grams": 0, "qsc_code_size_file_byte": 0, "qsc_code_num_lines": 0, "qsc_code_num_chars_line_max": 0, "qsc_code_num_chars_line_mean": 0, "qsc_code_frac_chars_alphabet": 1, "qsc_code_frac_chars_digital": 1, "qsc_code_frac_chars_whitespace": 0, "qsc_code_frac_chars_comments": 0, "qsc_code_cate_xml_start": 0, "qsc_code_frac_lines_dupe_lines": 0, "qsc_code_cate_autogen": 0, "qsc_code_frac_lines_long_string": 0, "qsc_code_frac_chars_string_length": 0, "qsc_code_frac_chars_long_word_length": 0, "qsc_code_cate_encoded_data": 0, "qsc_code_frac_chars_hex_words": 1, "qsc_code_frac_lines_prompt_comments": 0, "qsc_code_frac_lines_assert": 0, "qsc_codec_frac_lines_func_ratio": 0, "qsc_codec_nums_lines_main": 0, "qsc_codec_score_lines_no_logic": 0, "qsc_codec_frac_lines_preprocessor_directives": 0, "qsc_codec_frac_lines_print": 0}